Remove Babeltrace 1 files and reorganize the tree
[babeltrace.git] / include / babeltrace / object-internal.h
index 4bf4def69c070f3182003d5e57feae19d2ad6f2d..e130a81e883d620cba525cffc28a4ffba2f90fcd 100644 (file)
@@ -74,11 +74,17 @@ void generic_release(struct bt_object *obj)
 }
 
 static inline
-struct bt_object *bt_object_get_parent(void *ptr)
+struct bt_object *bt_object_borrow_parent(void *ptr)
 {
        struct bt_object *obj = ptr;
 
-       return ptr ? bt_get(obj->parent) : NULL;
+       return obj ? obj->parent : NULL;
+}
+
+static inline
+struct bt_object *bt_object_get_parent(void *ptr)
+{
+       return bt_get(bt_object_borrow_parent(ptr));
 }
 
 static inline
@@ -96,6 +102,7 @@ void bt_object_set_parent(void *child_ptr, void *parent)
         * to the parent will be released once the object's reference count
         * falls to zero.
         */
+       BT_PUT(child->parent);
        child->parent = bt_get(parent);
 }
 
This page took 0.02335 seconds and 4 git commands to generate.