Cleanup: remove private babeltrace.h
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 12 Jun 2019 22:09:37 +0000 (18:09 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 13 Jun 2019 23:47:13 +0000 (19:47 -0400)
 * Remove unused macros
 * Replace duplicated macros with their glib equivalent
 * Move the *safe* static inlines to their own header
 * Namespace the remaining macros and move them to macros.h
 * Explicitly include 'common/macros.h' in all private headers that use
   'BT_HIDDEN'.
 * Remove BT_UNUSED, the attribute is a hard requirement anyway
 * Remove zmalloc and replace the only callsite with calloc

Change-Id: I1bd765ad27c808c8bbe5ef232062267cb4a230d9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1424
Tested-by: jenkins
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
155 files changed:
src/cli/babeltrace2-cfg-cli-args-connect.c
src/common/Makefile.am
src/common/assert.c
src/common/assert.h
src/common/babeltrace.h [deleted file]
src/common/common.c
src/common/common.h
src/common/macros.h [new file with mode: 0644]
src/common/safe.h [new file with mode: 0644]
src/compat/mman.c
src/ctf-writer/assert-pre.h
src/ctf-writer/attributes.c
src/ctf-writer/attributes.h
src/ctf-writer/clock-class.h
src/ctf-writer/clock.h
src/ctf-writer/event-class.h
src/ctf-writer/event.h
src/ctf-writer/field-path.h
src/ctf-writer/field-types.h
src/ctf-writer/field-wrapper.h
src/ctf-writer/fields.c
src/ctf-writer/fields.h
src/ctf-writer/functor.h
src/ctf-writer/object.c
src/ctf-writer/object.h
src/ctf-writer/resolve.c
src/ctf-writer/resolve.h
src/ctf-writer/stream-class.h
src/ctf-writer/stream.h
src/ctf-writer/trace.h
src/ctf-writer/utils.h
src/ctf-writer/validation.c
src/ctf-writer/validation.h
src/ctf-writer/values.h
src/ctf-writer/visitor.c
src/ctf-writer/visitor.h
src/ctf-writer/writer.h
src/ctfser/ctfser.c
src/ctfser/ctfser.h
src/fd-cache/fd-cache.h
src/lib/assert-pre.h
src/lib/graph/component-class.h
src/lib/graph/component-filter.h
src/lib/graph/component-sink.h
src/lib/graph/component-source.h
src/lib/graph/component.c
src/lib/graph/component.h
src/lib/graph/connection.h
src/lib/graph/graph.c
src/lib/graph/graph.h
src/lib/graph/message/event.c
src/lib/graph/message/event.h
src/lib/graph/message/iterator.h
src/lib/graph/message/message.h
src/lib/graph/message/packet.c
src/lib/graph/message/packet.h
src/lib/graph/port.h
src/lib/lib-logging.h
src/lib/object.h
src/lib/plugin/plugin-so.c
src/lib/plugin/plugin-so.h
src/lib/plugin/plugin.c
src/lib/plugin/plugin.h
src/lib/prio-heap/prio-heap.c
src/lib/prio-heap/prio-heap.h
src/lib/trace-ir/attributes.c
src/lib/trace-ir/attributes.h
src/lib/trace-ir/clock-class.h
src/lib/trace-ir/clock-snapshot.c
src/lib/trace-ir/clock-snapshot.h
src/lib/trace-ir/event-class.h
src/lib/trace-ir/event.h
src/lib/trace-ir/field-class.h
src/lib/trace-ir/field-path.h
src/lib/trace-ir/field-wrapper.h
src/lib/trace-ir/field.c
src/lib/trace-ir/field.h
src/lib/trace-ir/packet.c
src/lib/trace-ir/packet.h
src/lib/trace-ir/resolve-field-path.h
src/lib/trace-ir/stream-class.h
src/lib/trace-ir/stream.h
src/lib/trace-ir/trace-class.h
src/lib/trace-ir/trace.h
src/lib/trace-ir/utils.h
src/lib/value.h
src/logging/log.c
src/logging/log.h
src/plugins/ctf/common/bfcr/bfcr.h
src/plugins/ctf/common/metadata/ast.h
src/plugins/ctf/common/metadata/ctf-meta-resolve.c
src/plugins/ctf/common/metadata/ctf-meta-translate.c
src/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c
src/plugins/ctf/common/metadata/ctf-meta-update-in-ir.c
src/plugins/ctf/common/metadata/ctf-meta-update-meanings.c
src/plugins/ctf/common/metadata/ctf-meta-update-stream-class-config.c
src/plugins/ctf/common/metadata/ctf-meta-update-text-array-sequence.c
src/plugins/ctf/common/metadata/ctf-meta-update-value-storing-indexes.c
src/plugins/ctf/common/metadata/ctf-meta-validate.c
src/plugins/ctf/common/metadata/ctf-meta-visitors.h
src/plugins/ctf/common/metadata/ctf-meta-warn-meaningless-header-fields.c
src/plugins/ctf/common/metadata/decoder.h
src/plugins/ctf/common/metadata/objstack.c
src/plugins/ctf/common/metadata/objstack.h
src/plugins/ctf/common/metadata/scanner.h
src/plugins/ctf/common/metadata/visitor-parent-links.c
src/plugins/ctf/common/msg-iter/msg-iter.c
src/plugins/ctf/common/msg-iter/msg-iter.h
src/plugins/ctf/common/print.h
src/plugins/ctf/common/utils/utils.h
src/plugins/ctf/fs-sink/fs-sink-stream.c
src/plugins/ctf/fs-sink/fs-sink-stream.h
src/plugins/ctf/fs-sink/fs-sink-trace.h
src/plugins/ctf/fs-sink/fs-sink.c
src/plugins/ctf/fs-sink/fs-sink.h
src/plugins/ctf/fs-sink/translate-ctf-ir-to-tsdl.c
src/plugins/ctf/fs-sink/translate-ctf-ir-to-tsdl.h
src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.h
src/plugins/ctf/fs-src/data-stream-file.h
src/plugins/ctf/fs-src/file.h
src/plugins/ctf/fs-src/fs.h
src/plugins/ctf/fs-src/metadata.h
src/plugins/ctf/fs-src/query.c
src/plugins/ctf/fs-src/query.h
src/plugins/ctf/lttng-live/data-stream.h
src/plugins/ctf/lttng-live/lttng-live.h
src/plugins/ctf/lttng-live/metadata.h
src/plugins/ctf/lttng-live/viewer-connection.c
src/plugins/ctf/lttng-live/viewer-connection.h
src/plugins/lttng-utils/debug-info/bin-info.h
src/plugins/lttng-utils/debug-info/crc32.h
src/plugins/lttng-utils/debug-info/debug-info.h
src/plugins/lttng-utils/debug-info/dwarf.h
src/plugins/lttng-utils/debug-info/trace-ir-data-copy.h
src/plugins/lttng-utils/debug-info/trace-ir-mapping.h
src/plugins/lttng-utils/debug-info/trace-ir-metadata-copy.h
src/plugins/lttng-utils/debug-info/trace-ir-metadata-field-class-copy.h
src/plugins/lttng-utils/debug-info/utils.c
src/plugins/lttng-utils/debug-info/utils.h
src/plugins/text/dmesg/dmesg.h
src/plugins/text/pretty/pretty.h
src/plugins/text/pretty/print.c
src/plugins/utils/counter/counter.c
src/plugins/utils/counter/counter.h
src/plugins/utils/dummy/dummy.c
src/plugins/utils/dummy/dummy.h
src/plugins/utils/muxer/muxer.c
src/plugins/utils/muxer/muxer.h
src/plugins/utils/trimmer/trimmer.c
src/plugins/utils/trimmer/trimmer.h
src/python-plugin-provider/python-plugin-provider.c
tests/lib/test_trace_ir_ref.c
tests/plugins/test_bin_info.c
tests/plugins/test_dwarf.c

index 7e1657e0aeff7c7a95d140109956acb5621533a4..7f2ff92b065a0218967ccde6f525176cac26e629 100644 (file)
@@ -20,7 +20,9 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
+#include <string.h>
 #include <babeltrace2/babeltrace.h>
 #include "common/common.h"
 #include "babeltrace2-cfg.h"
 #include <babeltrace2/babeltrace.h>
 #include "common/common.h"
 #include "babeltrace2-cfg.h"
index 1a73672fb78b12149cbbecdce101f809cf9e428c..7db98d7af11d9cfe43d792e544eb6ac47f847c9a 100644 (file)
@@ -12,9 +12,10 @@ libbabeltrace2_common_la_SOURCES = \
 
 noinst_HEADERS = \
        align.h \
 
 noinst_HEADERS = \
        align.h \
-       babeltrace.h \
        list.h \
        list.h \
+       macros.h \
        mmap-align.h \
        mmap-align.h \
+       safe.h \
        version.h \
        version.i
 
        version.h \
        version.i
 
index 056e2f261a7cb81b3a0361cf7d28d0648ef9f831..c4a18c4e38ba47894a88402c8c3d0017d866091c 100644 (file)
@@ -20,6 +20,8 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include <stdio.h>
+
 #include "common/assert.h"
 #include "common/common.h"
 
 #include "common/assert.h"
 #include "common/common.h"
 
index 27fdeadbdac8de787fd9cbad12aefdfc61926312..e24231a96c9aee70b88ca05549f524d88d706e99 100644 (file)
@@ -25,7 +25,9 @@
  */
 
 #include <assert.h>
  */
 
 #include <assert.h>
-#include "common/babeltrace.h"
+#include <glib.h>
+
+#include "common/macros.h"
 
 #ifdef BT_DEBUG_MODE
 
 
 #ifdef BT_DEBUG_MODE
 
@@ -41,7 +43,7 @@ extern void bt_common_assert_failed(const char *file, int line,
        do {                                                                   \
                if (!(_cond)) {                                                \
                        bt_common_assert_failed(__FILE__, __LINE__, __func__,  \
        do {                                                                   \
                if (!(_cond)) {                                                \
                        bt_common_assert_failed(__FILE__, __LINE__, __func__,  \
-                               TOSTRING(_cond));                              \
+                               G_STRINGIFY(_cond));                           \
                }                                                              \
        } while (0)
 
                }                                                              \
        } while (0)
 
@@ -61,7 +63,7 @@ extern void bt_common_assert_failed(const char *file, int line,
  * In-depth explanation: https://stackoverflow.com/questions/37411809/how-to-elegantly-fix-this-unused-variable-warning/37412551#37412551
  */
 # define BT_ASSERT(_cond)      ((void) sizeof((void) (_cond), 0))
  * In-depth explanation: https://stackoverflow.com/questions/37411809/how-to-elegantly-fix-this-unused-variable-warning/37412551#37412551
  */
 # define BT_ASSERT(_cond)      ((void) sizeof((void) (_cond), 0))
-# define BT_ASSERT_FUNC                BT_UNUSED
+# define BT_ASSERT_FUNC                __attribute__((unused))
 #endif /* BT_DEBUG_MODE */
 
 #endif /* BABELTRACE_ASSERT_INTERNAL_H */
 #endif /* BT_DEBUG_MODE */
 
 #endif /* BABELTRACE_ASSERT_INTERNAL_H */
diff --git a/src/common/babeltrace.h b/src/common/babeltrace.h
deleted file mode 100644 (file)
index 49dfb1b..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef _BABELTRACE_INTERNAL_H
-#define _BABELTRACE_INTERNAL_H
-
-/*
- * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@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.
- *
- * 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.
- */
-#include <stdio.h>
-#include <glib.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <errno.h>
-#include "compat/string.h"
-#include <babeltrace2/types.h>
-
-#define PERROR_BUFLEN  200
-
-#ifndef likely
-# ifdef __GNUC__
-#  define likely(x)      __builtin_expect(!!(x), 1)
-# else
-#  define likely(x)      (!!(x))
-# endif
-#endif
-
-#ifndef unlikely
-# ifdef __GNUC__
-#  define unlikely(x)    __builtin_expect(!!(x), 0)
-# else
-#  define unlikely(x)    (!!(x))
-# endif
-#endif
-
-#ifndef min
-#define min(a, b)      (((a) < (b)) ? (a) : (b))
-#endif
-
-#ifndef max
-#define max(a, b)      (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef max_t
-#define max_t(type, a, b)      \
-       ((type) (a) > (type) (b) ? (type) (a) : (type) (b))
-#endif
-
-static inline
-bool bt_safe_to_mul_int64(int64_t a, int64_t b)
-{
-       if (a == 0 || b == 0) {
-               return true;
-       }
-
-       return a < INT64_MAX / b;
-}
-
-static inline
-bool bt_safe_to_mul_uint64(uint64_t a, uint64_t b)
-{
-       if (a == 0 || b == 0) {
-               return true;
-       }
-
-       return a < UINT64_MAX / b;
-}
-
-static inline
-bool bt_safe_to_add_int64(int64_t a, int64_t b)
-{
-       return a <= INT64_MAX - b;
-}
-
-static inline
-bool bt_safe_to_add_uint64(uint64_t a, uint64_t b)
-{
-       return a <= UINT64_MAX - b;
-}
-
-/*
- * Memory allocation zeroed
- */
-#define zmalloc(x) calloc(1, x)
-
-/*
- * BT_HIDDEN: set the hidden attribute for internal functions
- * On Windows, symbols are local unless explicitly exported,
- * see https://gcc.gnu.org/wiki/Visibility
- */
-#if defined(_WIN32) || defined(__CYGWIN__)
-#define BT_HIDDEN
-#else
-#define BT_HIDDEN __attribute__((visibility("hidden")))
-#endif
-
-#ifndef __STRINGIFY
-#define __STRINGIFY(x) #x
-#endif
-
-#define TOSTRING(x)    __STRINGIFY(x)
-
-#define BT_UNUSED      __attribute__((unused))
-
-#endif
index f37bec4112de72b90edb4afa8d50a8859ca92b15..a81f8e79acd7a9a86de1fb271fb6c2f2af3374fe 100644 (file)
@@ -39,7 +39,7 @@
 #include <stdio.h>
 #include <wchar.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <wchar.h>
 #include <stdbool.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include "compat/unistd.h"
 
 #include "common/common.h"
 #include "compat/unistd.h"
 
index 13dbaf49b1bef3e38cc9cb39597b80a9a2f3f9f8..d5f2d096e89dd8f1b48754c9205ef7c9b636bd38 100644 (file)
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include <stdbool.h>
-#include "common/assert.h"
-#include "common/babeltrace.h"
-#include <babeltrace2/trace-ir/field-class-const.h>
-#include <babeltrace2/trace-ir/field-path-const.h>
-#include <babeltrace2/trace-ir/event-class-const.h>
-#include <babeltrace2/graph/self-message-iterator.h>
-#include <babeltrace2/value.h>
+#include <errno.h>
+#include <glib.h>
 #include <inttypes.h>
 #include <stdarg.h>
 #include <inttypes.h>
 #include <stdarg.h>
+#include <stdbool.h>
 #include <stdint.h>
 #include <stdint.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <glib.h>
+
+#include <babeltrace2/graph/self-message-iterator.h>
+#include <babeltrace2/trace-ir/event-class-const.h>
+#include <babeltrace2/trace-ir/field-class-const.h>
+#include <babeltrace2/trace-ir/field-path-const.h>
+#include <babeltrace2/value.h>
+
+#include "common/assert.h"
+#include "common/macros.h"
+#include "common/safe.h"
 
 #define BT_COMMON_COLOR_RESET              "\033[0m"
 #define BT_COMMON_COLOR_BOLD               "\033[1m"
 
 #define BT_COMMON_COLOR_RESET              "\033[0m"
 #define BT_COMMON_COLOR_BOLD               "\033[1m"
diff --git a/src/common/macros.h b/src/common/macros.h
new file mode 100644 (file)
index 0000000..23d4b31
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _BABELTRACE_INTERNAL_H
+#define _BABELTRACE_INTERNAL_H
+
+/*
+ * Copyright 2012 Mathieu Desnoyers <mathieu.desnoyers@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.
+ *
+ * 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.
+ */
+
+
+#define bt_max_t(type, a, b)   \
+       ((type) (a) > (type) (b) ? (type) (a) : (type) (b))
+
+/*
+ * BT_HIDDEN: set the hidden attribute for internal functions
+ * On Windows, symbols are local unless explicitly exported,
+ * see https://gcc.gnu.org/wiki/Visibility
+ */
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define BT_HIDDEN
+#else
+#define BT_HIDDEN __attribute__((visibility("hidden")))
+#endif
+
+#endif
diff --git a/src/common/safe.h b/src/common/safe.h
new file mode 100644 (file)
index 0000000..26df90a
--- /dev/null
@@ -0,0 +1,35 @@
+
+#include <stdbool.h>
+#include <stdint.h>
+
+static inline
+bool bt_safe_to_mul_int64(int64_t a, int64_t b)
+{
+       if (a == 0 || b == 0) {
+               return true;
+       }
+
+       return a < INT64_MAX / b;
+}
+
+static inline
+bool bt_safe_to_mul_uint64(uint64_t a, uint64_t b)
+{
+       if (a == 0 || b == 0) {
+               return true;
+       }
+
+       return a < UINT64_MAX / b;
+}
+
+static inline
+bool bt_safe_to_add_int64(int64_t a, int64_t b)
+{
+       return a <= INT64_MAX - b;
+}
+
+static inline
+bool bt_safe_to_add_uint64(uint64_t a, uint64_t b)
+{
+       return a <= UINT64_MAX - b;
+}
index d0cea9df10fc50f0912269fe0aeb8ff0648924f0..aa31998004b2418d4015afbcf92c43055ffcb0ee 100644 (file)
@@ -29,6 +29,8 @@
 #define BT_LOG_TAG "COMPAT-MMAN"
 #include "logging.h"
 
 #define BT_LOG_TAG "COMPAT-MMAN"
 #include "logging.h"
 
+#include "common/macros.h"
+
 #ifdef __APPLE__
 /*
  * On macOS, we need a dummy symbol so that the linker won't
 #ifdef __APPLE__
 /*
  * On macOS, we need a dummy symbol so that the linker won't
index 8f66d514d6098bb4f6ccda2d70234efcf7919132..5811d7d42a518b38b6b3fea98977ade9bbf7dee6 100644 (file)
@@ -43,7 +43,7 @@
 
 #include <stdlib.h>
 #include <inttypes.h>
 
 #include <stdlib.h>
 #include <inttypes.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #ifdef BT_DEV_MODE
 /*
 
 #ifdef BT_DEV_MODE
 /*
 # define BT_CTF_ASSERT_PRE_MSG BT_LOGF
 #else
 # define BT_CTF_ASSERT_PRE(_cond, _fmt, ...)   ((void) sizeof((void) (_cond), 0))
 # define BT_CTF_ASSERT_PRE_MSG BT_LOGF
 #else
 # define BT_CTF_ASSERT_PRE(_cond, _fmt, ...)   ((void) sizeof((void) (_cond), 0))
-# define BT_CTF_ASSERT_PRE_FUNC        BT_UNUSED
+# define BT_CTF_ASSERT_PRE_FUNC        __attribute__((unused))
 # define BT_CTF_ASSERT_PRE_MSG(_fmt, ...)
 #endif /* BT_DEV_MODE */
 
 # define BT_CTF_ASSERT_PRE_MSG(_fmt, ...)
 #endif /* BT_DEV_MODE */
 
index e79dc58f1d3d34158d757448c058dec3cd7dd96e..961879e4ba4b13944a8b62dafc2b4185435e912b 100644 (file)
@@ -29,7 +29,7 @@
 #include "logging.h"
 
 #include "common/assert.h"
 #include "logging.h"
 
 #include "common/assert.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/string.h"
 #include <babeltrace2/ctf-writer/object.h>
 #include <inttypes.h>
 #include "compat/string.h"
 #include <babeltrace2/ctf-writer/object.h>
 #include <inttypes.h>
index a99065334d38194f88c88c6d66099fd982f73216..47dc047197f13b4a8c5237a78df09026f5fb98ba 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 #include <stdint.h>
 #endif
 
 #include <stdint.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "values.h"
 
 
 #include "values.h"
 
index d3175085addebab55eb3bbd22c51713f8161917c..b7bd7014609c8c5ccd9708e50f2ff1cdcdcaee1d 100644 (file)
@@ -25,7 +25,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object-pool.h"
 #include "compat/uuid.h"
 #include <babeltrace2/types.h>
 #include "lib/object-pool.h"
 #include "compat/uuid.h"
 #include <babeltrace2/types.h>
index f510d7363c87e858d157db741e2872acfe48ca6a..d38d8ea591a0e5fa50a084fa13f6458b2b3392a2 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include <babeltrace2/ctf-writer/clock.h>
  */
 
 #include <babeltrace2/ctf-writer/clock.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <glib.h>
 #include "compat/uuid.h"
 
 #include <glib.h>
 #include "compat/uuid.h"
 
index c5ebb85f2e5649375c60d1ffc7af212ef334b13e..e37e754d2492e219c65a050b50f46f82f79c1771 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include "common/assert.h"
  */
 
 #include "common/assert.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/ctf-writer/event.h>
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/fields.h>
 #include <babeltrace2/ctf-writer/event.h>
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/fields.h>
index 1a8138ab2ab2fd432b686b696a31e85c3150f5e4..69077a8498a1bb908e3f5fce5431fde5dbcc0a52 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include "common/assert.h"
  */
 
 #include "common/assert.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/fields.h>
 #include <babeltrace2/ctf-writer/stream-class.h>
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/fields.h>
 #include <babeltrace2/ctf-writer/stream-class.h>
index cf9edd3ff6b78e96344d3fe01bab79d1d6e8a9eb..76d3793ebfd9740ddf282005e3793b7049ea24be 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "common/common.h"
 #include "common/assert.h"
 
 #include "common/common.h"
 #include "common/assert.h"
+#include "common/macros.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <glib.h>
 
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <glib.h>
 
index e1f75fd6738bed8505f6d5d760d37fa0ffcc8121..89fbf97ed7b35ed23f8a608e4fe60c81f96f6bce 100644 (file)
@@ -34,7 +34,7 @@
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/types.h>
 
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/types.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "assert-pre.h"
 #include "clock-class.h"
 
 #include "assert-pre.h"
 #include "clock-class.h"
index 55aee6cf0c8384d7618b0953d24e15c37e278c97..a146a451043aba24d7774c4ec73e920454e1726b 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "fields.h"
 #include "object.h"
 
 #include "fields.h"
 #include "object.h"
index 832f8f2c651a5ae2458410df20cefff6a3973358..11f649cd6350a5626403ac987ca4b1af7deb68b8 100644 (file)
@@ -908,7 +908,7 @@ int bt_ctf_field_integer_serialize(struct bt_ctf_field_common *field,
                                LITTLE_ENDIAN : BIG_ENDIAN);
        }
 
                                LITTLE_ENDIAN : BIG_ENDIAN);
        }
 
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                BT_LOGE("Cannot serialize integer field: ret=%d", ret);
                goto end;
        }
                BT_LOGE("Cannot serialize integer field: ret=%d", ret);
                goto end;
        }
@@ -966,7 +966,7 @@ int bt_ctf_field_floating_point_serialize(struct bt_ctf_field_common *field,
                abort();
        }
 
                abort();
        }
 
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                BT_LOGE("Cannot serialize floating point number field: "
                        "ret=%d", ret);
                goto end;
                BT_LOGE("Cannot serialize floating point number field: "
                        "ret=%d", ret);
                goto end;
@@ -989,7 +989,7 @@ int bt_ctf_field_structure_serialize_recursive(struct bt_ctf_field_common *field
                field, bt_ctf_byte_order_string(native_byte_order));
        ret = bt_ctfser_align_offset_in_current_packet(ctfser,
                field->type->alignment);
                field, bt_ctf_byte_order_string(native_byte_order));
        ret = bt_ctfser_align_offset_in_current_packet(ctfser,
                field->type->alignment);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                BT_LOGE("Cannot align offset before serializing structure field: "
                        "ret=%d", ret);
                goto end;
                BT_LOGE("Cannot align offset before serializing structure field: "
                        "ret=%d", ret);
                goto end;
@@ -1005,7 +1005,7 @@ int bt_ctf_field_structure_serialize_recursive(struct bt_ctf_field_common *field
                        bt_ctfser_get_offset_in_current_packet_bits(ctfser),
                        member, i);
 
                        bt_ctfser_get_offset_in_current_packet_bits(ctfser),
                        member, i);
 
-               if (unlikely(!member)) {
+               if (G_UNLIKELY(!member)) {
                        ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
                                field->type, &field_name, NULL, i);
                        BT_ASSERT(ret == 0);
                        ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
                                field->type, &field_name, NULL, i);
                        BT_ASSERT(ret == 0);
@@ -1019,7 +1019,7 @@ int bt_ctf_field_structure_serialize_recursive(struct bt_ctf_field_common *field
 
                ret = bt_ctf_field_serialize_recursive((void *) member, ctfser,
                        native_byte_order);
 
                ret = bt_ctf_field_serialize_recursive((void *) member, ctfser,
                        native_byte_order);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
                                field->type, &field_name, NULL, i);
                        BT_ASSERT(ret == 0);
                        ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
                                field->type, &field_name, NULL, i);
                        BT_ASSERT(ret == 0);
@@ -1071,7 +1071,7 @@ int bt_ctf_field_array_serialize_recursive(struct bt_ctf_field_common *field,
                        elem_field, i);
                ret = bt_ctf_field_serialize_recursive(
                        (void *) elem_field, ctfser, native_byte_order);
                        elem_field, i);
                ret = bt_ctf_field_serialize_recursive(
                        (void *) elem_field, ctfser, native_byte_order);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        BT_LOGW("Cannot serialize array field's element field: "
                                "array-field-addr=%p, field-addr=%p, "
                                "index=%" PRId64, field, elem_field, i);
                        BT_LOGW("Cannot serialize array field's element field: "
                                "array-field-addr=%p, field-addr=%p, "
                                "index=%" PRId64, field, elem_field, i);
@@ -1105,7 +1105,7 @@ int bt_ctf_field_sequence_serialize_recursive(struct bt_ctf_field_common *field,
                        elem_field, i);
                ret = bt_ctf_field_serialize_recursive(
                        (void *) elem_field, ctfser, native_byte_order);
                        elem_field, i);
                ret = bt_ctf_field_serialize_recursive(
                        (void *) elem_field, ctfser, native_byte_order);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        BT_LOGW("Cannot serialize sequence field's element field: "
                                "sequence-field-addr=%p, field-addr=%p, "
                                "index=%" PRId64, field, elem_field, i);
                        BT_LOGW("Cannot serialize sequence field's element field: "
                                "sequence-field-addr=%p, field-addr=%p, "
                                "index=%" PRId64, field, elem_field, i);
@@ -1129,7 +1129,7 @@ int bt_ctf_field_string_serialize(struct bt_ctf_field_common *field,
        BT_LOGV("Serializing string field: addr=%p, native-bo=%s",
                field, bt_ctf_byte_order_string((int) native_byte_order));
        ret = bt_ctfser_write_string(ctfser, (const char *) string->buf->data);
        BT_LOGV("Serializing string field: addr=%p, native-bo=%s",
                field, bt_ctf_byte_order_string((int) native_byte_order));
        ret = bt_ctfser_write_string(ctfser, (const char *) string->buf->data);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                BT_LOGE("Cannot serialize string field: ret=%d", ret);
                goto end;
        }
                BT_LOGE("Cannot serialize string field: ret=%d", ret);
                goto end;
        }
index b1525e46ef3f7d11bf8093f697e7ca454b2d8560..9cba266d921a80c317768726b31aba3cd44182db 100644 (file)
@@ -38,7 +38,7 @@
 #include <babeltrace2/ctf-writer/fields.h>
 #include <babeltrace2/types.h>
 
 #include <babeltrace2/ctf-writer/fields.h>
 #include <babeltrace2/types.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include "ctfser/ctfser.h"
 
 #include "common/common.h"
 #include "ctfser/ctfser.h"
 
@@ -393,7 +393,7 @@ int bt_ctf_field_common_sequence_set_length(struct bt_ctf_field_common *field,
                length);
        BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_HOT(field, "Sequence field");
 
                length);
        BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_HOT(field, "Sequence field");
 
-       if (unlikely(length > sequence->elements->len)) {
+       if (G_UNLIKELY(length > sequence->elements->len)) {
                /* Make more room */
                struct bt_ctf_field_type_common_sequence *sequence_ft;
                uint64_t cur_len = sequence->elements->len;
                /* Make more room */
                struct bt_ctf_field_type_common_sequence *sequence_ft;
                uint64_t cur_len = sequence->elements->len;
@@ -656,7 +656,7 @@ int bt_ctf_field_common_string_append_len(struct bt_ctf_field_common *field,
 
        new_size = string_field->size + length;
 
 
        new_size = string_field->size + length;
 
-       if (unlikely(new_size + 1 > string_field->buf->len)) {
+       if (G_UNLIKELY(new_size + 1 > string_field->buf->len)) {
                g_array_set_size(string_field->buf, new_size + 1);
        }
 
                g_array_set_size(string_field->buf, new_size + 1);
        }
 
index 628f63ca8b7b9727af7b4191be31f387dd75cf39..5a289371389afb5d28a7d7cd71202c96e01a3469 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include <glib.h>
  */
 
 #include <glib.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 BT_HIDDEN
 void value_exists(gpointer element, gpointer search_query);
 
 BT_HIDDEN
 void value_exists(gpointer element, gpointer search_query);
index 616fcf3658b3a89f1549724911655cab9764cee8..db7990825693294ddaaa4fe8add83797fe22515e 100644 (file)
@@ -24,7 +24,7 @@
 
 void *bt_ctf_object_get_ref(void *obj)
 {
 
 void *bt_ctf_object_get_ref(void *obj)
 {
-       if (unlikely(!obj)) {
+       if (G_UNLIKELY(!obj)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -36,7 +36,7 @@ end:
 
 void bt_ctf_object_put_ref(void *obj)
 {
 
 void bt_ctf_object_put_ref(void *obj)
 {
-       if (unlikely(!obj)) {
+       if (G_UNLIKELY(!obj)) {
                return;
        }
 
                return;
        }
 
index 32317218537339be28901b88dad996df12715e52..003565471cab9918ff6762c7a9916a11b371f1e4 100644 (file)
@@ -25,7 +25,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <stdbool.h>
 
 #include "common/assert.h"
 #include <stdbool.h>
 
@@ -272,7 +272,7 @@ void *bt_ctf_object_get_no_null_check(struct bt_ctf_object *obj)
        BT_ASSERT(obj);
        BT_ASSERT(obj->is_shared);
 
        BT_ASSERT(obj);
        BT_ASSERT(obj->is_shared);
 
-       if (unlikely(obj->parent && bt_ctf_object_get_ref_count(obj) == 0)) {
+       if (G_UNLIKELY(obj->parent && bt_ctf_object_get_ref_count(obj) == 0)) {
 #ifdef BT_LOGV
                BT_LOGV("Incrementing object's parent's reference count: "
                        "addr=%p, parent-addr=%p", obj, obj->parent);
 #ifdef BT_LOGV
                BT_LOGV("Incrementing object's parent's reference count: "
                        "addr=%p, parent-addr=%p", obj, obj->parent);
index 6e9e2006c1d3ece72c76df6765b9afce31976463..fd59c873dc733414eac52b80eb69ea66206d12fc 100644 (file)
@@ -41,7 +41,7 @@
 #include <babeltrace2/ctf-writer/stream-class.h>
 #include <babeltrace2/types.h>
 
 #include <babeltrace2/ctf-writer/stream-class.h>
 #include <babeltrace2/types.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 
 #include "field-path.h"
 #include "common/assert.h"
 
 #include "field-path.h"
index f153d1c96c23fe3d0a856f07305aa3898fbdc1d1..930b22c4527aebef6bc1ffe6448196fb8d0035d6 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #include <babeltrace2/ctf-writer/field-types.h>
  */
 
 #include <babeltrace2/ctf-writer/field-types.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <glib.h>
 
 #include "field-types.h"
 #include <glib.h>
 
 #include "field-types.h"
index c008a1facc400bf58fae49f5d8fad76dd1d7e038..f7fc4dbb1b871a698df5871cae6eb1a78127e2dc 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include "common/assert.h"
  */
 
 #include "common/assert.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/visitor.h>
 #include "common/common.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/visitor.h>
index 8c3d7d7c1152f798469f47936df5cb6f8fd79502..253fb60685122e8e74840c6ff0f116c96e7a37c0 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include "common/assert.h"
  */
 
 #include "common/assert.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/ctf-writer/stream.h>
 #include "ctfser/ctfser.h"
 #include <stdint.h>
 #include <babeltrace2/ctf-writer/stream.h>
 #include "ctfser/ctfser.h"
 #include <stdint.h>
index ae5f1ec3918d6841a8f4f608baf750ff5122c970..ca6328fba7973be40a36a352212b4809545d53f7 100644 (file)
@@ -28,7 +28,7 @@
  * http://www.efficios.com/ctf
  */
 
  * http://www.efficios.com/ctf
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/uuid.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/fields.h>
 #include "compat/uuid.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/fields.h>
index 488251ce90de9f8ba8a72d3ed2f62e9603471daf..6cb0609a13822ca38a658a43e13493a4e13c9c3c 100644 (file)
@@ -21,7 +21,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/event.h>
 #include <stdint.h>
 #include <babeltrace2/ctf-writer/field-types.h>
 #include <babeltrace2/ctf-writer/event.h>
 #include <stdint.h>
index 1d50d4d6a86e9de555544003ea32308919a7c023..6522f865c799f3805b80fde6ee74825bf1856170 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <babeltrace2/ctf-writer/object.h>
 
 
 #include <babeltrace2/ctf-writer/object.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "assert-pre.h"
 #include "event-class.h"
 
 #include "assert-pre.h"
 #include "event-class.h"
index 18e6ff7e5ad55ba49a800b0a0ec91b64e0ccffdb..ccedba25dab528ac822989898e64beadcad16b7b 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "values.h"
 
 
 #include "values.h"
 
index b9137ef99f4108fb1dd8a0a4d742a531a043abdf..08b0fbcfca08e1440f4aea098ffe834e18a2fe74 100644 (file)
@@ -24,7 +24,9 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include <babeltrace2/types.h>
+
+#include "common/macros.h"
 
 struct bt_ctf_value;
 struct bt_ctf_private_value;
 
 struct bt_ctf_value;
 struct bt_ctf_private_value;
index 6cb5bab4cf6a304c99f3089919ffb847a96cd647..ca943f8708a7a30d65b0738f2a56eeacf0f8ab53 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <babeltrace2/ctf-writer/object.h>
 
 
 #include <babeltrace2/ctf-writer/object.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "visitor.h"
 
 
 #include "visitor.h"
 
index 549285e2d98baeb5b0adf67e99f52009ef8a03c6..512161171e5416c64fac53143d6ee6145649b34f 100644 (file)
@@ -25,8 +25,9 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include <stdlib.h>
 #include <babeltrace2/ctf-writer/visitor.h>
 #include <babeltrace2/ctf-writer/visitor.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 typedef void *(*bt_ctf_child_accessor)(void *object, int index);
 typedef int64_t (*bt_ctf_child_count_accessor)(void *object);
 
 typedef void *(*bt_ctf_child_accessor)(void *object, int index);
 typedef int64_t (*bt_ctf_child_count_accessor)(void *object);
index 37e6a58a6b2c99e199a6d396ac13e870fb8d4033..15b08856a65ec7cfe611b6dc132281a3980b9f2e 100644 (file)
@@ -32,7 +32,7 @@
 #include <babeltrace2/ctf-writer/trace.h>
 #include <babeltrace2/ctf-writer/writer.h>
 
 #include <babeltrace2/ctf-writer/trace.h>
 #include <babeltrace2/ctf-writer/writer.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "object.h"
 
 
 #include "object.h"
 
index 6203246972a173cad1c73ce488a407c8ca69ac93..9e970f19253e669a3c7b7dc9ca9632ba3434171f 100644 (file)
@@ -37,7 +37,7 @@
 #include <stdio.h>
 #include <wchar.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <wchar.h>
 #include <stdbool.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include "ctfser/ctfser.h"
 #include "compat/unistd.h"
 #include "common/common.h"
 #include "ctfser/ctfser.h"
 #include "compat/unistd.h"
index c270faf93e3a306b14dabf158f91b957464e319b..c59af924152bd5e704c66b9ebe6cc80f09ce773d 100644 (file)
@@ -41,6 +41,7 @@
 #include "common/mmap-align.h"
 #include <babeltrace2/types.h>
 #include "common/assert.h"
 #include "common/mmap-align.h"
 #include <babeltrace2/types.h>
 #include "common/assert.h"
+#include "common/macros.h"
 #include "compat/bitfield.h"
 #include <glib.h>
 
 #include "compat/bitfield.h"
 #include <glib.h>
 
@@ -140,13 +141,13 @@ bool _bt_ctfser_has_space_left(struct bt_ctfser *ctfser, uint64_t size_bits)
 {
        bool has_space_left = true;
 
 {
        bool has_space_left = true;
 
-       if (unlikely((ctfser->offset_in_cur_packet_bits + size_bits >
+       if (G_UNLIKELY((ctfser->offset_in_cur_packet_bits + size_bits >
                        _bt_ctfser_cur_packet_size_bits(ctfser)))) {
                has_space_left = false;
                goto end;
        }
 
                        _bt_ctfser_cur_packet_size_bits(ctfser)))) {
                has_space_left = false;
                goto end;
        }
 
-       if (unlikely(size_bits > UINT64_MAX - ctfser->offset_in_cur_packet_bits)) {
+       if (G_UNLIKELY(size_bits > UINT64_MAX - ctfser->offset_in_cur_packet_bits)) {
                has_space_left = false;
                goto end;
        }
                has_space_left = false;
                goto end;
        }
@@ -177,9 +178,9 @@ int bt_ctfser_align_offset_in_current_packet(struct bt_ctfser *ctfser,
        align_size_bits = ALIGN(ctfser->offset_in_cur_packet_bits,
                        alignment_bits) - ctfser->offset_in_cur_packet_bits;
 
        align_size_bits = ALIGN(ctfser->offset_in_cur_packet_bits,
                        alignment_bits) - ctfser->offset_in_cur_packet_bits;
 
-       if (unlikely(!_bt_ctfser_has_space_left(ctfser, align_size_bits))) {
+       if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, align_size_bits))) {
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -328,20 +329,20 @@ int bt_ctfser_write_byte_aligned_unsigned_int(struct bt_ctfser *ctfser,
 
        BT_ASSERT(alignment_bits % 8 == 0);
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
 
        BT_ASSERT(alignment_bits % 8 == 0);
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
-       if (unlikely(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
+       if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
 
        ret = _bt_ctfser_write_byte_aligned_unsigned_int_no_align(ctfser, value,
                size_bits, byte_order);
                        goto end;
                }
        }
 
        ret = _bt_ctfser_write_byte_aligned_unsigned_int_no_align(ctfser, value,
                size_bits, byte_order);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -363,20 +364,20 @@ int bt_ctfser_write_byte_aligned_signed_int(struct bt_ctfser *ctfser,
 
        BT_ASSERT(alignment_bits % 8 == 0);
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
 
        BT_ASSERT(alignment_bits % 8 == 0);
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
-       if (unlikely(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
+       if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
 
        ret = _bt_ctfser_write_byte_aligned_signed_int_no_align(ctfser, value,
                size_bits, byte_order);
                        goto end;
                }
        }
 
        ret = _bt_ctfser_write_byte_aligned_signed_int_no_align(ctfser, value,
                size_bits, byte_order);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -396,13 +397,13 @@ int bt_ctfser_write_unsigned_int(struct bt_ctfser *ctfser, uint64_t value,
        int ret = 0;
 
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
        int ret = 0;
 
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
-       if (unlikely(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
+       if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -441,13 +442,13 @@ int bt_ctfser_write_signed_int(struct bt_ctfser *ctfser, int64_t value,
        int ret = 0;
 
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
        int ret = 0;
 
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, alignment_bits);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
-       if (unlikely(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
+       if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, size_bits))) {
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
                ret = _bt_ctfser_increase_cur_packet_size(ctfser);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -521,14 +522,14 @@ int bt_ctfser_write_string(struct bt_ctfser *ctfser, const char *value)
        const char *at = value;
 
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, 8);
        const char *at = value;
 
        ret = bt_ctfser_align_offset_in_current_packet(ctfser, 8);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
        while (true) {
                goto end;
        }
 
        while (true) {
-               if (unlikely(!_bt_ctfser_has_space_left(ctfser, 8))) {
+               if (G_UNLIKELY(!_bt_ctfser_has_space_left(ctfser, 8))) {
                        ret = _bt_ctfser_increase_cur_packet_size(ctfser);
                        ret = _bt_ctfser_increase_cur_packet_size(ctfser);
-                       if (unlikely(ret)) {
+                       if (G_UNLIKELY(ret)) {
                                goto end;
                        }
                }
                                goto end;
                        }
                }
@@ -536,7 +537,7 @@ int bt_ctfser_write_string(struct bt_ctfser *ctfser, const char *value)
                memcpy(_bt_ctfser_get_addr(ctfser), at, sizeof(*at));
                _bt_ctfser_incr_offset(ctfser, 8);
 
                memcpy(_bt_ctfser_get_addr(ctfser), at, sizeof(*at));
                _bt_ctfser_incr_offset(ctfser, 8);
 
-               if (unlikely(*at == '\0')) {
+               if (G_UNLIKELY(*at == '\0')) {
                        break;
                }
 
                        break;
                }
 
index fb70a076e85b68880b0ab9ba9c1c6c268e4978ff..977aaf4d1610ad9753a2a3b574d38c284794a44c 100644 (file)
@@ -28,7 +28,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 struct bt_fd_cache_handle {
        int fd;
 
 struct bt_fd_cache_handle {
        int fd;
index 6264c8ac1c0e6e5cb7fc57794df466676ae48747..c28ec4c45034f9ed09c6bd96bfbd3dc3ab7bc1cb 100644 (file)
@@ -43,7 +43,7 @@
 
 #include <stdlib.h>
 #include <inttypes.h>
 
 #include <stdlib.h>
 #include <inttypes.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #ifdef BT_DEV_MODE
 /*
 
 #ifdef BT_DEV_MODE
 /*
 # define BT_ASSERT_PRE_MSG     BT_LIB_LOGF
 #else
 # define BT_ASSERT_PRE(_cond, _fmt, ...)       ((void) sizeof((void) (_cond), 0))
 # define BT_ASSERT_PRE_MSG     BT_LIB_LOGF
 #else
 # define BT_ASSERT_PRE(_cond, _fmt, ...)       ((void) sizeof((void) (_cond), 0))
-# define BT_ASSERT_PRE_FUNC    BT_UNUSED
+# define BT_ASSERT_PRE_FUNC    __attribute__((unused))
 # define BT_ASSERT_PRE_MSG(_fmt, ...)
 #endif /* BT_DEV_MODE */
 
 # define BT_ASSERT_PRE_MSG(_fmt, ...)
 #endif /* BT_DEV_MODE */
 
index 1c49a769bd1ba8cce9173b2066360dc80a597254..b1e60f0fdbf03ae2a5c73e31ac0d315d8ea0222b 100644 (file)
@@ -31,7 +31,7 @@
 #include <babeltrace2/graph/component-class-source.h>
 #include <babeltrace2/graph/component-class-filter.h>
 #include <babeltrace2/graph/component-class-sink.h>
 #include <babeltrace2/graph/component-class-source.h>
 #include <babeltrace2/graph/component-class-filter.h>
 #include <babeltrace2/graph/component-class-sink.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object.h"
 #include "common/list.h"
 #include <babeltrace2/types.h>
 #include "lib/object.h"
 #include "common/list.h"
 #include <babeltrace2/types.h>
index 7d5a792e45a9d5a1732100b615acb8a5c360c97e..194bab0f5e38dd6d89ac00d6a7e95060b96ccf2b 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/graph/component-filter-const.h>
 
 #include "component-class.h"
 #include <babeltrace2/graph/component-filter-const.h>
 
 #include "component-class.h"
index a67063518ff028c10127db724d8b904fa453b8c5..7eaff9af8fbfef05e325c03427e7284de3af616a 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/compiler.h"
 #include <babeltrace2/graph/component-sink-const.h>
 
 #include "compat/compiler.h"
 #include <babeltrace2/graph/component-sink-const.h>
 
index 747d760ec4550193aed57e05a51398e49abe923b..5166faee7a81f27efbf3f7e73c5de8b04932dc5c 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "component-class.h"
 #include "component.h"
 
 #include "component-class.h"
 #include "component.h"
index f4e4be1e3313b4bc4d61e87e8bc184a2b18165bf..5b202d7364c71c37b32e252e6619b589379ede79 100644 (file)
@@ -31,7 +31,7 @@
 #include <babeltrace2/graph/component-source-const.h>
 #include <babeltrace2/graph/component-filter-const.h>
 #include <babeltrace2/graph/component-sink-const.h>
 #include <babeltrace2/graph/component-source-const.h>
 #include <babeltrace2/graph/component-filter-const.h>
 #include <babeltrace2/graph/component-sink-const.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/compiler.h"
 #include <babeltrace2/types.h>
 #include <babeltrace2/value.h>
 #include "compat/compiler.h"
 #include <babeltrace2/types.h>
 #include <babeltrace2/value.h>
index 2753cfe9115b6e316ff431a497145cb599dd2648..285a8e9a74ffe24fb932cd68e7d5c08182aa5951 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/graph/component-const.h>
 #include "lib/object.h"
 #include <babeltrace2/types.h>
 #include <babeltrace2/graph/component-const.h>
 #include "lib/object.h"
 #include <babeltrace2/types.h>
index e6190fa5a500697331084db4a76b018d90949457..f54cf24091010f6e70829a36ab0819c26b8295b5 100644 (file)
@@ -28,6 +28,7 @@
 #include <babeltrace2/graph/message-iterator-const.h>
 #include "lib/object.h"
 #include "common/assert.h"
 #include <babeltrace2/graph/message-iterator-const.h>
 #include "lib/object.h"
 #include "common/assert.h"
+#include "common/macros.h"
 #include <stdbool.h>
 
 #include "message/iterator.h"
 #include <stdbool.h>
 
 #include "message/iterator.h"
index 4b87d73550d3c3d67a7918a1d8a98e89b6a2403e..72e575534087fbae47e5eb17396084de2a55c009 100644 (file)
@@ -609,7 +609,7 @@ enum bt_graph_status consume_sink_node(struct bt_graph *graph, GList *node)
 
        sink = node->data;
        status = consume_graph_sink(sink);
 
        sink = node->data;
        status = consume_graph_sink(sink);
-       if (unlikely(status != BT_GRAPH_STATUS_END)) {
+       if (G_UNLIKELY(status != BT_GRAPH_STATUS_END)) {
                g_queue_push_tail_link(graph->sinks_to_consume, node);
                goto end;
        }
                g_queue_push_tail_link(graph->sinks_to_consume, node);
                goto end;
        }
@@ -672,7 +672,7 @@ enum bt_graph_status consume_no_check(struct bt_graph *graph)
                "Graph has no sink component: %!+g", graph);
        BT_LIB_LOGV("Making next sink consume: %![graph-]+g", graph);
 
                "Graph has no sink component: %!+g", graph);
        BT_LIB_LOGV("Making next sink consume: %![graph-]+g", graph);
 
-       if (unlikely(g_queue_is_empty(graph->sinks_to_consume))) {
+       if (G_UNLIKELY(g_queue_is_empty(graph->sinks_to_consume))) {
                BT_LOGV_STR("Graph's sink queue is empty: end of graph.");
                status = BT_GRAPH_STATUS_END;
                goto end;
                BT_LOGV_STR("Graph's sink queue is empty: end of graph.");
                status = BT_GRAPH_STATUS_END;
                goto end;
@@ -699,7 +699,7 @@ enum bt_graph_status bt_graph_consume(struct bt_graph *graph)
                "Graph is in a faulty state: %!+g", graph);
        bt_graph_set_can_consume(graph, false);
        status = bt_graph_configure(graph);
                "Graph is in a faulty state: %!+g", graph);
        bt_graph_set_can_consume(graph, false);
        status = bt_graph_configure(graph);
-       if (unlikely(status)) {
+       if (G_UNLIKELY(status)) {
                /* bt_graph_configure() logs errors */
                goto end;
        }
                /* bt_graph_configure() logs errors */
                goto end;
        }
@@ -723,7 +723,7 @@ enum bt_graph_status bt_graph_run(struct bt_graph *graph)
                "Graph is in a faulty state: %!+g", graph);
        bt_graph_set_can_consume(graph, false);
        status = bt_graph_configure(graph);
                "Graph is in a faulty state: %!+g", graph);
        bt_graph_set_can_consume(graph, false);
        status = bt_graph_configure(graph);
-       if (unlikely(status)) {
+       if (G_UNLIKELY(status)) {
                /* bt_graph_configure() logs errors */
                goto end;
        }
                /* bt_graph_configure() logs errors */
                goto end;
        }
@@ -737,7 +737,7 @@ enum bt_graph_status bt_graph_run(struct bt_graph *graph)
                 * signal handler, this is not a warning nor an error,
                 * it was intentional: log with a DEBUG level only.
                 */
                 * signal handler, this is not a warning nor an error,
                 * it was intentional: log with a DEBUG level only.
                 */
-               if (unlikely(graph->canceled)) {
+               if (G_UNLIKELY(graph->canceled)) {
                        BT_LIB_LOGD("Stopping the graph: graph is canceled: "
                                "%!+g", graph);
                        status = BT_GRAPH_STATUS_CANCELED;
                        BT_LIB_LOGD("Stopping the graph: graph is canceled: "
                                "%!+g", graph);
                        status = BT_GRAPH_STATUS_CANCELED;
@@ -745,7 +745,7 @@ enum bt_graph_status bt_graph_run(struct bt_graph *graph)
                }
 
                status = consume_no_check(graph);
                }
 
                status = consume_no_check(graph);
-               if (unlikely(status == BT_GRAPH_STATUS_AGAIN)) {
+               if (G_UNLIKELY(status == BT_GRAPH_STATUS_AGAIN)) {
                        /*
                         * If AGAIN is received and there are multiple
                         * sinks, go ahead and consume from the next
                        /*
                         * If AGAIN is received and there are multiple
                         * sinks, go ahead and consume from the next
index c41d13162e91e03aee7cb1428480c1d1d07b7562..71328fae1d42405749ffb8b6a5f9bffe4ccf8ca5 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <babeltrace2/graph/graph.h>
 #include <babeltrace2/graph/message-const.h>
 
 #include <babeltrace2/graph/graph.h>
 #include <babeltrace2/graph/message-const.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object.h"
 #include "lib/object-pool.h"
 #include "common/assert.h"
 #include "lib/object.h"
 #include "lib/object-pool.h"
 #include "common/assert.h"
@@ -215,7 +215,7 @@ enum bt_graph_status bt_graph_configure(struct bt_graph *graph)
 
        BT_ASSERT(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY);
 
 
        BT_ASSERT(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY);
 
-       if (likely(graph->config_state ==
+       if (G_LIKELY(graph->config_state ==
                        BT_GRAPH_CONFIGURATION_STATE_CONFIGURED)) {
                goto end;
        }
                        BT_GRAPH_CONFIGURATION_STATE_CONFIGURED)) {
                goto end;
        }
index 00b428c203f9f52e268a4d60657e74d73d77675d..1d74e1dda2725f2f9ed8f8d40856321231b28b52 100644 (file)
@@ -108,7 +108,7 @@ struct bt_message *create_event_message(
                event_class, stream_class, with_cs, raw_value);
        BT_LIB_LOGD("Creating event message object: %![ec-]+E", event_class);
        event = bt_event_create(event_class, packet);
                event_class, stream_class, with_cs, raw_value);
        BT_LIB_LOGD("Creating event message object: %![ec-]+E", event_class);
        event = bt_event_create(event_class, packet);
-       if (unlikely(!event)) {
+       if (G_UNLIKELY(!event)) {
                BT_LIB_LOGE("Cannot create event from event class: "
                        "%![ec-]+E", event_class);
                goto error;
                BT_LIB_LOGE("Cannot create event from event class: "
                        "%![ec-]+E", event_class);
                goto error;
@@ -131,7 +131,7 @@ struct bt_message *create_event_message(
         */
        message = (void *) bt_message_create_from_pool(
                &msg_iter->graph->event_msg_pool, msg_iter->graph);
         */
        message = (void *) bt_message_create_from_pool(
                &msg_iter->graph->event_msg_pool, msg_iter->graph);
-       if (unlikely(!message)) {
+       if (G_UNLIKELY(!message)) {
                /* bt_message_create_from_pool() logs errors */
                goto error;
        }
                /* bt_message_create_from_pool() logs errors */
                goto error;
        }
@@ -210,7 +210,7 @@ void bt_message_event_recycle(struct bt_message *msg)
 
        BT_ASSERT(event_msg);
 
 
        BT_ASSERT(event_msg);
 
-       if (unlikely(!msg->graph)) {
+       if (G_UNLIKELY(!msg->graph)) {
                bt_message_event_destroy(msg);
                return;
        }
                bt_message_event_destroy(msg);
                return;
        }
index b53b6e2f696a2fc69987f3b9d9309ee57663bacf..d1a574588a1e340bea49ed0c15aa9bb9208f213f 100644 (file)
@@ -28,6 +28,7 @@
 #include <babeltrace2/trace-ir/event-class.h>
 #include <babeltrace2/trace-ir/event.h>
 #include "common/assert.h"
 #include <babeltrace2/trace-ir/event-class.h>
 #include <babeltrace2/trace-ir/event.h>
 #include "common/assert.h"
+#include "common/macros.h"
 
 #include "message.h"
 
 
 #include "message.h"
 
index bae41b19249d0f267c9ddbacbe49336a3b60ecf8..475abf555cc40d7a8e391976dc6173f64d4c503e 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object.h"
 #include <babeltrace2/graph/connection-const.h>
 #include <babeltrace2/graph/message-const.h>
 #include "lib/object.h"
 #include <babeltrace2/graph/connection-const.h>
 #include <babeltrace2/graph/message-const.h>
index 98437707737ce86114254a09003b6b2b82891378..98d27b9301c4988458156756ed35202ff56d346b 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object.h"
 #include "common/assert.h"
 #include <babeltrace2/graph/graph.h>
 #include "lib/object.h"
 #include "common/assert.h"
 #include <babeltrace2/graph/graph.h>
@@ -73,7 +73,7 @@ struct bt_message *bt_message_create_from_pool(
 {
        struct bt_message *msg = bt_object_pool_create_object(pool);
 
 {
        struct bt_message *msg = bt_object_pool_create_object(pool);
 
-       if (unlikely(!msg)) {
+       if (G_UNLIKELY(!msg)) {
 #ifdef BT_LIB_LOGE
                BT_LIB_LOGE("Cannot allocate one message from message pool: "
                        "%![pool-]+o, %![graph-]+g", pool, graph);
 #ifdef BT_LIB_LOGE
                BT_LIB_LOGE("Cannot allocate one message from message pool: "
                        "%![pool-]+o, %![graph-]+g", pool, graph);
@@ -81,7 +81,7 @@ struct bt_message *bt_message_create_from_pool(
                goto error;
        }
 
                goto error;
        }
 
-       if (likely(!msg->graph)) {
+       if (G_LIKELY(!msg->graph)) {
                msg->graph = graph;
        }
 
                msg->graph = graph;
        }
 
index 6bce712996b1f27910ca779e0d4800a6505bf56c..1a6169a254fc23c0bd38011066252fcc9e4cb4e0 100644 (file)
@@ -246,7 +246,7 @@ void bt_message_packet_beginning_recycle(struct bt_message *msg)
 {
        BT_ASSERT(msg);
 
 {
        BT_ASSERT(msg);
 
-       if (unlikely(!msg->graph)) {
+       if (G_UNLIKELY(!msg->graph)) {
                bt_message_packet_destroy(msg);
                return;
        }
                bt_message_packet_destroy(msg);
                return;
        }
@@ -259,7 +259,7 @@ void bt_message_packet_end_recycle(struct bt_message *msg)
 {
        BT_ASSERT(msg);
 
 {
        BT_ASSERT(msg);
 
-       if (unlikely(!msg->graph)) {
+       if (G_UNLIKELY(!msg->graph)) {
                bt_message_packet_destroy(msg);
                return;
        }
                bt_message_packet_destroy(msg);
                return;
        }
index 7738788c62bb8bf9e86b61f4a8bb68180f889812..ebd272d98e3043172cc414f4c8f188c0456c045b 100644 (file)
@@ -28,6 +28,7 @@
 #include <babeltrace2/trace-ir/packet.h>
 #include "lib/trace-ir/clock-snapshot.h"
 #include "common/assert.h"
 #include <babeltrace2/trace-ir/packet.h>
 #include "lib/trace-ir/clock-snapshot.h"
 #include "common/assert.h"
+#include "common/macros.h"
 
 #include "message.h"
 
 
 #include "message.h"
 
index c1be31add815233deea75101326aa70b7a57dcf6..a10fb7fa55d7233fa7dc6751b376f019690488c9 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <babeltrace2/graph/port-const.h>
  */
 
 #include <babeltrace2/graph/port-const.h>
+#include "common/macros.h"
 
 struct bt_port {
        struct bt_object base;
 
 struct bt_port {
        struct bt_object base;
index 59e85591cea45141f07a4a46036a5f89610ae5dd..9ec1fd9bcc907d56d3ae3df8276ecb045043dd48 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <stdarg.h>
 
 #ifndef BT_LOG_TAG
 #include <stdarg.h>
 
 #ifndef BT_LOG_TAG
index c3afd73f744459f6ec4beb5e2dd67b14c6a6741d..61a502f4254f1a98855c86e30cce553e161922b9 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <stdbool.h>
 
 #include "common/assert.h"
 #include <stdbool.h>
 
@@ -281,7 +281,7 @@ void bt_object_get_no_null_check(const void *c_obj)
        BT_ASSERT(obj);
        BT_ASSERT(obj->is_shared);
 
        BT_ASSERT(obj);
        BT_ASSERT(obj->is_shared);
 
-       if (unlikely(obj->parent && bt_object_get_ref_count(obj) == 0)) {
+       if (G_UNLIKELY(obj->parent && bt_object_get_ref_count(obj) == 0)) {
 #ifdef BT_LOGV
                BT_LOGV("Incrementing object's parent's reference count: "
                        "addr=%p, parent-addr=%p", obj, obj->parent);
 #ifdef BT_LOGV
                BT_LOGV("Incrementing object's parent's reference count: "
                        "addr=%p, parent-addr=%p", obj, obj->parent);
@@ -329,7 +329,7 @@ void bt_object_get_ref(const void *ptr)
 {
        struct bt_object *obj = (void *) ptr;
 
 {
        struct bt_object *obj = (void *) ptr;
 
-       if (unlikely(!obj)) {
+       if (G_UNLIKELY(!obj)) {
                return;
        }
 
                return;
        }
 
@@ -345,7 +345,7 @@ void bt_object_put_ref(const void *ptr)
 {
        struct bt_object *obj = (void *) ptr;
 
 {
        struct bt_object *obj = (void *) ptr;
 
-       if (unlikely(!obj)) {
+       if (G_UNLIKELY(!obj)) {
                return;
        }
 
                return;
        }
 
index 621353c0ada05f95235da103b5a99ea924695673..3b2be1529a06ff378f5006a12ddf0ffd6d2f7e8b 100644 (file)
@@ -50,7 +50,7 @@
 #define LIBTOOL_PLUGIN_SUFFIX          ".la"
 #define LIBTOOL_PLUGIN_SUFFIX_LEN      sizeof(LIBTOOL_PLUGIN_SUFFIX)
 
 #define LIBTOOL_PLUGIN_SUFFIX          ".la"
 #define LIBTOOL_PLUGIN_SUFFIX_LEN      sizeof(LIBTOOL_PLUGIN_SUFFIX)
 
-#define PLUGIN_SUFFIX_LEN      max_t(size_t, sizeof(NATIVE_PLUGIN_SUFFIX), \
+#define PLUGIN_SUFFIX_LEN      bt_max_t(size_t, sizeof(NATIVE_PLUGIN_SUFFIX), \
                                        sizeof(LIBTOOL_PLUGIN_SUFFIX))
 
 BT_PLUGIN_MODULE();
                                        sizeof(LIBTOOL_PLUGIN_SUFFIX))
 
 BT_PLUGIN_MODULE();
index 094b87ad2d5e7c9aaf37fc1b0c36f7fd635dec1d..328cc1480e5cae988c6393c23ebf85d0811070f8 100644 (file)
@@ -27,6 +27,7 @@
 #include <glib.h>
 #include <gmodule.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
 #include <gmodule.h>
 #include <babeltrace2/types.h>
+#include "common/macros.h"
 
 struct bt_plugin;
 struct bt_component_class;
 
 struct bt_plugin;
 struct bt_component_class;
index 53b783ff50d8eb9b1fff7b6ae7e522df791ad40b..31641df369ec54ab151f18cb7b4210013d43450b 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "common/assert.h"
 #include "lib/assert-pre.h"
 
 #include "common/assert.h"
 #include "lib/assert-pre.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/compiler.h"
 #include "common/common.h"
 #include <babeltrace2/plugin/plugin-const.h>
 #include "compat/compiler.h"
 #include "common/common.h"
 #include <babeltrace2/plugin/plugin-const.h>
@@ -49,7 +49,7 @@
 
 #define PYTHON_PLUGIN_PROVIDER_FILENAME        "libbabeltrace2-python-plugin-provider." G_MODULE_SUFFIX
 #define PYTHON_PLUGIN_PROVIDER_SYM_NAME        bt_plugin_python_create_all_from_file
 
 #define PYTHON_PLUGIN_PROVIDER_FILENAME        "libbabeltrace2-python-plugin-provider." G_MODULE_SUFFIX
 #define PYTHON_PLUGIN_PROVIDER_SYM_NAME        bt_plugin_python_create_all_from_file
-#define PYTHON_PLUGIN_PROVIDER_SYM_NAME_STR    TOSTRING(PYTHON_PLUGIN_PROVIDER_SYM_NAME)
+#define PYTHON_PLUGIN_PROVIDER_SYM_NAME_STR    G_STRINGIFY(PYTHON_PLUGIN_PROVIDER_SYM_NAME)
 
 #define APPEND_ALL_FROM_DIR_NFDOPEN_MAX        8
 
 
 #define APPEND_ALL_FROM_DIR_NFDOPEN_MAX        8
 
index cdd20d695a57f085cc9dd4bb71fc03a91d9310e7..d7f2d68fcbbc0d79685152f878a8e0bd8d915029 100644 (file)
@@ -24,7 +24,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/graph/component-class.h"
 #include <babeltrace2/plugin/plugin-const.h>
 #include <babeltrace2/plugin/plugin-dev.h>
 #include "lib/graph/component-class.h"
 #include <babeltrace2/plugin/plugin-const.h>
 #include <babeltrace2/plugin/plugin-dev.h>
index 29e9068891c76bbfed7d189369ec39dedb670706..952b3b861318a50c83150b775ad993282bb1ff6b 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <errno.h>
 #include <stdlib.h>
 #include "common/assert.h"
 #include <errno.h>
 #include <stdlib.h>
@@ -70,14 +70,14 @@ int heap_grow(struct ptr_heap *heap, size_t new_len)
 {
        void **new_ptrs;
 
 {
        void **new_ptrs;
 
-       if (likely(heap->alloc_len >= new_len))
+       if (G_LIKELY(heap->alloc_len >= new_len))
                return 0;
 
                return 0;
 
-       heap->alloc_len = max_t(size_t, new_len, heap->alloc_len << 1);
+       heap->alloc_len = bt_max_t(size_t, new_len, heap->alloc_len << 1);
        new_ptrs = calloc(heap->alloc_len, sizeof(void *));
        new_ptrs = calloc(heap->alloc_len, sizeof(void *));
-       if (unlikely(!new_ptrs))
+       if (G_UNLIKELY(!new_ptrs))
                return -ENOMEM;
                return -ENOMEM;
-       if (likely(heap->ptrs))
+       if (G_LIKELY(heap->ptrs))
                memcpy(new_ptrs, heap->ptrs, heap->len * sizeof(void *));
        free(heap->ptrs);
        heap->ptrs = new_ptrs;
                memcpy(new_ptrs, heap->ptrs, heap->len * sizeof(void *));
        free(heap->ptrs);
        heap->ptrs = new_ptrs;
@@ -90,7 +90,7 @@ int heap_set_len(struct ptr_heap *heap, size_t new_len)
        int ret;
 
        ret = heap_grow(heap, new_len);
        int ret;
 
        ret = heap_grow(heap, new_len);
-       if (unlikely(ret))
+       if (G_UNLIKELY(ret))
                return ret;
        heap->len = new_len;
        return 0;
                return ret;
        heap->len = new_len;
        return 0;
@@ -107,7 +107,7 @@ int bt_heap_init(struct ptr_heap *heap, size_t alloc_len,
         * Minimum size allocated is 1 entry to ensure memory allocation
         * never fails within bt_heap_replace_max.
         */
         * Minimum size allocated is 1 entry to ensure memory allocation
         * never fails within bt_heap_replace_max.
         */
-       return heap_grow(heap, max_t(size_t, 1, alloc_len));
+       return heap_grow(heap, bt_max_t(size_t, 1, alloc_len));
 }
 
 void bt_heap_free(struct ptr_heap *heap)
 }
 
 void bt_heap_free(struct ptr_heap *heap)
@@ -131,7 +131,7 @@ static void heapify(struct ptr_heap *heap, size_t i)
                        largest = i;
                if (r < heap->len && heap->gt(ptrs[r], ptrs[largest]))
                        largest = r;
                        largest = i;
                if (r < heap->len && heap->gt(ptrs[r], ptrs[largest]))
                        largest = r;
-               if (unlikely(largest == i))
+               if (G_UNLIKELY(largest == i))
                        break;
                tmp = ptrs[i];
                ptrs[i] = ptrs[largest];
                        break;
                tmp = ptrs[i];
                ptrs[i] = ptrs[largest];
@@ -145,7 +145,7 @@ void *bt_heap_replace_max(struct ptr_heap *heap, void *p)
 {
        void *res;
 
 {
        void *res;
 
-       if (unlikely(!heap->len)) {
+       if (G_UNLIKELY(!heap->len)) {
                (void) heap_set_len(heap, 1);
                heap->ptrs[0] = p;
                check_heap(heap);
                (void) heap_set_len(heap, 1);
                heap->ptrs[0] = p;
                check_heap(heap);
@@ -166,7 +166,7 @@ int bt_heap_insert(struct ptr_heap *heap, void *p)
        int ret;
 
        ret = heap_set_len(heap, heap->len + 1);
        int ret;
 
        ret = heap_set_len(heap, heap->len + 1);
-       if (unlikely(ret))
+       if (G_UNLIKELY(ret))
                return ret;
        ptrs = heap->ptrs;
        pos = heap->len - 1;
                return ret;
        ptrs = heap->ptrs;
        pos = heap->len - 1;
@@ -200,11 +200,11 @@ void *bt_heap_cherrypick(struct ptr_heap *heap, void *p)
        size_t pos, len = heap->len;
 
        for (pos = 0; pos < len; pos++)
        size_t pos, len = heap->len;
 
        for (pos = 0; pos < len; pos++)
-               if (unlikely(heap->ptrs[pos] == p))
+               if (G_UNLIKELY(heap->ptrs[pos] == p))
                        goto found;
        return NULL;
 found:
                        goto found;
        return NULL;
 found:
-       if (unlikely(heap->len == 1)) {
+       if (G_UNLIKELY(heap->len == 1)) {
                (void) heap_set_len(heap, 0);
                check_heap(heap);
                return heap->ptrs[0];
                (void) heap_set_len(heap, 0);
                check_heap(heap);
                return heap->ptrs[0];
index 8ea51bc148adbfb355cd99cd6dd9e4f558508a05..bbf1b3bfe0c13e01c1e76e0d3bdc77819fc89016 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 #include <unistd.h>
  */
 
 #include <unistd.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 struct ptr_heap {
        size_t len, alloc_len;
 
 struct ptr_heap {
        size_t len, alloc_len;
@@ -54,7 +54,7 @@ void check_heap(const struct ptr_heap *heap)
 static inline void *bt_heap_maximum(const struct ptr_heap *heap)
 {
        check_heap(heap);
 static inline void *bt_heap_maximum(const struct ptr_heap *heap)
 {
        check_heap(heap);
-       return likely(heap->len) ? heap->ptrs[0] : NULL;
+       return G_LIKELY(heap->len) ? heap->ptrs[0] : NULL;
 }
 
 /**
 }
 
 /**
index 7d20c1e55a718168d20e2cc4acd7a63878617e4b..4391f276ffd39943e6d7c9349b7af1339a781c71 100644 (file)
@@ -24,7 +24,7 @@
 #define BT_LOG_TAG "ATTRS"
 #include "lib/lib-logging.h"
 
 #define BT_LOG_TAG "ATTRS"
 #include "lib/lib-logging.h"
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 #include "lib/assert-pre.h"
 #include "lib/object.h"
 #include <babeltrace2/value.h>
 #include "lib/assert-pre.h"
 #include "lib/object.h"
index e493815c67268f06b5233bdf95ae540c14073cab..60b46d428f9c77b30a92f2d628197fdcc77328a9 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 
 #include <stdint.h>
 #endif
 
 #include <stdint.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 
 BT_HIDDEN
 #include <babeltrace2/value.h>
 
 BT_HIDDEN
index e6e57e9047c9485579be748eb8959aa8697e88bf..4cbf77eaf1533da3d20abbd219b9872d0e4bad1e 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <babeltrace2/trace-ir/clock-class.h>
 #include "lib/object.h"
 
 #include <babeltrace2/trace-ir/clock-class.h>
 #include "lib/object.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include "lib/object-pool.h"
 #include "compat/uuid.h"
 #include "common/common.h"
 #include "lib/object-pool.h"
 #include "compat/uuid.h"
index 04ef345ef7cf5e771ddb70e6c29c7b92dddb877f..e2e984113095fade277eaa81153c5ae21ee1101a 100644 (file)
@@ -82,7 +82,7 @@ struct bt_clock_snapshot *bt_clock_snapshot_create(
                goto error;
        }
 
                goto error;
        }
 
-       if (likely(!clock_snapshot->clock_class)) {
+       if (G_LIKELY(!clock_snapshot->clock_class)) {
                clock_snapshot->clock_class = clock_class;
                bt_object_get_no_null_check(clock_class);
        }
                clock_snapshot->clock_class = clock_class;
                bt_object_get_no_null_check(clock_class);
        }
index 5375f3ab333fec53af7d904d08c268f8511ee8b2..20831baf2088733106bdfcf1927be17693663067 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object.h"
 #include <stdbool.h>
 #include <stdint.h>
 #include "lib/object.h"
 #include <stdbool.h>
 #include <stdint.h>
index b368a286ae6e7ccba332d28d103abd98d4fd1018..66d536706072a7171f014d9431d224f4c7842d69 100644 (file)
@@ -27,7 +27,7 @@
 #include "lib/assert-pre.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field.h>
 #include "lib/assert-pre.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/stream.h>
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/stream.h>
index 308c451e65b550b4305ce72d5a34ff38c1224925..8cd6419cf27380eff845f06cb0a4f29e0d455c75 100644 (file)
@@ -30,7 +30,7 @@
 #endif
 
 #include "lib/assert-pre.h"
 #endif
 
 #include "lib/assert-pre.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/stream.h>
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/stream.h>
@@ -80,7 +80,7 @@ void _bt_event_set_is_frozen(const struct bt_event *event, bool is_frozen);
 # define bt_event_set_is_frozen(_event, _is_frozen)
 #endif
 
 # define bt_event_set_is_frozen(_event, _is_frozen)
 #endif
 
-BT_UNUSED
+__attribute__((unused))
 static inline
 void _bt_event_reset_dev_mode(struct bt_event *event)
 {
 static inline
 void _bt_event_reset_dev_mode(struct bt_event *event)
 {
@@ -186,13 +186,13 @@ struct bt_event *bt_event_create(struct bt_event_class *event_class,
 
        BT_ASSERT(event_class);
        event = bt_object_pool_create_object(&event_class->event_pool);
 
        BT_ASSERT(event_class);
        event = bt_object_pool_create_object(&event_class->event_pool);
-       if (unlikely(!event)) {
+       if (G_UNLIKELY(!event)) {
                BT_LIB_LOGE("Cannot allocate one event from event class's event pool: "
                        "%![ec-]+E", event_class);
                goto end;
        }
 
                BT_LIB_LOGE("Cannot allocate one event from event class's event pool: "
                        "%![ec-]+E", event_class);
                goto end;
        }
 
-       if (likely(!event->class)) {
+       if (G_LIKELY(!event->class)) {
                event->class = event_class;
                bt_object_get_no_null_check(&event_class->base);
        }
                event->class = event_class;
                bt_object_get_no_null_check(&event_class->base);
        }
index b5692dae3cc0d25eadfbbbf8e7a2e6b7ee7efa9b..6947c937513eadb37a217896eac22b6d54fb1999 100644 (file)
@@ -27,7 +27,7 @@
 #include "lib/assert-pre.h"
 #include <babeltrace2/trace-ir/clock-class.h>
 #include <babeltrace2/trace-ir/field-class.h>
 #include "lib/assert-pre.h"
 #include <babeltrace2/trace-ir/clock-class.h>
 #include <babeltrace2/trace-ir/field-class.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/object.h"
 #include <babeltrace2/types.h>
 #include <stdint.h>
 #include "lib/object.h"
 #include <babeltrace2/types.h>
 #include <stdint.h>
index 506c0063d7fe43c8b579bfb9d8b5c440f564f9e4..9241d077793775012edbda157909b165e69d1bea 100644 (file)
@@ -29,6 +29,7 @@
 #include "lib/object.h"
 #include <babeltrace2/trace-ir/field-path-const.h>
 #include "common/assert.h"
 #include "lib/object.h"
 #include <babeltrace2/trace-ir/field-path-const.h>
 #include "common/assert.h"
+#include "common/macros.h"
 #include <glib.h>
 
 struct bt_field_path_item {
 #include <glib.h>
 
 struct bt_field_path_item {
index 97728e0d26bb2b95c468d21d945db6d584759c8e..db4ae79a9670cf2f743fa05e6973916da4aa978b 100644 (file)
@@ -23,6 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include "common/macros.h"
 #include "lib/object-pool.h"
 #include "lib/object.h"
 
 #include "lib/object-pool.h"
 #include "lib/object.h"
 
index 4f75c3441dc161cf0f77cf6c051acd6fcc17d4d8..31d9803e77e1f1517bd6d366b3a28180282ccfd9 100644 (file)
@@ -666,7 +666,7 @@ enum bt_field_status bt_field_string_append_with_length(struct bt_field *field,
 
        new_length = length + string_field->length;
 
 
        new_length = length + string_field->length;
 
-       if (unlikely(new_length + 1 > string_field->buf->len)) {
+       if (G_UNLIKELY(new_length + 1 > string_field->buf->len)) {
                g_array_set_size(string_field->buf, new_length + 1);
        }
 
                g_array_set_size(string_field->buf, new_length + 1);
        }
 
@@ -708,7 +708,7 @@ enum bt_field_status bt_field_dynamic_array_set_length(struct bt_field *field,
                BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, "Field");
        BT_ASSERT_PRE_FIELD_HOT(field, "Field");
 
                BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, "Field");
        BT_ASSERT_PRE_FIELD_HOT(field, "Field");
 
-       if (unlikely(length > array_field->fields->len)) {
+       if (G_UNLIKELY(length > array_field->fields->len)) {
                /* Make more room */
                struct bt_field_class_array *array_fc;
                uint64_t cur_len = array_field->fields->len;
                /* Make more room */
                struct bt_field_class_array *array_fc;
                uint64_t cur_len = array_field->fields->len;
index 3cd4bfe5699f745c12f2122bfad6b6c72e768fc2..96df03e749087db6209fb648ffaa1ffe169b0c38 100644 (file)
@@ -27,7 +27,7 @@
 #include "lib/assert-pre.h"
 #include "common/common.h"
 #include "lib/object.h"
 #include "lib/assert-pre.h"
 #include "common/common.h"
 #include "lib/object.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/types.h>
 #include <stdint.h>
 #include <string.h>
 #include <babeltrace2/types.h>
 #include <stdint.h>
 #include <string.h>
index 585ed48b15ccafc3d1eb0281b4f1b44e95006044..ade0a3f2f4fc18bd5a919e5ef9c0b8a1fcd37da5 100644 (file)
@@ -220,13 +220,13 @@ struct bt_packet *bt_packet_create(const struct bt_stream *c_stream)
 
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        packet = bt_object_pool_create_object(&stream->packet_pool);
 
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        packet = bt_object_pool_create_object(&stream->packet_pool);
-       if (unlikely(!packet)) {
+       if (G_UNLIKELY(!packet)) {
                BT_LIB_LOGE("Cannot allocate one packet from stream's packet pool: "
                        "%![stream-]+s", stream);
                goto end;
        }
 
                BT_LIB_LOGE("Cannot allocate one packet from stream's packet pool: "
                        "%![stream-]+s", stream);
                goto end;
        }
 
-       if (likely(!packet->stream)) {
+       if (G_LIKELY(!packet->stream)) {
                packet->stream = stream;
                bt_object_get_no_null_check_no_parent_check(
                        &packet->stream->base);
                packet->stream = stream;
                bt_object_get_no_null_check_no_parent_check(
                        &packet->stream->base);
index 7b19760c97fa52520e7a7e91bd4192ff8662a532..e2d825c6ed2b85137c42f038c548d80c18de1667 100644 (file)
@@ -30,7 +30,7 @@
 #include <babeltrace2/trace-ir/field.h>
 #include <babeltrace2/trace-ir/stream.h>
 #include "lib/object.h"
 #include <babeltrace2/trace-ir/field.h>
 #include <babeltrace2/trace-ir/stream.h>
 #include "lib/object.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "lib/property.h"
 
 #include "field-wrapper.h"
 #include "lib/property.h"
 
 #include "field-wrapper.h"
index 48f14acf5a6afd4c663e405e27dbf100ff75c3c3..92e277b89fcd8fd4361e9054e21953362d1af2bc 100644 (file)
@@ -26,6 +26,7 @@
  * http://www.efficios.com/ctf
  */
 
  * http://www.efficios.com/ctf
  */
 
+#include "common/macros.h"
 #include "lib/object.h"
 #include <babeltrace2/trace-ir/field-class-const.h>
 #include <babeltrace2/trace-ir/field-path-const.h>
 #include "lib/object.h"
 #include <babeltrace2/trace-ir/field-class-const.h>
 #include <babeltrace2/trace-ir/field-path-const.h>
index 1efa77078c1800573a6989eec37c4554e146af63..7610b9029a0b1bfd422368705b5d2afea53d1d65 100644 (file)
@@ -29,7 +29,7 @@
 #include <babeltrace2/trace-ir/stream-class.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
 #include <babeltrace2/trace-ir/stream-class.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <glib.h>
 #include <inttypes.h>
 
 #include <glib.h>
 #include <inttypes.h>
 
index 96985a93ffcc630bcbaeb7e062dad2dc58f97238..cd320ca16dc62ba282cf6b22023f33fd4a85a427 100644 (file)
@@ -27,7 +27,7 @@
 #include <babeltrace2/trace-ir/stream.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
 #include <babeltrace2/trace-ir/stream.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <glib.h>
 
 #include "utils.h"
 #include <glib.h>
 
 #include "utils.h"
index 7c8add5c7f9e9853a44d768a44401946da82ce39..09f1e7d497755347f32a3ce68e56b0e11c095043 100644 (file)
@@ -30,7 +30,7 @@
 #include <babeltrace2/trace-ir/field.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
 #include <babeltrace2/trace-ir/field.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
 #include <babeltrace2/value.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
index 3a12fd78e759ee4ce05b2f289ee930d5e812eadc..f10cdba9e50176ebe94f6fdc4e7088d25c7b954f 100644 (file)
@@ -30,7 +30,7 @@
 #include <babeltrace2/trace-ir/field.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
 #include <babeltrace2/trace-ir/field.h>
 #include "lib/object.h"
 #include "lib/object-pool.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
 #include <babeltrace2/value.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
index d68bd54b8540f6e8482b8ac9d86da71a8163ec1d..a50fe55f624527c8ebb907320b87f49322974c88 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <stdint.h>
 
 #include <babeltrace2/trace-ir/field-class.h>
 #include <stdint.h>
 
index aa7418814ecbf945d7437acab287ebec0a0c6fb9..4230f44ce76d30cf4a1058ead7726dea9b6573d1 100644 (file)
@@ -28,6 +28,7 @@
 #include <babeltrace2/value-const.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
 #include <babeltrace2/value-const.h>
 #include <babeltrace2/types.h>
 #include <glib.h>
+#include "common/macros.h"
 
 struct bt_value {
        struct bt_object base;
 
 struct bt_value {
        struct bt_object base;
index d8c80402c56374d671f428c39dd4921edf671115..f1e0b7153cd97b8ba9c10a21067ba9d98e17a7fe 100644 (file)
@@ -4,7 +4,7 @@
  * See LICENSE.
  */
 
  * See LICENSE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include <pthread.h>
 #include "common/assert.h"
 #include "common/common.h"
 #include <pthread.h>
 #include "common/assert.h"
index 44f778a065cedb4c3f2d32898f5ef00c6cdf44fd..42ae118b58c0a64bd354bcb43937eb263ad86c2b 100644 (file)
@@ -9,10 +9,12 @@
 #ifndef BABELTRACE_LOGGING_INTERNAL_H
 #define BABELTRACE_LOGGING_INTERNAL_H
 
 #ifndef BABELTRACE_LOGGING_INTERNAL_H
 #define BABELTRACE_LOGGING_INTERNAL_H
 
+#include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <babeltrace2/logging.h>
 #include <babeltrace2/logging.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 /* To detect incompatible changes you can define BT_LOG_VERSION_REQUIRED to be
  * the current value of BT_LOG_VERSION before including this file (or via
 
 /* To detect incompatible changes you can define BT_LOG_VERSION_REQUIRED to be
  * the current value of BT_LOG_VERSION before including this file (or via
index 9cc5aadc4727d7f087dca6ffff690243bd34f7ee..7d31d2a1414a3324feabbb049092cbd204fc4813 100644 (file)
@@ -30,7 +30,7 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <babeltrace2/babeltrace.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "../metadata/ctf-meta.h"
 
 
 #include "../metadata/ctf-meta.h"
 
index 6f6fbe7b9f8c2520d2fb01374300030629a6c8e7..d98ff09e125fc2af4a59646bea0cebe3a4569db7 100644 (file)
@@ -22,7 +22,7 @@
 #include <glib.h>
 #include "common/list.h"
 #include <babeltrace2/babeltrace.h>
 #include <glib.h>
 #include "common/list.h"
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "decoder.h"
 #include "ctf-meta.h"
 
 #include "decoder.h"
 #include "ctf-meta.h"
index 130ae61b86a86f75877e253ece23e7be02385fab..478166de0176a9ec17365a7ff210944402d16dbf 100644 (file)
@@ -17,7 +17,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include "common/common.h"
 #include <glib.h>
 #include "common/assert.h"
 #include "common/common.h"
 #include <glib.h>
index 287cc2593d575d615ed87a5413d1436989c56987..6cff9921a0e39dd3d66361e9075732499d4c3019 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index f114d80bb882fe03f72e4f95860a229538477d4f..41ca6b0301e68027f08a062e43c2d57e1bd10f02 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index e6342942151a4a9898a0bb10c1ed9f3203694f07..1279d1469e73109c6829948191fecd37c9fb16f2 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include "compat/glib.h"
 #include <glib.h>
 #include "common/assert.h"
 #include "compat/glib.h"
 #include <glib.h>
index bd801979fbcee6b145a3c873074b7232ab37a2e9..9aaeba83f079e38f5fb80435d9aee6bea7104702 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index d5dd9d9344e9542062bf6d43a8669f4e658dfd3a..7c28ee23319df6b51847ac9f5e72c52c51fba9b7 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index 8201954d2bc9f084c4308651d31ae0921e5893d2..843069b89db1c242323c36a4ee3564645c9bbb20 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index 81f763822d4ada88a29a78ab54f87b0f35f8fbe4..81aa99098e8c43b7b8491fb7dd48098c70b2e386 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index bb1aac0cd771aa74fa32ab931a9b5b030a0b82dd..99a73208a6a788fd0a4519478a4843ee743195ee 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index 9eb3cf38893f7f0f8a7232c79745f496182a925e..cfcb043e2327e63c4b544d8bd8379ef540f4831d 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include <babeltrace2/babeltrace.h>
  */
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "ctf-meta.h"
 
 
 #include "ctf-meta.h"
 
index 73b6fe92c249c9b0705199a178b90c5556e3cc05..87245a9edab23622cfbd752b8339757af6a139b0 100644 (file)
@@ -16,7 +16,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
 #include "common/assert.h"
 #include <glib.h>
 #include <stdint.h>
index b0f179be71857072c913c5ef7030918bb4db65c7..a231034fa72a67d8f405ba467de40a7cf85d59a2 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <babeltrace2/babeltrace.h>
 
 
 #include <babeltrace2/babeltrace.h>
 
+#include "common/macros.h"
+
 /* A CTF metadata decoder object */
 struct ctf_metadata_decoder;
 
 /* A CTF metadata decoder object */
 struct ctf_metadata_decoder;
 
index 15b6d26a66f3d76b6e5d5867f7681c349746aaff..1cb069d51c4c63a3fbef5fdf83d35a433503b06b 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <stdlib.h>
 #include "common/list.h"
 
 #include <stdlib.h>
 #include "common/list.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/align.h"
 
 #define OBJSTACK_ALIGN                 8       /* Object stack alignment */
 #include "common/align.h"
 
 #define OBJSTACK_ALIGN                 8       /* Object stack alignment */
index c026eb54664d4b50f1da74d4ffbb8695070a6f5c..32f7ff4bbd9fbf81952fc9dc0e1c07024d4772b4 100644 (file)
@@ -27,6 +27,8 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include "common/macros.h"
+
 struct objstack;
 
 BT_HIDDEN
 struct objstack;
 
 BT_HIDDEN
index 34d6c462d587b994d26cc6645c011058d23f97b3..801f2b167cd7283e80707fbf09c3fe4733779f4e 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
+#include "common/macros.h"
 #include "ast.h"
 
 #ifndef YY_TYPEDEF_YY_SCANNER_T
 #include "ast.h"
 
 #ifndef YY_TYPEDEF_YY_SCANNER_T
index 64098a9a43ec15d5e1838b7535133163e2387d28..c1389ba7b2f949a2f6e563f3453992359f318c6b 100644 (file)
@@ -35,7 +35,7 @@
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/list.h"
 #include "scanner.h"
 #include "parser.h"
 #include "common/list.h"
 #include "scanner.h"
 #include "parser.h"
index 2a1c4713b7dda728b0034c18f68894d7c828784b..377a4c5d2d80c8daae135f6fb8b24521b0a818f4 100644 (file)
@@ -535,7 +535,7 @@ enum bt_msg_iter_status buf_ensure_available_bits(
 {
        enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
 
 {
        enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
 
-       if (unlikely(buf_available_bits(notit) == 0)) {
+       if (G_UNLIKELY(buf_available_bits(notit) == 0)) {
                /*
                 * This _cannot_ return BT_MSG_ITER_STATUS_OK
                 * _and_ no bits.
                /*
                 * This _cannot_ return BT_MSG_ITER_STATUS_OK
                 * _and_ no bits.
@@ -1043,14 +1043,14 @@ enum bt_msg_iter_status read_event_header_begin_state(struct bt_msg_iter *notit)
 
        /* Check if we have some content left */
        if (notit->cur_exp_packet_content_size >= 0) {
 
        /* Check if we have some content left */
        if (notit->cur_exp_packet_content_size >= 0) {
-               if (unlikely(packet_at(notit) ==
+               if (G_UNLIKELY(packet_at(notit) ==
                                notit->cur_exp_packet_content_size)) {
                        /* No more events! */
                        BT_LOGV("Reached end of packet: notit-addr=%p, "
                                "cur=%zu", notit, packet_at(notit));
                        notit->state = STATE_EMIT_MSG_PACKET_END_MULTI;
                        goto end;
                                notit->cur_exp_packet_content_size)) {
                        /* No more events! */
                        BT_LOGV("Reached end of packet: notit-addr=%p, "
                                "cur=%zu", notit, packet_at(notit));
                        notit->state = STATE_EMIT_MSG_PACKET_END_MULTI;
                        goto end;
-               } else if (unlikely(packet_at(notit) >
+               } else if (G_UNLIKELY(packet_at(notit) >
                                notit->cur_exp_packet_content_size)) {
                        /* That's not supposed to happen */
                        BT_LOGV("Before decoding event header field: cursor is passed the packet's content: "
                                notit->cur_exp_packet_content_size)) {
                        /* That's not supposed to happen */
                        BT_LOGV("Before decoding event header field: cursor is passed the packet's content: "
@@ -1898,7 +1898,7 @@ enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
                "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
 
                "fc-type=%d, fc-in-ir=%d, value=%" PRIu64,
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
 
-       if (likely(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE)) {
+       if (G_LIKELY(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE)) {
                goto update_def_clock;
        }
 
                goto update_def_clock;
        }
 
@@ -1944,16 +1944,16 @@ enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
        }
 
 update_def_clock:
        }
 
 update_def_clock:
-       if (unlikely(int_fc->mapped_clock_class)) {
+       if (G_UNLIKELY(int_fc->mapped_clock_class)) {
                update_default_clock(notit, value, int_fc->base.size);
        }
 
                update_default_clock(notit, value, int_fc->base.size);
        }
 
-       if (unlikely(int_fc->storing_index >= 0)) {
+       if (G_UNLIKELY(int_fc->storing_index >= 0)) {
                g_array_index(notit->stored_values, uint64_t,
                        (uint64_t) int_fc->storing_index) = value;
        }
 
                g_array_index(notit->stored_values, uint64_t,
                        (uint64_t) int_fc->storing_index) = value;
        }
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -1990,7 +1990,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
        BT_ASSERT(!int_fc->mapped_clock_class);
        BT_ASSERT(int_fc->storing_index < 0);
 
        BT_ASSERT(!int_fc->mapped_clock_class);
        BT_ASSERT(int_fc->storing_index < 0);
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -2037,12 +2037,12 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
        BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
 
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
        BT_ASSERT(int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE);
 
-       if (unlikely(int_fc->storing_index >= 0)) {
+       if (G_UNLIKELY(int_fc->storing_index >= 0)) {
                g_array_index(notit->stored_values, uint64_t,
                        (uint64_t) int_fc->storing_index) = (uint64_t) value;
        }
 
                g_array_index(notit->stored_values, uint64_t,
                        (uint64_t) int_fc->storing_index) = (uint64_t) value;
        }
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -2073,7 +2073,7 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value,
                "fc-type=%d, fc-in-ir=%d, value=%f",
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
 
                "fc-type=%d, fc-in-ir=%d, value=%f",
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -2102,7 +2102,7 @@ enum bt_bfcr_status bfcr_string_begin_cb(
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -2140,7 +2140,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value,
                notit, notit->bfcr, fc, fc->type, fc->in_ir,
                len);
 
                notit, notit->bfcr, fc, fc->type, fc->in_ir,
                len);
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -2172,7 +2172,7 @@ enum bt_bfcr_status bfcr_string_end_cb(
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
-       if (unlikely(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -2788,10 +2788,10 @@ enum bt_msg_iter_status bt_msg_iter_get_next_message(
 
        while (true) {
                status = handle_state(notit);
 
        while (true) {
                status = handle_state(notit);
-               if (unlikely(status == BT_MSG_ITER_STATUS_AGAIN)) {
+               if (G_UNLIKELY(status == BT_MSG_ITER_STATUS_AGAIN)) {
                        BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
                        goto end;
                        BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
                        goto end;
-               } else if (unlikely(status != BT_MSG_ITER_STATUS_OK)) {
+               } else if (G_UNLIKELY(status != BT_MSG_ITER_STATUS_OK)) {
                        BT_LOGW("Cannot handle state: notit-addr=%p, state=%s",
                                notit, state_string(notit->state));
                        goto end;
                        BT_LOGW("Cannot handle state: notit-addr=%p, state=%s",
                                notit, state_string(notit->state));
                        goto end;
@@ -2906,10 +2906,10 @@ enum bt_msg_iter_status read_packet_header_context_fields(
 
        while (true) {
                status = handle_state(notit);
 
        while (true) {
                status = handle_state(notit);
-               if (unlikely(status == BT_MSG_ITER_STATUS_AGAIN)) {
+               if (G_UNLIKELY(status == BT_MSG_ITER_STATUS_AGAIN)) {
                        BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
                        goto end;
                        BT_LOGV_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
                        goto end;
-               } else if (unlikely(status != BT_MSG_ITER_STATUS_OK)) {
+               } else if (G_UNLIKELY(status != BT_MSG_ITER_STATUS_OK)) {
                        BT_LOGW("Cannot handle state: notit-addr=%p, state=%s",
                                notit, state_string(notit->state));
                        goto end;
                        BT_LOGW("Cannot handle state: notit-addr=%p, state=%s",
                                notit, state_string(notit->state));
                        goto end;
index 65dd0ee163ffdac95e6a77ff4358d629be015da9..77849db691ab01ff40d8b98e282060c463c7c8d5 100644 (file)
@@ -30,7 +30,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <babeltrace2/babeltrace.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #include "../metadata/ctf-meta.h"
 
 
 #include "../metadata/ctf-meta.h"
 
index 8825a9a7ae377ffd56cef2d490260ea095d22f6a..7d98ea50581628cc0ae0ebf0ca53dfd029255f9d 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #define PERR(fmt, ...)                                                 \
        do {                                                            \
 
 #define PERR(fmt, ...)                                                 \
        do {                                                            \
index 28f056caf5a0d650a15a3a4b8991ecc8345d2ae6..05e0a8dc537caae837e2aadd88c85ff075421991 100644 (file)
@@ -26,6 +26,6 @@
  */
 
 #include <babeltrace2/babeltrace.h>
  */
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #endif /* CTF_UTILS_H */
 
 #endif /* CTF_UTILS_H */
index 026251a6ba750cafba10f27588e58b15c608d07f..d79e80e0eb119e032f9fc8811983e84d5d4b0907 100644 (file)
@@ -251,7 +251,7 @@ int write_array_field_elements(struct fs_sink_stream *stream,
                        bt_field_array_borrow_element_field_by_index_const(
                                field, i);
                ret = write_field(stream, fc->elem_fc, elem_field);
                        bt_field_array_borrow_element_field_by_index_const(
                                field, i);
                ret = write_field(stream, fc->elem_fc, elem_field);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -270,7 +270,7 @@ int write_sequence_field(struct fs_sink_stream *stream,
        if (fc->length_is_before) {
                ret = bt_ctfser_write_unsigned_int(&stream->ctfser,
                        bt_field_array_get_length(field), 8, 32, BYTE_ORDER);
        if (fc->length_is_before) {
                ret = bt_ctfser_write_unsigned_int(&stream->ctfser,
                        bt_field_array_get_length(field), 8, 32, BYTE_ORDER);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -289,10 +289,10 @@ int write_struct_field(struct fs_sink_stream *stream,
        int ret = 0;
        uint64_t i;
 
        int ret = 0;
        uint64_t i;
 
-       if (likely(align_struct)) {
+       if (G_LIKELY(align_struct)) {
                ret = bt_ctfser_align_offset_in_current_packet(&stream->ctfser,
                        fc->base.alignment);
                ret = bt_ctfser_align_offset_in_current_packet(&stream->ctfser,
                        fc->base.alignment);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -306,7 +306,7 @@ int write_struct_field(struct fs_sink_stream *stream,
                                fc, i)->fc;
 
                ret = write_field(stream, member_fc, memb_field);
                                fc, i)->fc;
 
                ret = write_field(stream, member_fc, memb_field);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -327,7 +327,7 @@ int write_variant_field(struct fs_sink_stream *stream,
        if (fc->tag_is_before) {
                ret = bt_ctfser_write_unsigned_int(&stream->ctfser,
                        opt_index, 8, 16, BYTE_ORDER);
        if (fc->tag_is_before) {
                ret = bt_ctfser_write_unsigned_int(&stream->ctfser,
                        opt_index, 8, 16, BYTE_ORDER);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -385,7 +385,7 @@ int write_event_header(struct fs_sink_stream *stream,
        /* Event class ID */
        ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
                bt_event_class_get_id(ec->ir_ec), 8, 64, BYTE_ORDER);
        /* Event class ID */
        ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
                bt_event_class_get_id(ec->ir_ec), 8, 64, BYTE_ORDER);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -394,7 +394,7 @@ int write_event_header(struct fs_sink_stream *stream,
                BT_ASSERT(cs);
                ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
                        bt_clock_snapshot_get_value(cs), 8, 64, BYTE_ORDER);
                BT_ASSERT(cs);
                ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
                        bt_clock_snapshot_get_value(cs), 8, 64, BYTE_ORDER);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -413,7 +413,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
 
        /* Header */
        ret = write_event_header(stream, cs, ec);
 
        /* Header */
        ret = write_event_header(stream, cs, ec);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto end;
        }
 
                goto end;
        }
 
@@ -424,7 +424,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
                ret = write_struct_field(stream,
                        (void *) stream->sc->event_common_context_fc,
                        field, true);
                ret = write_struct_field(stream,
                        (void *) stream->sc->event_common_context_fc,
                        field, true);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -435,7 +435,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
                BT_ASSERT(field);
                ret = write_struct_field(stream, (void *) ec->spec_context_fc,
                        field, true);
                BT_ASSERT(field);
                ret = write_struct_field(stream, (void *) ec->spec_context_fc,
                        field, true);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
@@ -446,7 +446,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
                BT_ASSERT(field);
                ret = write_struct_field(stream, (void *) ec->payload_fc,
                        field, true);
                BT_ASSERT(field);
                ret = write_struct_field(stream, (void *) ec->payload_fc,
                        field, true);
-               if (unlikely(ret)) {
+               if (G_UNLIKELY(ret)) {
                        goto end;
                }
        }
                        goto end;
                }
        }
index c3efc9a0e15f77ca0ba0c4a2344ae736d83f8ff2..adefbb20db3769f253b49a87dea93799a6c8d1b5 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 #include "ctfser/ctfser.h"
 #include <glib.h>
 #include <babeltrace2/babeltrace.h>
 #include "ctfser/ctfser.h"
 #include <glib.h>
index 9a8ac525ceb34738735e2cc100b2cb928d9aa4ac..f60cad93aef5743a76da46fc63a6defb44292157 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 #include "ctfser/ctfser.h"
 #include <glib.h>
 #include <babeltrace2/babeltrace.h>
 #include "ctfser/ctfser.h"
 #include <glib.h>
index 42d822e19b6c6a08aa025d9fbb9a75103b9917e7..7ecc7875296844e70b0e2a0d97adfde150138d1e 100644 (file)
@@ -233,7 +233,7 @@ struct fs_sink_stream *borrow_stream(struct fs_sink_comp *fs_sink,
        struct fs_sink_stream *stream = NULL;
 
        trace = g_hash_table_lookup(fs_sink->traces, ir_trace);
        struct fs_sink_stream *stream = NULL;
 
        trace = g_hash_table_lookup(fs_sink->traces, ir_trace);
-       if (unlikely(!trace)) {
+       if (G_UNLIKELY(!trace)) {
                if (fs_sink->assume_single_trace &&
                                g_hash_table_size(fs_sink->traces) > 0) {
                        BT_LOGE("Single trace mode, but getting more than one trace: "
                if (fs_sink->assume_single_trace &&
                                g_hash_table_size(fs_sink->traces) > 0) {
                        BT_LOGE("Single trace mode, but getting more than one trace: "
@@ -249,7 +249,7 @@ struct fs_sink_stream *borrow_stream(struct fs_sink_comp *fs_sink,
        }
 
        stream = g_hash_table_lookup(trace->streams, ir_stream);
        }
 
        stream = g_hash_table_lookup(trace->streams, ir_stream);
-       if (unlikely(!stream)) {
+       if (G_UNLIKELY(!stream)) {
                stream = fs_sink_stream_create(trace, ir_stream);
                if (!stream) {
                        goto end;
                stream = fs_sink_stream_create(trace, ir_stream);
                if (!stream) {
                        goto end;
@@ -273,7 +273,7 @@ bt_self_component_status handle_event_msg(struct fs_sink_comp *fs_sink,
        const bt_clock_snapshot *cs = NULL;
 
        stream = borrow_stream(fs_sink, ir_stream);
        const bt_clock_snapshot *cs = NULL;
 
        stream = borrow_stream(fs_sink, ir_stream);
-       if (unlikely(!stream)) {
+       if (G_UNLIKELY(!stream)) {
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
@@ -293,7 +293,7 @@ bt_self_component_status handle_event_msg(struct fs_sink_comp *fs_sink,
        }
 
        ret = fs_sink_stream_write_event(stream, cs, ir_event, ec);
        }
 
        ret = fs_sink_stream_write_event(stream, cs, ir_event, ec);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
@@ -315,7 +315,7 @@ bt_self_component_status handle_packet_beginning_msg(
        const bt_clock_snapshot *cs = NULL;
 
        stream = borrow_stream(fs_sink, ir_stream);
        const bt_clock_snapshot *cs = NULL;
 
        stream = borrow_stream(fs_sink, ir_stream);
-       if (unlikely(!stream)) {
+       if (G_UNLIKELY(!stream)) {
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
@@ -502,7 +502,7 @@ bt_self_component_status handle_packet_end_msg(
        const bt_clock_snapshot *cs = NULL;
 
        stream = borrow_stream(fs_sink, ir_stream);
        const bt_clock_snapshot *cs = NULL;
 
        stream = borrow_stream(fs_sink, ir_stream);
-       if (unlikely(!stream)) {
+       if (G_UNLIKELY(!stream)) {
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
                status = BT_SELF_COMPONENT_STATUS_ERROR;
                goto end;
        }
index 7a740bc2a40e8ac91548b9b852b9a690bdd83c05..d4255aefb9076094b1df78fd9280f552c856cf27 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 #include <stdbool.h>
 #include <glib.h>
 #include <babeltrace2/babeltrace.h>
 #include <stdbool.h>
 #include <glib.h>
index 3b6d2bc9ef8c56f06536afac4ec263e1306561a6..c81b70f6e8c7db178475566317e98aed0a864cec 100644 (file)
@@ -24,7 +24,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <stdio.h>
 #include <stdbool.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <string.h>
index 4ed02625a071227501e8bec66ee73d98fddf93de..8490629dea17f3b9fd6ae257b252ee4e79a35466 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <glib.h>
 
 
 #include <glib.h>
 
+#include "common/macros.h"
 #include "fs-sink-ctf-meta.h"
 
 BT_HIDDEN
 #include "fs-sink-ctf-meta.h"
 
 BT_HIDDEN
index 64f4d5eab5759faf7ffc05729d16dc6fe1f6e196..102432277296abe278a993ac6d9a9d8982c5a0ef 100644 (file)
@@ -24,7 +24,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include "common/assert.h"
 #include <stdio.h>
 #include "common/common.h"
 #include "common/assert.h"
 #include <stdio.h>
@@ -1095,7 +1095,7 @@ int try_translate_event_class_trace_ir_to_ctf_ir(
 
        /* Check in hash table first */
        *out_ec = g_hash_table_lookup(sc->event_classes_from_ir, ir_ec);
 
        /* Check in hash table first */
        *out_ec = g_hash_table_lookup(sc->event_classes_from_ir, ir_ec);
-       if (likely(*out_ec)) {
+       if (G_LIKELY(*out_ec)) {
                goto end;
        }
 
                goto end;
        }
 
index 3a1a31e1e8b0c0a512a2591b079fc38714b4ec51..23a9e2b537b1a047862bedbf68d7a2cee8f22f2b 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "fs-sink-ctf-meta.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "fs-sink-ctf-meta.h"
index c826a656971a0831648e4d5292bf705158f8a014..d3ad00ffaca3d8e10f6f630d3a91ee7f5f207536 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <glib.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <glib.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "../common/msg-iter/msg-iter.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "../common/msg-iter/msg-iter.h"
index 509b1e4e1ebeb08109f59f0fe43d3c2683a5feb9..78209384d4648b9bd706a56baab42c0ef5b4aa5d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <stdio.h>
 #include <glib.h>
 
 #include <stdio.h>
 #include <glib.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "fs.h"
 
 BT_HIDDEN
 #include "fs.h"
 
 BT_HIDDEN
index 33e1f5685d701367bddbcd9d5fc54ece59acecf9..e034b41625f21855411bc20e58ec35e6b99a587e 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include <stdbool.h>
  */
 
 #include <stdbool.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 #include "data-stream-file.h"
 #include "metadata.h"
 #include <babeltrace2/babeltrace.h>
 #include "data-stream-file.h"
 #include "metadata.h"
index 414b875bb5247c4ad8e98d2d2334967b93435ebf..7af061826e034cbb2fbdc5d7c7d9b2ec8398e09f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <stdio.h>
 #include <glib.h>
 
 #include <stdio.h>
 #include <glib.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 #define CTF_FS_METADATA_FILENAME       "metadata"
 #include <babeltrace2/babeltrace.h>
 
 #define CTF_FS_METADATA_FILENAME       "metadata"
index 3fa28b86e8eceb5a1346d879d9cff0f9b8034637..b83a4353cd6e9bc1012fd0c35b77c9cff05ac175 100644 (file)
@@ -30,7 +30,7 @@
 #include "metadata.h"
 #include "../common/metadata/decoder.h"
 #include "common/common.h"
 #include "metadata.h"
 #include "../common/metadata/decoder.h"
 #include "common/common.h"
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 #include "fs.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "fs.h"
 
@@ -427,15 +427,15 @@ int populate_trace_info(const struct ctf_fs_trace *trace, bt_value *trace_info)
                }
 
                if (group_range.set) {
                }
 
                if (group_range.set) {
-                       trace_range.begin_ns = min(trace_range.begin_ns,
+                       trace_range.begin_ns = MIN(trace_range.begin_ns,
                                        group_range.begin_ns);
                                        group_range.begin_ns);
-                       trace_range.end_ns = max(trace_range.end_ns,
+                       trace_range.end_ns = MAX(trace_range.end_ns,
                                        group_range.end_ns);
                        trace_range.set = true;
 
                                        group_range.end_ns);
                        trace_range.set = true;
 
-                       trace_intersection.begin_ns = max(trace_intersection.begin_ns,
+                       trace_intersection.begin_ns = MAX(trace_intersection.begin_ns,
                                        group_range.begin_ns);
                                        group_range.begin_ns);
-                       trace_intersection.end_ns = min(trace_intersection.end_ns,
+                       trace_intersection.end_ns = MIN(trace_intersection.end_ns,
                                        group_range.end_ns);
                        trace_intersection.set = true;
                }
                                        group_range.end_ns);
                        trace_intersection.set = true;
                }
index 4125e4a906be5c7c134e739decf8de05184de19b..35ee4b6cfd5834450c698044df8bd49994388ced 100644 (file)
@@ -25,7 +25,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 BT_HIDDEN
 #include <babeltrace2/babeltrace.h>
 
 BT_HIDDEN
index d9e273a88fa386ceab853d5dc9d2c775323cd040..94943e2aa79081487eed93c8211aed3818b06f14 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <stdio.h>
 #include <glib.h>
 
 #include <stdio.h>
 #include <glib.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "lttng-live.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "lttng-live.h"
index 5c8dc41b859dfd6675886398698bd2d56659184f..1ae7e0f3d77695e61e6d817461f6dceaa3589d32 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <stdbool.h>
 
 
 #include <stdbool.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "../common/metadata/decoder.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "../common/metadata/decoder.h"
index 2cf8ae1914d90b0be671a1a08bebbed8567fea3e..0731c33d93d5c9e8ae90e8c41bd67968465d6b19 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <stdio.h>
 #include <glib.h>
 
 #include <stdio.h>
 #include <glib.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 #include "lttng-live.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "lttng-live.h"
 
index 4a74ff9ff2a18b7d7946f60307086f8961df17b6..420f732b4b90be73987fce5d0ab8f314e998cbcb 100644 (file)
@@ -373,7 +373,7 @@ int list_update_session(bt_value *results,
                        }
                        val = bt_value_signed_integer_get(btval);
                        /* max */
                        }
                        val = bt_value_signed_integer_get(btval);
                        /* max */
-                       val = max_t(int64_t, clients, val);
+                       val = bt_max_t(int64_t, clients, val);
                        bt_value_signed_integer_set(btval, val);
                }
 
                        bt_value_signed_integer_set(btval, val);
                }
 
@@ -1050,9 +1050,9 @@ ssize_t lttng_live_get_one_metadata_packet(struct lttng_live_trace *trace,
                goto error;
        }
 
                goto error;
        }
 
-       data = zmalloc(len);
+       data = calloc(1, len);
        if (!data) {
        if (!data) {
-               BT_LOGE("relay data zmalloc: %s", strerror(errno));
+               BT_LOGE("relay data calloc: %s", strerror(errno));
                goto error;
        }
        ret_len = lttng_live_recv(viewer_connection, data, len);
                goto error;
        }
        ret_len = lttng_live_recv(viewer_connection, data, len);
index 09adc6cf497c8d8b7da6baa81011f815ea9f9102..761660f6557ff99c03d04263a7a18c8c83c8290d 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <glib.h>
 
 #include <stdio.h>
 #include <glib.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/socket.h"
 
 //TODO: this should not be used by plugins. Should copy code into plugin
 #include "compat/socket.h"
 
 //TODO: this should not be used by plugins. Should copy code into plugin
index bf4736909b61e50c1bf30610fd87d157929486e7..00a6e4e0182a1155fed08a48dad64d8db62f2dce 100644 (file)
@@ -31,7 +31,7 @@
 #include <stdbool.h>
 #include <gelf.h>
 #include <elfutils/libdw.h>
 #include <stdbool.h>
 #include <gelf.h>
 #include <elfutils/libdw.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "fd-cache/fd-cache.h"
 
 #define DEFAULT_DEBUG_DIR "/usr/lib/debug"
 #include "fd-cache/fd-cache.h"
 
 #define DEFAULT_DEBUG_DIR "/usr/lib/debug"
index 73438192d0731e250f3fba1c6ddf256d4d9a0396..5d3c07a1b7e0ac25cbf0719965e954d40ba99dcc 100644 (file)
@@ -37,7 +37,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <unistd.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 /**
  * Compute a 32-bit cyclic redundancy checksum for a given file.
 
 /**
  * Compute a 32-bit cyclic redundancy checksum for a given file.
index ef99f718b76e3187c874d0a3637525c89404bae1..c523792491b3b6a2885e36b803a3c3762ea8de0c 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <stdint.h>
 #include <babeltrace2/babeltrace.h>
 
 #include <stdint.h>
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 #define VPID_FIELD_NAME                "vpid"
 #define IP_FIELD_NAME          "ip"
 
 #define VPID_FIELD_NAME                "vpid"
 #define IP_FIELD_NAME          "ip"
index 4ab527b0ac41e05684bc63cdd56deca4c1220c78..90d66e4def2c934c3181f3dd65d6c2c9d84f4117 100644 (file)
@@ -32,7 +32,7 @@
 #include <stdlib.h>
 #include <dwarf.h>
 #include <elfutils/libdw.h>
 #include <stdlib.h>
 #include <dwarf.h>
 #include <elfutils/libdw.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 /*
  * bt_dwarf is a wrapper over libdw providing a nicer, higher-level
 
 /*
  * bt_dwarf is a wrapper over libdw providing a nicer, higher-level
index b9259769f249637346fac3539b5d2053a39436b0..ddb1b89ddaccae8ed3ea6b4129603b26a8d479db 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <babeltrace2/babeltrace.h>
 
 
 #include <babeltrace2/babeltrace.h>
 
+#include "common/macros.h"
 #include "trace-ir-mapping.h"
 
 BT_HIDDEN
 #include "trace-ir-mapping.h"
 
 BT_HIDDEN
index 9691785b378d4895156c084eb6b8febd5b493f05..fda6a729ae20d50c06821ac8e09bbef6092bbce8 100644 (file)
@@ -25,6 +25,7 @@
 #include <glib.h>
 
 #include "common/assert.h"
 #include <glib.h>
 
 #include "common/assert.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "debug-info.h"
 #include <babeltrace2/babeltrace.h>
 
 #include "debug-info.h"
index 9330546d4414481f2eb4a4e25de766e6e5c49f65..f9f806441afd82ecfcedbb7f0081af6f6b55c130 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <babeltrace2/babeltrace.h>
  */
 
 #include <babeltrace2/babeltrace.h>
+#include "common/macros.h"
 #include "trace-ir-mapping.h"
 
 BT_HIDDEN
 #include "trace-ir-mapping.h"
 
 BT_HIDDEN
index 3bd5b80fbe930365208bf0a8668e61af45e1a6c8..7df3fb2c0e6ef5c0aba56581ba75bed043ee33a7 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #include <babeltrace2/babeltrace.h>
  */
 
 #include <babeltrace2/babeltrace.h>
+#include "common/macros.h"
 #include "trace-ir-mapping.h"
 
 BT_HIDDEN
 #include "trace-ir-mapping.h"
 
 BT_HIDDEN
index 8f1bddea6c9b21f7398a73f7a32b549373c5e7a5..3dfdf7939e3343e9f6e490ab6bd763189e5dcf87 100644 (file)
@@ -22,6 +22,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include <string.h>
 #include "utils.h"
 
 BT_HIDDEN
 #include "utils.h"
 
 BT_HIDDEN
index 393f34eb5fd2da9e64582d9658c2efaa4bf58f19..79b02a03e1b4ef0f17bcef42986fa04ca0bf3a24 100644 (file)
@@ -26,7 +26,7 @@
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "trace-ir-mapping.h"
 
 /*
 #include "trace-ir-mapping.h"
 
 /*
index 6fc5ddefc2e1644b6233bf54c7b940c46287cd4f..fd29d7a5a2d5cb234e4d13735dc73e41b0715a87 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include <stdbool.h>
  */
 
 #include <stdbool.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 BT_HIDDEN
 #include <babeltrace2/babeltrace.h>
 
 BT_HIDDEN
index e3a24106760a011b00ac9834664ae3b93d69469d..72203df2a108d54d77858fb6c6d733fb82280357 100644 (file)
  * SOFTWARE.
  */
 
  * SOFTWARE.
  */
 
+#include <glib.h>
+#include <stdio.h>
 #include <stdbool.h>
 #include <stdbool.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 enum pretty_default {
 #include <babeltrace2/babeltrace.h>
 
 enum pretty_default {
index 388a0915dbeda9c0a30e6ec3e30b9af03108f5dd..7ba5b3b46f5b8993a2a558b8917042165d675e53 100644 (file)
@@ -30,6 +30,7 @@
 #include "common/assert.h"
 #include <inttypes.h>
 #include <ctype.h>
 #include "common/assert.h"
 #include <inttypes.h>
 #include <ctype.h>
+#include <string.h>
 #include "pretty.h"
 
 #define NSEC_PER_SEC 1000000000LL
 #include "pretty.h"
 
 #define NSEC_PER_SEC 1000000000LL
index 37ddd0306edb95af3989621332b53ddb10db63d1..200b9aa752866a68ba96443df5f78f787de902fb 100644 (file)
@@ -24,7 +24,7 @@
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/common.h"
 #include "plugins/plugins-common.h"
 #include "common/assert.h"
 #include "common/common.h"
 #include "plugins/plugins-common.h"
 #include "common/assert.h"
@@ -236,7 +236,7 @@ bt_self_component_status counter_consume(
                        bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
 
                        bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
 
-       if (unlikely(!counter->msg_iter)) {
+       if (G_UNLIKELY(!counter->msg_iter)) {
                try_print_last(counter);
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
                try_print_last(counter);
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
index c29f0fd5335ff046a410ef35ec08637fff596bde..4052736ecdddb03aa00491eb4ecb9c7afe5c2c57 100644 (file)
@@ -27,6 +27,7 @@
 #include <babeltrace2/babeltrace.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <babeltrace2/babeltrace.h>
 #include <stdbool.h>
 #include <stdint.h>
+#include "common/macros.h"
 
 struct counter {
        bt_self_component_port_input_message_iterator *msg_iter;
 
 struct counter {
        bt_self_component_port_input_message_iterator *msg_iter;
index 5da07ea21ddc9dbec9dc5656bc38fc05add16674..d21f26a39d784cc1fd0b29da300e8188830e538a 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 #include <babeltrace2/babeltrace.h>
  */
 
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "plugins/plugins-common.h"
 #include "common/assert.h"
 #include "dummy.h"
 #include "plugins/plugins-common.h"
 #include "common/assert.h"
 #include "dummy.h"
@@ -120,7 +120,7 @@ bt_self_component_status dummy_consume(
                bt_self_component_sink_as_self_component(component));
        BT_ASSERT(dummy);
 
                bt_self_component_sink_as_self_component(component));
        BT_ASSERT(dummy);
 
-       if (unlikely(!dummy->msg_iter)) {
+       if (G_UNLIKELY(!dummy->msg_iter)) {
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
        }
                ret = BT_SELF_COMPONENT_STATUS_END;
                goto end;
        }
index ea44ecb90d98fde9a1d0834827531c6894825d8d..2b05f6cfd0ebacd5023350050d4377eba75b9090 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <babeltrace2/babeltrace.h>
 
 #include <glib.h>
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <stdbool.h>
 
 struct dummy {
 #include <stdbool.h>
 
 struct dummy {
index b575f967d0e994a43c71a569468f8dba09a34059..827532d93e05734e637ea0875fce08f5fc0c140a 100644 (file)
@@ -23,7 +23,7 @@
 #define BT_LOG_TAG "PLUGIN-UTILS-MUXER-FLT"
 #include "logging.h"
 
 #define BT_LOG_TAG "PLUGIN-UTILS-MUXER-FLT"
 #include "logging.h"
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/uuid.h"
 #include <babeltrace2/babeltrace.h>
 #include "lib/value.h"
 #include "compat/uuid.h"
 #include <babeltrace2/babeltrace.h>
 #include "lib/value.h"
@@ -516,7 +516,7 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
                "last-returned-ts=%" PRId64,
                muxer_msg_iter, msg, last_returned_ts_ns);
 
                "last-returned-ts=%" PRId64,
                muxer_msg_iter, msg, last_returned_ts_ns);
 
-       if (unlikely(muxer_msg_iter->clock_class_expectation ==
+       if (G_UNLIKELY(muxer_msg_iter->clock_class_expectation ==
                        MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NONE)) {
                *ts_ns = last_returned_ts_ns;
                goto end;
                        MUXER_MSG_ITER_CLOCK_CLASS_EXPECTATION_NONE)) {
                *ts_ns = last_returned_ts_ns;
                goto end;
@@ -524,20 +524,20 @@ int get_msg_ts_ns(struct muxer_comp *muxer_comp,
 
        msg_type = bt_message_get_type(msg);
 
 
        msg_type = bt_message_get_type(msg);
 
-       if (unlikely(msg_type == BT_MESSAGE_TYPE_PACKET_BEGINNING)) {
+       if (G_UNLIKELY(msg_type == BT_MESSAGE_TYPE_PACKET_BEGINNING)) {
                stream_class = bt_stream_borrow_class_const(
                        bt_packet_borrow_stream_const(
                                bt_message_packet_beginning_borrow_packet_const(
                                        msg)));
                stream_class = bt_stream_borrow_class_const(
                        bt_packet_borrow_stream_const(
                                bt_message_packet_beginning_borrow_packet_const(
                                        msg)));
-       } else if (unlikely(msg_type == BT_MESSAGE_TYPE_PACKET_END)) {
+       } else if (G_UNLIKELY(msg_type == BT_MESSAGE_TYPE_PACKET_END)) {
                stream_class = bt_stream_borrow_class_const(
                        bt_packet_borrow_stream_const(
                                bt_message_packet_end_borrow_packet_const(
                                        msg)));
                stream_class = bt_stream_borrow_class_const(
                        bt_packet_borrow_stream_const(
                                bt_message_packet_end_borrow_packet_const(
                                        msg)));
-       } else if (unlikely(msg_type == BT_MESSAGE_TYPE_DISCARDED_EVENTS)) {
+       } else if (G_UNLIKELY(msg_type == BT_MESSAGE_TYPE_DISCARDED_EVENTS)) {
                stream_class = bt_stream_borrow_class_const(
                        bt_message_discarded_events_borrow_stream_const(msg));
                stream_class = bt_stream_borrow_class_const(
                        bt_message_discarded_events_borrow_stream_const(msg));
-       } else if (unlikely(msg_type == BT_MESSAGE_TYPE_DISCARDED_PACKETS)) {
+       } else if (G_UNLIKELY(msg_type == BT_MESSAGE_TYPE_DISCARDED_PACKETS)) {
                stream_class = bt_stream_borrow_class_const(
                        bt_message_discarded_packets_borrow_stream_const(msg));
        }
                stream_class = bt_stream_borrow_class_const(
                        bt_message_discarded_packets_borrow_stream_const(msg));
        }
@@ -915,7 +915,7 @@ muxer_msg_iter_youngest_upstream_msg_iter(
                msg = g_queue_peek_head(cur_muxer_upstream_msg_iter->msgs);
                BT_ASSERT(msg);
 
                msg = g_queue_peek_head(cur_muxer_upstream_msg_iter->msgs);
                BT_ASSERT(msg);
 
-               if (unlikely(bt_message_get_type(msg) ==
+               if (G_UNLIKELY(bt_message_get_type(msg) ==
                                BT_MESSAGE_TYPE_STREAM_BEGINNING)) {
                        ret = validate_new_stream_clock_class(
                                muxer_msg_iter, muxer_comp,
                                BT_MESSAGE_TYPE_STREAM_BEGINNING)) {
                        ret = validate_new_stream_clock_class(
                                muxer_msg_iter, muxer_comp,
@@ -929,7 +929,7 @@ muxer_msg_iter_youngest_upstream_msg_iter(
                                status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                                goto end;
                        }
                                status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                                goto end;
                        }
-               } else if (unlikely(bt_message_get_type(msg) ==
+               } else if (G_UNLIKELY(bt_message_get_type(msg) ==
                                BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY)) {
                        const bt_clock_snapshot *cs;
 
                                BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY)) {
                        const bt_clock_snapshot *cs;
 
@@ -1042,7 +1042,7 @@ bt_self_message_iterator_status validate_muxer_upstream_msg_iters(
                 * Move this muxer upstream message iterator to the
                 * array of ended iterators if it's ended.
                 */
                 * Move this muxer upstream message iterator to the
                 * array of ended iterators if it's ended.
                 */
-               if (unlikely(is_ended)) {
+               if (G_UNLIKELY(is_ended)) {
                        BT_LOGV("Muxer's upstream message iterator wrapper: ended or canceled: "
                                "muxer-msg-iter-addr=%p, "
                                "muxer-upstream-msg-iter-wrap-addr=%p",
                        BT_LOGV("Muxer's upstream message iterator wrapper: ended or canceled: "
                                "muxer-msg-iter-addr=%p, "
                                "muxer-upstream-msg-iter-wrap-addr=%p",
index a383e4c2c0e4e6995f4bb959373686127cb5a8f3..43b4d52ba7225a0a3dcc98daca60b7dc8a71182d 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <stdint.h>
 #include <babeltrace2/babeltrace.h>
 
 #include <stdint.h>
 #include <babeltrace2/babeltrace.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 
 BT_HIDDEN
 bt_self_component_status muxer_init(
 
 BT_HIDDEN
 bt_self_component_status muxer_init(
index f2d2c4340c3ff646a559e78e7d5b8be4ef7a1f94..b8cc481a5b79fb34112b7a5023e1ecec9ef48b55 100644 (file)
@@ -632,7 +632,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_event_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_event_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -643,7 +643,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -654,7 +654,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_packet_end_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_packet_end_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -665,7 +665,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -676,7 +676,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -687,7 +687,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_stream_activity_beginning_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_stream_activity_beginning_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -705,7 +705,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
                clock_class =
                        bt_message_stream_activity_end_borrow_stream_class_default_clock_class_const(
                                msg);
                clock_class =
                        bt_message_stream_activity_end_borrow_stream_class_default_clock_class_const(
                                msg);
-               if (unlikely(!clock_class)) {
+               if (G_UNLIKELY(!clock_class)) {
                        goto error;
                }
 
                        goto error;
                }
 
@@ -733,7 +733,7 @@ int get_msg_ns_from_origin(const bt_message *msg, int64_t *ns_from_origin,
 
        ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot,
                ns_from_origin);
 
        ret = bt_clock_snapshot_get_ns_from_origin(clock_snapshot,
                ns_from_origin);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                goto error;
        }
 
                goto error;
        }
 
@@ -1318,14 +1318,14 @@ bt_self_message_iterator_status handle_message_with_stream_state(
 
        switch (msg_type) {
        case BT_MESSAGE_TYPE_EVENT:
 
        switch (msg_type) {
        case BT_MESSAGE_TYPE_EVENT:
-               if (unlikely(!trimmer_it->end.is_infinite &&
+               if (G_UNLIKELY(!trimmer_it->end.is_infinite &&
                                ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        break;
                }
 
                                ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        break;
                }
 
-               if (unlikely(!sstate->inited)) {
+               if (G_UNLIKELY(!sstate->inited)) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
@@ -1333,7 +1333,7 @@ bt_self_message_iterator_status handle_message_with_stream_state(
                        }
                }
 
                        }
                }
 
-               if (unlikely(!sstate->cur_packet)) {
+               if (G_UNLIKELY(!sstate->cur_packet)) {
                        const bt_event *event =
                                bt_message_event_borrow_event_const(msg);
                        const bt_packet *packet = bt_event_borrow_packet_const(
                        const bt_event *event =
                                bt_message_event_borrow_event_const(msg);
                        const bt_packet *packet = bt_event_borrow_packet_const(
@@ -1351,14 +1351,14 @@ bt_self_message_iterator_status handle_message_with_stream_state(
                msg = NULL;
                break;
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
                msg = NULL;
                break;
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
-               if (unlikely(!trimmer_it->end.is_infinite &&
+               if (G_UNLIKELY(!trimmer_it->end.is_infinite &&
                                ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        break;
                }
 
                                ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        break;
                }
 
-               if (unlikely(!sstate->inited)) {
+               if (G_UNLIKELY(!sstate->inited)) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
@@ -1376,14 +1376,14 @@ bt_self_message_iterator_status handle_message_with_stream_state(
        case BT_MESSAGE_TYPE_PACKET_END:
                sstate->stream_act_end_ns_from_origin = ns_from_origin;
 
        case BT_MESSAGE_TYPE_PACKET_END:
                sstate->stream_act_end_ns_from_origin = ns_from_origin;
 
-               if (unlikely(!trimmer_it->end.is_infinite &&
+               if (G_UNLIKELY(!trimmer_it->end.is_infinite &&
                                ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        break;
                }
 
                                ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        break;
                }
 
-               if (unlikely(!sstate->inited)) {
+               if (G_UNLIKELY(!sstate->inited)) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
@@ -1391,7 +1391,7 @@ bt_self_message_iterator_status handle_message_with_stream_state(
                        }
                }
 
                        }
                }
 
-               if (unlikely(!sstate->cur_packet)) {
+               if (G_UNLIKELY(!sstate->cur_packet)) {
                        const bt_packet *packet =
                                bt_message_packet_end_borrow_packet_const(msg);
 
                        const bt_packet *packet =
                                bt_message_packet_end_borrow_packet_const(msg);
 
@@ -1501,7 +1501,7 @@ bt_self_message_iterator_status handle_message_with_stream_state(
                        BT_MESSAGE_MOVE_REF(msg, new_msg);
                }
 
                        BT_MESSAGE_MOVE_REF(msg, new_msg);
                }
 
-               if (unlikely(!sstate->inited)) {
+               if (G_UNLIKELY(!sstate->inited)) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        status = ensure_stream_state_is_inited(trimmer_it,
                                sstate, NULL);
                        if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
@@ -1702,11 +1702,11 @@ bt_self_message_iterator_status handle_message(
                break;
        }
 
                break;
        }
 
-       if (likely(stream)) {
+       if (G_LIKELY(stream)) {
                /* Find stream state */
                sstate = g_hash_table_lookup(trimmer_it->stream_states,
                        stream);
                /* Find stream state */
                sstate = g_hash_table_lookup(trimmer_it->stream_states,
                        stream);
-               if (unlikely(!sstate)) {
+               if (G_UNLIKELY(!sstate)) {
                        /* No stream state yet: create one now */
                        const bt_stream_class *sc;
 
                        /* No stream state yet: create one now */
                        const bt_stream_class *sc;
 
@@ -1808,12 +1808,12 @@ bt_self_message_iterator_status handle_message(
 
        /* Retrieve the message's time */
        ret = get_msg_ns_from_origin(msg, &ns_from_origin, &skip);
 
        /* Retrieve the message's time */
        ret = get_msg_ns_from_origin(msg, &ns_from_origin, &skip);
-       if (unlikely(ret)) {
+       if (G_UNLIKELY(ret)) {
                status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
                status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
                goto end;
        }
 
-       if (likely(sstate)) {
+       if (G_LIKELY(sstate)) {
                /* Message associated to a stream */
                status = handle_message_with_stream_state(trimmer_it, msg,
                        sstate, ns_from_origin, reached_end);
                /* Message associated to a stream */
                status = handle_message_with_stream_state(trimmer_it, msg,
                        sstate, ns_from_origin, reached_end);
@@ -1828,7 +1828,7 @@ bt_self_message_iterator_status handle_message(
                 * Message not associated to a stream (message iterator
                 * inactivity).
                 */
                 * Message not associated to a stream (message iterator
                 * inactivity).
                 */
-               if (unlikely(ns_from_origin > trimmer_it->end.ns_from_origin)) {
+               if (G_UNLIKELY(ns_from_origin > trimmer_it->end.ns_from_origin)) {
                        BT_MESSAGE_PUT_REF_AND_RESET(msg);
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
                        BT_MESSAGE_PUT_REF_AND_RESET(msg);
                        status = end_iterator_streams(trimmer_it);
                        *reached_end = true;
@@ -1902,7 +1902,7 @@ bt_self_message_iterator_status state_trim(struct trimmer_iterator *trimmer_it,
        while (g_queue_is_empty(trimmer_it->output_messages)) {
                status = (int) bt_self_component_port_input_message_iterator_next(
                        trimmer_it->upstream_iter, &my_msgs, &my_count);
        while (g_queue_is_empty(trimmer_it->output_messages)) {
                status = (int) bt_self_component_port_input_message_iterator_next(
                        trimmer_it->upstream_iter, &my_msgs, &my_count);
-               if (unlikely(status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK)) {
+               if (G_UNLIKELY(status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK)) {
                        if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_END) {
                                status = end_iterator_streams(trimmer_it);
                                if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_END) {
                                status = end_iterator_streams(trimmer_it);
                                if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
@@ -1930,13 +1930,13 @@ bt_self_message_iterator_status state_trim(struct trimmer_iterator *trimmer_it,
                         */
                        my_msgs[i] = NULL;
 
                         */
                        my_msgs[i] = NULL;
 
-                       if (unlikely(status !=
+                       if (G_UNLIKELY(status !=
                                        BT_SELF_MESSAGE_ITERATOR_STATUS_OK)) {
                                put_messages(my_msgs, my_count);
                                goto end;
                        }
 
                                        BT_SELF_MESSAGE_ITERATOR_STATUS_OK)) {
                                put_messages(my_msgs, my_count);
                                goto end;
                        }
 
-                       if (unlikely(reached_end)) {
+                       if (G_UNLIKELY(reached_end)) {
                                /*
                                 * This message's time was passed the
                                 * trimming time range's end time: we
                                /*
                                 * This message's time was passed the
                                 * trimming time range's end time: we
@@ -1982,7 +1982,7 @@ bt_self_message_iterator_status trimmer_msg_iter_next(
 
        BT_ASSERT(trimmer_it);
 
 
        BT_ASSERT(trimmer_it);
 
-       if (likely(trimmer_it->state == TRIMMER_ITERATOR_STATE_TRIM)) {
+       if (G_LIKELY(trimmer_it->state == TRIMMER_ITERATOR_STATE_TRIM)) {
                status = state_trim(trimmer_it, msgs, capacity, count);
                if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        goto end;
                status = state_trim(trimmer_it, msgs, capacity, count);
                if (status != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
                        goto end;
index 27f232947d121334c84860759856688ab4e379e8..46ac8a3813e06974cc80916a115cb735a7b541e7 100644 (file)
@@ -28,7 +28,7 @@
  */
 
 #include <stdbool.h>
  */
 
 #include <stdbool.h>
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include <babeltrace2/babeltrace.h>
 
 BT_HIDDEN
 #include <babeltrace2/babeltrace.h>
 
 BT_HIDDEN
index 35f8755580c64e999ddff042abe674db1530ccdc..eb59f8ca492da3b944fdb35fa1a3f54e565ce09f 100644 (file)
@@ -26,7 +26,7 @@
 
 #define BT_LOG_TAG "PLUGIN-PY"
 
 
 #define BT_LOG_TAG "PLUGIN-PY"
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "compat/compiler.h"
 #include <babeltrace2/plugin/plugin-const.h>
 #include "lib/plugin/plugin.h"
 #include "compat/compiler.h"
 #include <babeltrace2/plugin/plugin-const.h>
 #include "lib/plugin/plugin.h"
index 10916fba59294c1040dfe7fee074c5a3de93fd97..72bbbd6b7321b71ed8c8605bb4a27cb81308533b 100644 (file)
@@ -19,6 +19,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <stdio.h>
 #include "tap/tap.h"
 #include <babeltrace2/babeltrace.h>
 #include "lib/object.h"
 #include "tap/tap.h"
 #include <babeltrace2/babeltrace.h>
 #include "lib/object.h"
index a4c95d051d46594d2bf041cb97a0b53857f2d125..d681ef5621abc948c00b6d6266fda030a7c9e4e2 100644 (file)
@@ -27,7 +27,7 @@
 #include <inttypes.h>
 #include <glib.h>
 
 #include <inttypes.h>
 #include <glib.h>
 
-#include "common/babeltrace.h"
+#include "common/macros.h"
 #include "common/assert.h"
 #include <lttng-utils/debug-info/bin-info.h>
 
 #include "common/assert.h"
 #include <lttng-utils/debug-info/bin-info.h>
 
index fa475e104069c38c706e40b42654087f1ca48753..abb72bba6051e516404fb16b6140a9ac4c97150a 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include <fcntl.h>
  */
 
 #include <fcntl.h>
+#include <glib.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
This page took 0.102577 seconds and 4 git commands to generate.