trace{-class}.c: BT_ASSERT_PRE() -> BT_ASSERT_POST() (ref. count check)
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 4 Oct 2019 10:54:29 +0000 (06:54 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 4 Oct 2019 16:52:40 +0000 (12:52 -0400)
Those are postcondition assertions because they check some state after a
user function returns.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I3705ee451ff8ae024a2eb17fbe6ae9cc2b11d05e
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2127
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/lib/trace-ir/trace-class.c
src/lib/trace-ir/trace.c

index fb9f8a5a4557c98dd539b7e24d180cae879421b5..f9b8adea7e888611b4658cdb31ac1491ef0ba9b8 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/logging.h"
 
 #include "lib/assert-pre.h"
+#include "lib/assert-post.h"
 #include <babeltrace2/trace-ir/trace-class.h>
 #include <babeltrace2/trace-ir/trace-class-const.h>
 #include <babeltrace2/trace-ir/event-class.h>
@@ -106,7 +107,7 @@ void destroy_trace_class(struct bt_object *obj)
                         * The destruction listener should not have kept a
                         * reference to the trace class.
                         */
-                       BT_ASSERT_PRE(tc->base.ref_count == 1, "Destruction listener kept a reference to the trace class being destroyed: %![tc-]+T", tc);
+                       BT_ASSERT_POST(tc->base.ref_count == 1, "Destruction listener kept a reference to the trace class being destroyed: %![tc-]+T", tc);
                }
                g_array_free(tc->destruction_listeners, TRUE);
                tc->destruction_listeners = NULL;
index 72493a48589441a641955a7d2da9d0011f86ba1e..184fc0705f2dd6ea125aad2e73fb23a5748a1cb5 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/logging.h"
 
 #include "lib/assert-pre.h"
+#include "lib/assert-post.h"
 #include <babeltrace2/trace-ir/trace.h>
 #include <babeltrace2/trace-ir/trace-const.h>
 #include <babeltrace2/trace-ir/event-class.h>
@@ -108,7 +109,7 @@ void destroy_trace(struct bt_object *obj)
                         * The destruction listener should not have kept a
                         * reference to the trace.
                         */
-                       BT_ASSERT_PRE(trace->base.ref_count == 1, "Destruction listener kept a reference to the trace being destroyed: %![trace-]+t", trace);
+                       BT_ASSERT_POST(trace->base.ref_count == 1, "Destruction listener kept a reference to the trace being destroyed: %![trace-]+t", trace);
                }
                g_array_free(trace->destruction_listeners, TRUE);
                trace->destruction_listeners = NULL;
This page took 0.02633 seconds and 4 git commands to generate.