aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-05-10 14:16:38 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-05-13 09:52:06 -0500
commitbe17f18b8cd438be7f8f65000c0baecdd5b34634 (patch)
treeb8a060ccb757650300919ea619046fe28e62c421 /qom
parent793c96b5403233fd9935c94b2af6d557c297a088 (diff)
qom: pass file/line/function to asserting casts
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1368188203-3407-5-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/qom/object.c b/qom/object.c
index 0aa0c07d70..bca6219a52 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -431,15 +431,16 @@ Object *object_dynamic_cast(Object *obj, const char *typename)
return NULL;
}
-Object *object_dynamic_cast_assert(Object *obj, const char *typename)
+Object *object_dynamic_cast_assert(Object *obj, const char *typename,
+ const char *file, int line, const char *func)
{
Object *inst;
inst = object_dynamic_cast(obj, typename);
if (!inst && obj) {
- fprintf(stderr, "Object %p is not an instance of type %s\n",
- obj, typename);
+ fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
+ file, line, func, obj, typename);
abort();
}
@@ -495,13 +496,15 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
}
ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class,
- const char *typename)
+ const char *typename,
+ const char *file, int line,
+ const char *func)
{
ObjectClass *ret = object_class_dynamic_cast(class, typename);
if (!ret && class) {
- fprintf(stderr, "Object %p is not an instance of type %s\n",
- class, typename);
+ fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
+ file, line, func, class, typename);
abort();
}