Cleanup: object-internal.h static inlines
[babeltrace.git] / include / babeltrace / object-internal.h
index 0b0fd0f7075d523a13a83ae6ffa257c4b774dba4..4bf4def69c070f3182003d5e57feae19d2ad6f2d 100644 (file)
@@ -33,7 +33,7 @@
 /**
  * All objects publicly exposed by Babeltrace APIs must contain this structure
  * as their first member. This allows the unification of all ref counting
- * mechanism and may be used to provide more base functionality to all
+ * mechanisms and may be used to provide more base functionality to all
  * objects.
  */
 struct bt_object {
@@ -45,11 +45,14 @@ struct bt_object {
 };
 
 static inline
-long bt_object_get_ref_count(const void *);
-static inline
-void bt_object_set_parent(void *, void *);
+long bt_object_get_ref_count(const void *ptr)
+{
+       const struct bt_object *obj = ptr;
+
+       return obj->ref_count.count;
+}
 
-static
+static inline
 void bt_object_release(void *ptr)
 {
        struct bt_object *obj = ptr;
@@ -59,7 +62,7 @@ void bt_object_release(void *ptr)
        }
 }
 
-static
+static inline
 void generic_release(struct bt_object *obj)
 {
        if (obj->parent) {
@@ -102,6 +105,7 @@ void bt_object_init(void *ptr, bt_object_release_func release)
        struct bt_object *obj = ptr;
 
        obj->release = release;
+       obj->parent = NULL;
        bt_ref_init(&obj->ref_count, generic_release);
 }
 
This page took 0.023302 seconds and 4 git commands to generate.