lib: use common precond. assert. macros from `assert-cond.h` thru lib
[babeltrace.git] / src / lib / graph / interrupter.c
index 2a066ddd90542505c3445db2c103b8ee71966f88..75237d3b0550a4ca2198d9e8fa5341caaf4bf046 100644 (file)
@@ -1,23 +1,7 @@
 /*
- * Copyright (c) 2019 Philippe Proulx <pproulx@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:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ * SPDX-License-Identifier: MIT
  *
- * 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 (c) 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
 #define BT_LOG_TAG "LIB/INTERRUPTER"
@@ -28,7 +12,7 @@
 #include <babeltrace2/babeltrace.h>
 
 #include "interrupter.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 
 static
 void destroy_interrupter(struct bt_object *obj)
@@ -40,6 +24,8 @@ extern struct bt_interrupter *bt_interrupter_create(void)
 {
        struct bt_interrupter *intr = g_new0(struct bt_interrupter, 1);
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        if (!intr) {
                BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one interrupter.");
                goto error;
@@ -57,19 +43,19 @@ end:
 
 void bt_interrupter_set(struct bt_interrupter *intr)
 {
-       BT_ASSERT_PRE_NON_NULL(intr, "Interrupter");
+       BT_ASSERT_PRE_INTR_NON_NULL(intr);
        intr->is_set = true;
 }
 
 void bt_interrupter_reset(struct bt_interrupter *intr)
 {
-       BT_ASSERT_PRE_NON_NULL(intr, "Interrupter");
+       BT_ASSERT_PRE_INTR_NON_NULL(intr);
        intr->is_set = false;
 }
 
 bt_bool bt_interrupter_is_set(const struct bt_interrupter *intr)
 {
-       BT_ASSERT_PRE_NON_NULL(intr, "Interrupter");
+       BT_ASSERT_PRE_INTR_NON_NULL(intr);
        return (bt_bool) intr->is_set;
 }
 
This page took 0.023908 seconds and 4 git commands to generate.