Move to kernel style SPDX license identifiers
[babeltrace.git] / src / ctf-writer / object.h
index 1e1b7869bce572719d035e5f42028d4594faf5dd..0f8eec4c8bea9236f299d4344af89119064b2ff8 100644 (file)
@@ -1,30 +1,12 @@
-#ifndef BABELTRACE_CTF_WRITER_OBJECT_INTERNAL_H
-#define BABELTRACE_CTF_WRITER_OBJECT_INTERNAL_H
-
 /*
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  */
 
+#ifndef BABELTRACE_CTF_WRITER_OBJECT_INTERNAL_H
+#define BABELTRACE_CTF_WRITER_OBJECT_INTERNAL_H
+
 #include "common/macros.h"
 #include "common/assert.h"
 #include <stdbool.h>
@@ -91,16 +73,16 @@ struct bt_ctf_object {
 static inline
 unsigned long long bt_ctf_object_get_ref_count(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
        return obj->ref_count;
 }
 
 static inline
 struct bt_ctf_object *bt_ctf_object_borrow_parent(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
        return obj->parent;
 }
 
@@ -119,8 +101,8 @@ struct bt_ctf_object *bt_ctf_object_get_parent(struct bt_ctf_object *obj)
 static inline
 void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object *parent)
 {
-       BT_ASSERT(child);
-       BT_ASSERT(child->is_shared);
+       BT_ASSERT_DBG(child);
+       BT_ASSERT_DBG(child->is_shared);
 
 #ifdef BT_LOGT
        BT_LOGT("Setting object's parent: addr=%p, parent-addr=%p",
@@ -134,7 +116,7 @@ void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object
         * object's reference count falls to zero.
         */
        if (parent) {
-               BT_ASSERT(!child->parent);
+               BT_ASSERT_DBG(!child->parent);
                child->parent = parent;
                bt_ctf_object_get_no_null_check(parent);
        } else {
@@ -149,9 +131,9 @@ void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object
 static inline
 void bt_ctf_object_try_spec_release(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
-       BT_ASSERT(obj->spec_release_func);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
+       BT_ASSERT_DBG(obj->spec_release_func);
 
        if (bt_ctf_object_get_ref_count(obj) == 0) {
                obj->spec_release_func(obj);
@@ -197,8 +179,8 @@ static inline
 void bt_ctf_object_init(struct bt_ctf_object *obj, bool is_shared,
                bt_ctf_object_release_func release_func)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(!is_shared || release_func);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(!is_shared || release_func);
        obj->is_shared = is_shared;
        obj->release_func = release_func;
        obj->parent_is_owner_listener_func = NULL;
@@ -224,8 +206,8 @@ static inline
 void bt_ctf_object_init_shared_with_parent(struct bt_ctf_object *obj,
                bt_ctf_object_release_func spec_release_func)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(spec_release_func);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(spec_release_func);
        bt_ctf_object_init_shared(obj, bt_ctf_object_with_parent_release_func);
        obj->spec_release_func = spec_release_func;
 }
@@ -234,26 +216,26 @@ static inline
 void bt_ctf_object_set_parent_is_owner_listener_func(struct bt_ctf_object *obj,
                bt_ctf_object_parent_is_owner_listener_func func)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
-       BT_ASSERT(obj->spec_release_func);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
+       BT_ASSERT_DBG(obj->spec_release_func);
        ((struct bt_ctf_object *) obj)->parent_is_owner_listener_func = func;
 }
 
 static inline
 void bt_ctf_object_inc_ref_count(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
        obj->ref_count++;
-       BT_ASSERT(obj->ref_count != 0);
+       BT_ASSERT_DBG(obj->ref_count != 0);
 }
 
 static inline
 void *bt_ctf_object_get_no_null_check_no_parent_check(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
 
 #ifdef BT_LOGT
        BT_LOGT("Incrementing object's reference count: %llu -> %llu: "
@@ -269,8 +251,8 @@ void *bt_ctf_object_get_no_null_check_no_parent_check(struct bt_ctf_object *obj)
 static inline
 void *bt_ctf_object_get_no_null_check(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
 
        if (G_UNLIKELY(obj->parent && bt_ctf_object_get_ref_count(obj) == 0)) {
 #ifdef BT_LOGT
@@ -295,9 +277,9 @@ void *bt_ctf_object_get_no_null_check(struct bt_ctf_object *obj)
 static inline
 void bt_ctf_object_put_no_null_check(struct bt_ctf_object *obj)
 {
-       BT_ASSERT(obj);
-       BT_ASSERT(obj->is_shared);
-       BT_ASSERT(obj->ref_count > 0);
+       BT_ASSERT_DBG(obj);
+       BT_ASSERT_DBG(obj->is_shared);
+       BT_ASSERT_DBG(obj->ref_count > 0);
 
 #ifdef BT_LOGT
        BT_LOGT("Decrementing object's reference count: %llu -> %llu: "
@@ -309,7 +291,7 @@ void bt_ctf_object_put_no_null_check(struct bt_ctf_object *obj)
        obj->ref_count--;
 
        if (obj->ref_count == 0) {
-               BT_ASSERT(obj->release_func);
+               BT_ASSERT_DBG(obj->release_func);
                obj->release_func(obj);
        }
 }
This page took 0.025581 seconds and 4 git commands to generate.