lib: add internal object pool API and use it; adapt plugins/tests
[babeltrace.git] / lib / ref.c
index 02d2c4e9bf914fe3467600d81ea4d5abd13058d9..e59187c6d706c0ef49d96bcd8a09d366b489e217 100644 (file)
--- a/lib/ref.c
+++ b/lib/ref.c
@@ -27,6 +27,7 @@
 #define BT_LOG_TAG "REF"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/ref-internal.h>
 #include <babeltrace/object-internal.h>
 
@@ -38,6 +39,8 @@ void *bt_get(void *ptr)
                goto end;
        }
 
+       BT_ASSERT_PRE(obj->is_shared, "Object is not shared: addr=%p", obj);
+
        if (unlikely(!obj->ref_count.release)) {
                goto end;
        }
@@ -66,6 +69,8 @@ void bt_put(void *ptr)
                return;
        }
 
+       BT_ASSERT_PRE(obj->is_shared, "Object is not shared: addr=%p", obj);
+
        if (unlikely(!obj->ref_count.release)) {
                return;
        }
This page took 0.023603 seconds and 4 git commands to generate.