doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab master
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 13 May 2024 17:08:50 +0000 (13:08 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 15 May 2024 16:17:09 +0000 (12:17 -0400)
It looks like the Doxygen project decided [1] to use the "topic"
terminology instead of "module" to avoid confusion with C++20 modules.

Add a `topics` tab to `DoxygenLayout.xml` because otherwise that
navigation tab won't show up.

Leaving `modules` for older Doxygen versions.

Also changing all the "module" terms to "API"/"page" in the actual
documentation to completely part from the old "module" Doxygen concept.

[1]: https://github.com/doxygen/doxygen/commit/6d80fc7e5d03c259b1a7280972e0b28884217655

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6f535c42c2bd5f55e5727a3245a2d744b28c187c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12630

35 files changed:
doc/api/libbabeltrace2/DoxygenLayout.xml
doc/api/libbabeltrace2/dox/api-fund.dox
doc/api/libbabeltrace2/dox/group-trace-ir.dox
doc/api/libbabeltrace2/dox/main-page.dox
include/babeltrace2-ctf-writer/object.h
include/babeltrace2/error-reporting.h
include/babeltrace2/graph/component-class-dev.h
include/babeltrace2/graph/component-class.h
include/babeltrace2/graph/message-iterator-class.h
include/babeltrace2/graph/message.h
include/babeltrace2/graph/private-query-executor.h
include/babeltrace2/graph/self-component-class.h
include/babeltrace2/plugin/plugin-dev.h
include/babeltrace2/util.h
include/babeltrace2/version.h
src/common/macros.h
src/common/prio-heap.c [deleted file]
src/common/prio-heap.h [deleted file]
src/cpp-common/bt2c/fmt.hpp
src/cpp-common/bt2c/logging.hpp
src/cpp-common/vendor/span-lite/span.hpp
src/lib/lib-logging.c
src/lib/trace-ir/clock-class.c
src/lib/trace-ir/clock-class.h
src/lib/trace-ir/event-class.c
src/lib/trace-ir/event-class.h
src/lib/trace-ir/stream-class.c
src/lib/trace-ir/stream-class.h
src/lib/trace-ir/stream.c
src/lib/trace-ir/stream.h
src/lib/trace-ir/trace.c
src/lib/trace-ir/trace.h
src/plugins/ctf/fs-src/query.cpp
tests/plugins/src.ctf.fs/field/test-field.sh
tests/utils/utils.sh

index 7e40db87279f183ba8698d29a8b4ec172e357d3a..0ceb53cafbb995dc5c07b767ffa81db0ff66434d 100644 (file)
@@ -6,7 +6,9 @@
     <tab type="user" visible="yes" url="@ref examples" title="Examples"/>
     <tab type="pages" visible="yes" title="All pages" intro=""/>
     <tab type="modules" visible="yes" title="API reference"
-      intro="List of all API reference modules:"/>
+      intro="List of all API reference pages:"/>
+    <tab type="topics" visible="yes" title="API reference"
+      intro="List of all API reference pages:"/>
   </navindex>
 
   <group>
index 5b24faf4e3c2b76fdf3d3fe0f5a1a57dbf304484..8f742e73f042431ec40b9a8dd814a2622efc64e8 100644 (file)
@@ -35,7 +35,7 @@ that it meets its
 when it returns.
 
 The function descriptions in the
-<a class="el" href="modules.html">API reference modules</a>
+<a class="el" href="topics.html">API reference</a>
 list all their preconditions and postconditions, if any.
 
 The libbabeltrace2 public functions offer a
@@ -126,7 +126,7 @@ object type A inherits an object type B, then you can use both the A and
 B API functions with an object of type A. For example, because an
 \bt_enum_fc \em is conceptually an \bt_int_fc, you can use any integer
 field class function with an enumeration field class.
-The <a class="el" href="modules.html">API reference modules</a> always
+The <a class="el" href="topics.html">API reference pages</a> always
 indicate the inheritance relations.
 
 @subsection api-fund-object-shared-unique Shared vs. unique objects
@@ -199,7 +199,7 @@ Some \bt_name objects are \em shared while some others are \em unique:
 
     Because you cannot get a new unique object reference, you \em must
     ensure that you own the unique object's owner to keep it alive. The
-    <a class="el" href="modules.html">API reference modules</a> make it
+    <a class="el" href="topics.html">API reference pages</a> make it
     clear, depending on the context, which
     shared object is the ultimate owner of a given unique object.
 
@@ -212,7 +212,7 @@ Some \bt_name objects are \em shared while some others are \em unique:
   </dd>
 </dl>
 
-In the <a class="el" href="modules.html">API reference</a>, each module
+In the <a class="el" href="topics.html">API reference</a>, each page
 indicates whether the documented objects are shared or unique.
 
 @subsection api-fund-freezing Object freezing
@@ -233,7 +233,7 @@ When an object becomes frozen, its contained objects, if any, also
 become frozen, recursively.
 
 There's no function to check whether or not a given object is frozen.
-Because the <a class="el" href="modules.html">API reference modules</a>
+Because the <a class="el" href="topics.html">API reference pages</a>
 document which functions freeze which objects,
 the "frozen" property is only useful for libbabeltrace2 to catch
 programming errors (\ref api-fund-pre-post "precondition checks").
@@ -264,7 +264,7 @@ be contained in some collection. For example, all \bt_val objects have
 the type #bt_value because an \bt_array_val can contain different
 types of values. You must be careful to only call the functions which
 apply to a specific type of such objects.
-The <a class="el" href="modules.html">API reference modules</a> make
+The <a class="el" href="topics.html">API reference pages</a> make
 this clear in the precondition section. Such objects always have a
 <code>*_get_type()</code> function to get the object's exact type
 enumerator. For example, bt_value_get_type() returns the type enumerator
@@ -374,7 +374,7 @@ if (status != BT_VALUE_COPY_STATUS_OK) {
 }
 @endcode
 
-The <a class="el" href="modules.html">API reference modules</a>
+The <a class="el" href="topics.html">API reference pages</a>
 document, for each function, what each return status enumerator means.
 
 Some functions return properties or objects by output parameter. When
index db258057ce58fbb1a6e6d25582f80ee2aa5e2a09..5aef881b4e0ae36c73c6cc1da571e03b6123a701 100644 (file)
@@ -8,8 +8,8 @@
     domain objects and concepts (contents of \bt_p_msg).
 
 The \bt_name
-<strong><em>trace IR</em></strong> (intermediate representation) modules
-contain everything you need to represent tracing domain concepts and
+<strong><em>trace IR</em></strong> (intermediate representation) API
+offers everything you need to represent tracing domain concepts and
 objects so that many \bt_p_comp, written by different authors, can
 exchange trace metadata and data.
 
index 22c1e5d38a6bec6d705eee1a341706bdfa4daa34..d5a096c11a4fb9bff3b79b22f802296a17293caf 100644 (file)
@@ -112,13 +112,13 @@ to learn even more about the \bt_name project and its core concepts.
     parts of the API to accomplish real tasks.
   </dd>
 
-  <dt><a class="el" href="modules.html">API reference</a></dt>
+  <dt><a class="el" href="topics.html">API reference</a></dt>
   <dd>
     Documents all the \bt_name C functions, definitions, macros,
     enumerators, and types.
 
-    Each documentation module describes its API thoroughly and how it's
-    related to other modules.
+    Each page describes its API thoroughly and how it's
+    related to other APIs.
   </dd>
 </dl>
 */
index 9767eb3ef83be723d3cc82dbd806676dcb0947b8..0191b34b3e601ff6c03cb99b74ed8d6e00b6eed0 100644 (file)
@@ -20,7 +20,7 @@ extern "C" {
 #include <babeltrace2-ctf-writer/object.h>
 @endcode
 
-The macros and functions of this module are everything that is needed
+The macros and functions of this API are everything that is needed
 to handle the <strong><em>reference counting</em></strong> of
 Babeltrace objects.
 
index 29e53e16b5d3b18fff9973855823d9f1b47bc57d..0a257d19340afab9c6fb182595db6e2a9218129c 100644 (file)
@@ -28,8 +28,8 @@ extern "C" {
 @brief
     Error reporting functions and macros.
 
-This module contains functions and macros to report rich errors from a
-user function (a \bt_comp_cls method, a
+This API offers functions and macros to report rich
+errors from a user function (a \bt_comp_cls method, a
 \ref api-qexec "query operation", or a trace processing \bt_graph
 listener, for example) to any function caller.
 
index 7267e62f1fe95df1ff69f3f7c315083bf2b49570..7e59f6655cafde816834153107fa5f05fb719335 100644 (file)
@@ -32,11 +32,11 @@ A <strong><em>component class</em></strong> is the class of a \bt_comp:
 @image html component.png
 
 @attention
-    This module (component class development API) offers functions to
+    This API (component class development API) offers functions to
     programmatically create component classes. To get the properties of
     an existing component class, see \ref api-comp-cls.
 
-A component class has <em>methods</em>. This module essentially
+A component class has <em>methods</em>. This API essentially
 offers:
 
 - Component class method type definitions.
@@ -84,7 +84,7 @@ See \ref api-comp-cls-dev-methods "Methods" to learn more about the
 different types of component class methods.
 
 A component class is a \ref api-fund-shared-object "shared object": see
-the \ref api-comp-cls module for the reference count functions.
+the \ref api-comp-cls API for the reference count functions.
 
 Some library functions \ref api-fund-freezing "freeze" component classes
 on success. The documentation of those functions indicate this
index 4fe692f2c88110a112ad9abfe82252253131e0fb..64bccf3b048d731f95fcb8a8e5b023931e4f781e 100644 (file)
@@ -31,9 +31,9 @@ A <strong><em>component class</em></strong> is the class of a \bt_comp:
 @image html component.png
 
 @attention
-    This module (component class API) offers basic, read-only functions
-    to get component class properties. To \em create a component class,
-    see \ref api-comp-cls-dev or \ref api-plugin-dev.
+    This API (component class API) offers basic,
+    read-only functions to get component class properties. To \em create
+    a component class, see \ref api-comp-cls-dev or \ref api-plugin-dev.
 
 You can instantiate a given component class many times, with different
 initialization parameters, to create many components with the
index 82ee1f2d6e4cdb579f1859d1c3977526fe06a146..b7ddf89ace35eea51acb9895a81af8a45ec40cbb 100644 (file)
@@ -39,8 +39,8 @@ pass it to bt_component_class_source_create() or
 bt_component_class_filter_create() to set it as the created component
 class's message iterator class.
 
-A message iterator class has <em>methods</em>. This module essentially
-offers:
+A message iterator class has <em>methods</em>. This API
+essentially offers:
 
 - Message iterator class method type definitions.
 
index a73d6e1cc240d7053e0af421d32d9d902e992c9f..f634f888fc7bc3bf1a5b249bb054d576a021afb9 100644 (file)
@@ -848,7 +848,7 @@ version as rarely as possible. When it is required, though, it's a
 welcome tool to make the project evolve gracefully.
 
 The Message Interchange Protocol has no dedicated documentation as this
-very message module (and its submodules, like \ref api-tir)
+very message API (and its contained APIs, like \ref api-tir)
 documentation is enough. You can consider that all the
 functions of the message and trace IR objects have an implicit MIP
 version \ref api-fund-pre-post "precondition". When a given
index 81a0daeb0cdf863d9db8a60a3752bf5556e7d669..7598f5397e4c893d072dcfa1521d35d1a8e82cbb 100644 (file)
@@ -35,7 +35,7 @@ from within a \bt_comp_cls
 A query method receives a private query executor as its
 \bt_p{query_executor} parameter.
 
-As of \bt_name_version_min_maj, this module only offers the
+As of \bt_name_version_min_maj, this API only offers the
 bt_private_query_executor_as_query_executor_const() function to
 \ref api-fund-c-typing "upcast" a private query executor to a
 \c const query executor. You need this to get the query executor's
index 366f7146f26388a26c578588ddbac6f9a8b1a949..c07480596329c785ba12342af20d7448a962ab14 100644 (file)
@@ -31,9 +31,9 @@ The #bt_self_component_class, #bt_self_component_class_source,
 private views of a \bt_comp_cls from within a component class
 \ref api-comp-cls-dev-class-meth "class method".
 
-As of \bt_name_version_min_maj, this module only contains functions
-to \ref api-fund-c-typing "upcast" the "self" (private) types to their
-public #bt_component_class, #bt_component_class_source,
+As of \bt_name_version_min_maj, this API only offers
+functions to \ref api-fund-c-typing "upcast" the "self" (private) types
+to their public #bt_component_class, #bt_component_class_source,
 #bt_component_class_filter, and #bt_component_class_sink counterparts.
 */
 
index 42420d8e2da5da937ccb3415471900a5c666aff5..e5760598badeaa7f3b2c717bd6934a8317123c7c 100644 (file)
@@ -49,13 +49,14 @@ extern "C" {
 @brief
     Shared object plugin development.
 
-This module offers macros to create a \bt_name shared object plugin.
+This API offers macros to create a \bt_name shared
+object plugin.
 
-Behind the scenes, the <code>BT_PLUGIN_*()</code> macros of this module
-create and fill global tables which are located in sections of the
-shared object with specific names. The \ref api-plugin functions can
-load the resulting shared object file and create corresponding
-\bt_plugin objects.
+Behind the scenes, the <code>BT_PLUGIN_*()</code> macros of this
+API create and fill global tables which are located in
+sections of the shared object with specific names. The \ref api-plugin
+functions can load the resulting shared object file and create
+corresponding \bt_plugin objects.
 
 See \ref guide-comp-link-plugin-so.
 
@@ -192,7 +193,7 @@ You can repeat steps 5 to 7 to add more than one component class to a
 given plugin.
 
 See \ref example-simple-plugin-def-file for a concrete example of how
-to use the macros of this module.
+to use the macros of this API.
 
 <h1>\anchor api-plugin-dev-custom-plugin-id Custom plugin ID</h1>
 
index 80c0e66bde5e4bf5820310c072dff3a8485b79c9..030862ae2b9b2b50178108d03f76cd4b1d319c44 100644 (file)
@@ -25,7 +25,7 @@ extern "C" {
 @brief
     General purpose utilities.
 
-This module contains general purpose utilities.
+This API offers general purpose utilities.
 */
 
 /*! @{ */
index 66ad5415d07fd5c7b3d55ae6561649dc9a22873d..0f9506001cf83117efd46556dbf9a865274384df 100644 (file)
@@ -23,8 +23,8 @@ extern "C" {
 @brief
     Library version getters.
 
-This module contains functions to get information about the library's
-version:
+This API offers functions to get information about the
+library's version:
 
 <dl>
   <dt>Major version</dt>
index 8120515c63fe5bbcd81672f8c7b4cf1df89d9ce8..0f2bc8fb116eda78ac663d748ced56368430d4a6 100644 (file)
@@ -45,29 +45,6 @@ extern "C" {
 #define BT_IF_DEV_MODE(txt)
 #endif
 
-/*
- * Yield `ref`'s value while setting `ref` to NULL.
- *
- * This can be used to give a strong reference to a callee:
- *
- *   add_foo_to_list(list, BT_MOVE_REF(foo));
- *
- * or in a simple assignment:
- *
- *   my_struct->foo = BT_MOVE_REF(foo);
- *
- * When moving a reference in a function call, the reference is given to the
- * callee even if that function call fails, so make sure the called function
- * is written accordingly.
- */
-
-#define BT_MOVE_REF(ref)               \
-       ({                              \
-               __typeof__(ref) _ref = ref;     \
-               ref = NULL;             \
-               _ref;                   \
-       })
-
 /* Wrapper for g_array_index that adds bound checking.  */
 #define bt_g_array_index(a, t, i)              \
        g_array_index((a), t, ({ BT_ASSERT_DBG((i) < (a)->len); (i); }))
diff --git a/src/common/prio-heap.c b/src/common/prio-heap.c
deleted file mode 100644 (file)
index 55ed5e8..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Static-sized priority heap containing pointers. Based on CLRS,
- * chapter 6.
- */
-
-#include "common/macros.h"
-#include "common/assert.h"
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "common/prio-heap.h"
-
-#ifdef DEBUG_HEAP
-void check_heap(const struct ptr_heap *heap)
-{
-       size_t i;
-
-       if (!heap->len)
-               return;
-
-       for (i = 1; i < heap->len; i++)
-               BT_ASSERT_DBG(!heap->gt(heap->ptrs[i], heap->ptrs[0]));
-}
-#endif
-
-static
-size_t parent(size_t i)
-{
-       return (i - 1) >> 1;
-}
-
-static
-size_t left(size_t i)
-{
-       return (i << 1) + 1;
-}
-
-static
-size_t right(size_t i)
-{
-       return (i << 1) + 2;
-}
-
-/*
- * Copy of heap->ptrs pointer is invalid after heap_grow.
- */
-static
-int heap_grow(struct ptr_heap *heap, size_t new_len)
-{
-       void **new_ptrs;
-
-       if (G_LIKELY(heap->alloc_len >= new_len))
-               return 0;
-
-       heap->alloc_len = bt_max_t(size_t, new_len, heap->alloc_len << 1);
-       new_ptrs = calloc(heap->alloc_len, sizeof(void *));
-       if (G_UNLIKELY(!new_ptrs))
-               return -ENOMEM;
-       if (G_LIKELY(heap->ptrs))
-               memcpy(new_ptrs, heap->ptrs, heap->len * sizeof(void *));
-       free(heap->ptrs);
-       heap->ptrs = new_ptrs;
-       return 0;
-}
-
-static
-int heap_set_len(struct ptr_heap *heap, size_t new_len)
-{
-       int ret;
-
-       ret = heap_grow(heap, new_len);
-       if (G_UNLIKELY(ret))
-               return ret;
-       heap->len = new_len;
-       return 0;
-}
-
-int bt_heap_init(struct ptr_heap *heap, size_t alloc_len,
-             int gt(void *a, void *b))
-{
-       heap->ptrs = NULL;
-       heap->len = 0;
-       heap->alloc_len = 0;
-       heap->gt = gt;
-       /*
-        * Minimum size allocated is 1 entry to ensure memory allocation
-        * never fails within bt_heap_replace_max.
-        */
-       return heap_grow(heap, bt_max_t(size_t, 1, alloc_len));
-}
-
-void bt_heap_free(struct ptr_heap *heap)
-{
-       free(heap->ptrs);
-}
-
-static void heapify(struct ptr_heap *heap, size_t i)
-{
-       void **ptrs = heap->ptrs;
-       size_t l, r, largest;
-
-       for (;;) {
-               void *tmp;
-
-               l = left(i);
-               r = right(i);
-               if (l < heap->len && heap->gt(ptrs[l], ptrs[i]))
-                       largest = l;
-               else
-                       largest = i;
-               if (r < heap->len && heap->gt(ptrs[r], ptrs[largest]))
-                       largest = r;
-               if (G_UNLIKELY(largest == i))
-                       break;
-               tmp = ptrs[i];
-               ptrs[i] = ptrs[largest];
-               ptrs[largest] = tmp;
-               i = largest;
-       }
-       check_heap(heap);
-}
-
-void *bt_heap_replace_max(struct ptr_heap *heap, void *p)
-{
-       void *res;
-
-       if (G_UNLIKELY(!heap->len)) {
-               (void) heap_set_len(heap, 1);
-               heap->ptrs[0] = p;
-               check_heap(heap);
-               return NULL;
-       }
-
-       /* Replace the current max and heapify */
-       res = heap->ptrs[0];
-       heap->ptrs[0] = p;
-       heapify(heap, 0);
-       return res;
-}
-
-int bt_heap_insert(struct ptr_heap *heap, void *p)
-{
-       void **ptrs;
-       size_t pos;
-       int ret;
-
-       ret = heap_set_len(heap, heap->len + 1);
-       if (G_UNLIKELY(ret))
-               return ret;
-       ptrs = heap->ptrs;
-       pos = heap->len - 1;
-       while (pos > 0 && heap->gt(p, ptrs[parent(pos)])) {
-               /* Move parent down until we find the right spot */
-               ptrs[pos] = ptrs[parent(pos)];
-               pos = parent(pos);
-       }
-       ptrs[pos] = p;
-       check_heap(heap);
-       return 0;
-}
-
-void *bt_heap_remove(struct ptr_heap *heap)
-{
-       switch (heap->len) {
-       case 0:
-               return NULL;
-       case 1:
-               (void) heap_set_len(heap, 0);
-               return heap->ptrs[0];
-       }
-       /* Shrink, replace the current max by previous last entry and heapify */
-       heap_set_len(heap, heap->len - 1);
-       /* len changed. previous last entry is at heap->len */
-       return bt_heap_replace_max(heap, heap->ptrs[heap->len]);
-}
-
-void *bt_heap_cherrypick(struct ptr_heap *heap, void *p)
-{
-       size_t pos, len = heap->len;
-
-       for (pos = 0; pos < len; pos++)
-               if (G_UNLIKELY(heap->ptrs[pos] == p))
-                       goto found;
-       return NULL;
-found:
-       if (G_UNLIKELY(heap->len == 1)) {
-               (void) heap_set_len(heap, 0);
-               check_heap(heap);
-               return heap->ptrs[0];
-       }
-       /* Replace p with previous last entry and heapify. */
-       heap_set_len(heap, heap->len - 1);
-       /* len changed. previous last entry is at heap->len */
-       heap->ptrs[pos] = heap->ptrs[heap->len];
-       heapify(heap, pos);
-       return p;
-}
-
-int bt_heap_copy(struct ptr_heap *dst, struct ptr_heap *src)
-{
-       int ret;
-
-       ret = bt_heap_init(dst, src->alloc_len, src->gt);
-       if (ret < 0)
-               goto end;
-
-       ret = heap_set_len(dst, src->len);
-       if (ret < 0)
-               goto end;
-
-       memcpy(dst->ptrs, src->ptrs, src->len * sizeof(void *));
-
-end:
-       return ret;
-}
diff --git a/src/common/prio-heap.h b/src/common/prio-heap.h
deleted file mode 100644 (file)
index 7e56521..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Static-sized priority heap containing pointers. Based on CLRS,
- * chapter 6.
- */
-
-#ifndef BABELTRACE_COMMON_PRIO_HEAP_H
-#define BABELTRACE_COMMON_PRIO_HEAP_H
-
-#include <unistd.h>
-#include "common/macros.h"
-
-struct ptr_heap {
-       size_t len, alloc_len;
-       void **ptrs;
-       int (*gt)(void *a, void *b);
-};
-
-#ifdef DEBUG_HEAP
-void check_heap(const struct ptr_heap *heap);
-#else
-static inline
-void check_heap(const struct ptr_heap *heap __attribute__((unused)))
-{
-}
-#endif
-
-/**
- * bt_heap_maximum - return the largest element in the heap
- * @heap: the heap to be operated on
- *
- * Returns the largest element in the heap, without performing any modification
- * to the heap structure. Returns NULL if the heap is empty.
- */
-static inline void *bt_heap_maximum(const struct ptr_heap *heap)
-{
-       check_heap(heap);
-       return G_LIKELY(heap->len) ? heap->ptrs[0] : NULL;
-}
-
-/**
- * bt_heap_init - initialize the heap
- * @heap: the heap to initialize
- * @alloc_len: number of elements initially allocated
- * @gt: function to compare the elements
- *
- * Returns -ENOMEM if out of memory.
- */
-extern int bt_heap_init(struct ptr_heap *heap,
-                    size_t alloc_len,
-                    int gt(void *a, void *b));
-
-/**
- * bt_heap_free - free the heap
- * @heap: the heap to free
- */
-extern void bt_heap_free(struct ptr_heap *heap);
-
-/**
- * bt_heap_insert - insert an element into the heap
- * @heap: the heap to be operated on
- * @p: the element to add
- *
- * Insert an element into the heap.
- *
- * Returns -ENOMEM if out of memory.
- */
-extern int bt_heap_insert(struct ptr_heap *heap, void *p);
-
-/**
- * bt_heap_remove - remove the largest element from the heap
- * @heap: the heap to be operated on
- *
- * Returns the largest element in the heap. It removes this element from the
- * heap. Returns NULL if the heap is empty.
- */
-extern void *bt_heap_remove(struct ptr_heap *heap);
-
-/**
- * bt_heap_cherrypick - remove a given element from the heap
- * @heap: the heap to be operated on
- * @p: the element
- *
- * Remove the given element from the heap. Return the element if present, else
- * return NULL. This algorithm has a complexity of O(n), which is higher than
- * O(log(n)) provided by the rest of this API.
- */
-extern void *bt_heap_cherrypick(struct ptr_heap *heap, void *p);
-
-/**
- * bt_heap_replace_max - replace the the largest element from the heap
- * @heap: the heap to be operated on
- * @p: the pointer to be inserted as topmost element replacement
- *
- * Returns the largest element in the heap. It removes this element from the
- * heap. The heap is rebalanced only once after the insertion. Returns NULL if
- * the heap is empty.
- *
- * This is the equivalent of calling bt_heap_remove() and then bt_heap_insert(), but
- * it only rebalances the heap once. It never allocates memory.
- */
-extern void *bt_heap_replace_max(struct ptr_heap *heap, void *p);
-
-/**
- * bt_heap_copy - copy a heap
- * @dst: the destination heap (must be allocated)
- * @src: the source heap
- *
- * Returns -ENOMEM if out of memory.
- */
-extern int bt_heap_copy(struct ptr_heap *dst, struct ptr_heap *src);
-
-#endif /* BABELTRACE_COMMON_PRIO_HEAP_H */
index a78d7a61af83f37bb7f5b4c96c0035b568401908..ab3d6bc875de3514ac5fa2fb4b8e2548f38cece4 100644 (file)
@@ -13,7 +13,7 @@ namespace internal {
 
 template <typename T>
 using EnableIfIsWiseEnum =
-    typename std::enable_if<wise_enum::is_wise_enum<T>::value, const char *>::type;
+    typename std::enable_if<wise_enum::is_wise_enum<T>::value, wise_enum::string_type>::type;
 
 } /* namespace internal */
 
index a1fc583f83a26aba272f652efab5fb0657f29ea3..2aa22040bcf107d3516969f5121bf6bf27ab8f87 100644 (file)
@@ -275,10 +275,10 @@ public:
      */
     template <Level LevelV, bool AppendCauseV, typename... ArgTs>
     void log(const char * const fileName, const char * const funcName, const unsigned int lineNo,
-             const char * const fmt, ArgTs&&...args) const
+             fmt::format_string<ArgTs...> fmt, ArgTs&&...args) const
     {
-        this->_log<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {}, "", fmt,
-                                                        std::forward<ArgTs>(args)...);
+        this->_log<_StdLogWriter, LevelV, AppendCauseV>(
+            fileName, funcName, lineNo, {}, "", std::move(fmt), std::forward<ArgTs>(args)...);
     }
 
     /*
@@ -287,10 +287,10 @@ public:
      */
     template <bool AppendCauseV, typename ExcT, typename... ArgTs>
     [[noreturn]] void logErrorAndThrow(const char * const fileName, const char * const funcName,
-                                       const unsigned int lineNo, const char * const fmt,
+                                       const unsigned int lineNo, fmt::format_string<ArgTs...> fmt,
                                        ArgTs&&...args) const
     {
-        this->log<Level::Error, AppendCauseV>(fileName, funcName, lineNo, fmt,
+        this->log<Level::Error, AppendCauseV>(fileName, funcName, lineNo, std::move(fmt),
                                               std::forward<ArgTs>(args)...);
         throw ExcT {};
     }
@@ -300,10 +300,10 @@ public:
      */
     template <bool AppendCauseV, typename... ArgTs>
     [[noreturn]] void logErrorAndRethrow(const char * const fileName, const char * const funcName,
-                                         const unsigned int lineNo, const char * const fmt,
-                                         ArgTs&&...args) const
+                                         const unsigned int lineNo,
+                                         fmt::format_string<ArgTs...> fmt, ArgTs&&...args) const
     {
-        this->log<Level::Error, AppendCauseV>(fileName, funcName, lineNo, fmt,
+        this->log<Level::Error, AppendCauseV>(fileName, funcName, lineNo, std::move(fmt),
                                               std::forward<ArgTs>(args)...);
         throw;
     }
@@ -333,12 +333,12 @@ public:
      */
     template <Level LevelV, bool AppendCauseV, typename... ArgTs>
     void logErrno(const char * const fileName, const char * const funcName,
-                  const unsigned int lineNo, const char * const initMsg, const char * const fmt,
-                  ArgTs&&...args) const
+                  const unsigned int lineNo, const char * const initMsg,
+                  fmt::format_string<ArgTs...> fmt, ArgTs&&...args) const
     {
-        this->_log<_InitMsgLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {},
-                                                            this->_errnoIntroStr(initMsg).c_str(),
-                                                            fmt, std::forward<ArgTs>(args)...);
+        this->_log<_InitMsgLogWriter, LevelV, AppendCauseV>(
+            fileName, funcName, lineNo, {}, this->_errnoIntroStr(initMsg).c_str(), std::move(fmt),
+            std::forward<ArgTs>(args)...);
     }
 
     /*
@@ -348,11 +348,11 @@ public:
     template <bool AppendCauseV, typename ExcT, typename... ArgTs>
     [[noreturn]] void logErrorErrnoAndThrow(const char * const fileName,
                                             const char * const funcName, const unsigned int lineNo,
-                                            const char * const initMsg, const char * const fmt,
-                                            ArgTs&&...args) const
+                                            const char * const initMsg,
+                                            fmt::format_string<ArgTs...> fmt, ArgTs&&...args) const
     {
-        this->logErrno<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg, fmt,
-                                                   std::forward<ArgTs>(args)...);
+        this->logErrno<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg,
+                                                   std::move(fmt), std::forward<ArgTs>(args)...);
         throw ExcT {};
     }
 
@@ -360,13 +360,13 @@ public:
      * Like logErrno() with the `Level::Error` level, but also rethrows.
      */
     template <bool AppendCauseV, typename... ArgTs>
-    [[noreturn]] void logErrorErrnoAndRethrow(const char * const fileName,
-                                              const char * const funcName,
-                                              const unsigned int lineNo, const char * const initMsg,
-                                              const char * const fmt, ArgTs&&...args) const
+    [[noreturn]] void
+    logErrorErrnoAndRethrow(const char * const fileName, const char * const funcName,
+                            const unsigned int lineNo, const char * const initMsg,
+                            fmt::format_string<ArgTs...> fmt, ArgTs&&...args) const
     {
-        this->logErrno<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg, fmt,
-                                                   std::forward<ArgTs>(args)...);
+        this->logErrno<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg,
+                                                   std::move(fmt), std::forward<ArgTs>(args)...);
         throw;
     }
 
@@ -391,10 +391,10 @@ public:
      */
     template <Level LevelV, typename... ArgTs>
     void logMem(const char * const fileName, const char * const funcName, const unsigned int lineNo,
-                const MemData memData, const char * const fmt, ArgTs&&...args) const
+                const MemData memData, fmt::format_string<ArgTs...> fmt, ArgTs&&...args) const
     {
-        this->_log<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, "", fmt,
-                                                 std::forward<ArgTs>(args)...);
+        this->_log<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, "",
+                                                 std::move(fmt), std::forward<ArgTs>(args)...);
     }
 
 private:
@@ -411,7 +411,7 @@ private:
      */
     template <typename LogWriterT, Level LevelV, bool AppendCauseV, typename... ArgTs>
     void _log(const char * const fileName, const char * const funcName, const unsigned int lineNo,
-              const MemData memData, const char * const initMsg, const char * const fmt,
+              const MemData memData, const char * const initMsg, fmt::format_string<ArgTs...> fmt,
               ArgTs&&...args) const
     {
         const auto wouldLog = this->wouldLog(LevelV);
@@ -423,8 +423,7 @@ private:
              * append a null character).
              */
             _mBuf.clear();
-            BT_ASSERT(fmt);
-            fmt::format_to(std::back_inserter(_mBuf), fmt, std::forward<ArgTs>(args)...);
+            fmt::format_to(std::back_inserter(_mBuf), std::move(fmt), std::forward<ArgTs>(args)...);
             _mBuf.push_back('\0');
         }
 
index 3d2d86a427f48c55d108b45302ac45789fe9bc15..9a7182f5b0b2c4e93b5307c2f2d667eb6ea51bc7 100644 (file)
@@ -1870,7 +1870,7 @@ using span_lite::byte_span;
 
 #endif // span_FEATURE( BYTE_SPAN )
 
-#if span_HAVE( STRUCT_BINDING )
+#if !span_USES_STD_SPAN && span_HAVE( STRUCT_BINDING )
 
 #if   span_CPP14_OR_GREATER
 # include <tuple>
@@ -1938,7 +1938,7 @@ span_constexpr ElementType const & get( nonstd::span<ElementType, Extent> const
 
 } // end namespace std
 
-#endif // span_HAVE( STRUCT_BINDING )
+#endif // !span_USES_STD_SPAN && span_HAVE( STRUCT_BINDING )
 
 #if ! span_USES_STD_SPAN
 span_RESTORE_WARNINGS()
index a22e000f0ee3f56ca0b6140e1446768c5cc29600..6d98a0ce5e0dc38d87949f20e6559c27000dd01b 100644 (file)
@@ -497,8 +497,8 @@ static inline void format_trace(char **buf_ch, bool extended,
 {
        char tmp_prefix[TMP_PREFIX_LEN];
 
-       if (trace->name.value) {
-               BUF_APPEND(", %sname=\"%s\"", PRFIELD(trace->name.value));
+       if (trace->name) {
+               BUF_APPEND(", %sname=\"%s\"", PRFIELD(trace->name));
        }
 
        if (!extended) {
@@ -534,9 +534,9 @@ static inline void format_stream_class(char **buf_ch, bool extended,
 
        BUF_APPEND(", %sid=%" PRIu64, PRFIELD(stream_class->id));
 
-       if (stream_class->name.value) {
+       if (stream_class->name) {
                BUF_APPEND(", %sname=\"%s\"",
-                       PRFIELD(stream_class->name.value));
+                       PRFIELD(stream_class->name));
        }
 
        if (!extended) {
@@ -593,9 +593,9 @@ static inline void format_event_class(char **buf_ch, bool extended,
 
        BUF_APPEND(", %sid=%" PRIu64, PRFIELD(event_class->id));
 
-       if (event_class->name.value) {
+       if (event_class->name) {
                BUF_APPEND(", %sname=\"%s\"",
-                       PRFIELD(event_class->name.value));
+                       PRFIELD(event_class->name));
        }
 
        if (!extended) {
@@ -610,9 +610,9 @@ static inline void format_event_class(char **buf_ch, bool extended,
                                (int) event_class->log_level.value)));
        }
 
-       if (event_class->emf_uri.value) {
+       if (event_class->emf_uri) {
                BUF_APPEND(", %semf-uri=\"%s\"",
-                       PRFIELD(event_class->emf_uri.value));
+                       PRFIELD(event_class->emf_uri));
        }
 
        BUF_APPEND(", %sspecific-context-fc-addr=%p, %spayload-fc-addr=%p",
@@ -649,8 +649,8 @@ static inline void format_stream(char **buf_ch, bool extended,
 
        BUF_APPEND(", %sid=%" PRIu64, PRFIELD(stream->id));
 
-       if (stream->name.value) {
-               BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream->name.value));
+       if (stream->name) {
+               BUF_APPEND(", %sname=\"%s\"", PRFIELD(stream->name));
        }
 
        if (!extended) {
@@ -777,8 +777,8 @@ static inline void format_clock_class(char **buf_ch, bool extended,
 {
        char tmp_prefix[TMP_PREFIX_LEN];
 
-       if (clock_class->name.value) {
-               BUF_APPEND(", %sname=\"%s\"", PRFIELD(clock_class->name.value));
+       if (clock_class->name) {
+               BUF_APPEND(", %sname=\"%s\"", PRFIELD(clock_class->name));
        }
 
        BUF_APPEND(", %sfreq=%" PRIu64, PRFIELD(clock_class->frequency));
@@ -787,9 +787,9 @@ static inline void format_clock_class(char **buf_ch, bool extended,
                return;
        }
 
-       if (clock_class->description.value) {
+       if (clock_class->description) {
                BUF_APPEND(", %spartial-descr=\"%.32s\"",
-                       PRFIELD(clock_class->description.value));
+                       PRFIELD(clock_class->description));
        }
 
        if (clock_class->uuid.value) {
index 10030155b5c1ece5ad791f803bfae618c0d13f99..886501ec3b0944888cdea1ea5ce769bd965cf312 100644 (file)
@@ -35,18 +35,8 @@ void destroy_clock_class(struct bt_object *obj)
        BT_LIB_LOGD("Destroying clock class: %!+K", clock_class);
        BT_OBJECT_PUT_REF_AND_RESET(clock_class->user_attributes);
 
-       if (clock_class->name.str) {
-               g_string_free(clock_class->name.str, TRUE);
-               clock_class->name.str = NULL;
-               clock_class->name.value = NULL;
-       }
-
-       if (clock_class->description.str) {
-               g_string_free(clock_class->description.str, TRUE);
-               clock_class->description.str = NULL;
-               clock_class->description.value = NULL;
-       }
-
+       g_free(clock_class->name);
+       g_free(clock_class->description);
        bt_object_pool_finalize(&clock_class->cs_pool);
        g_free(clock_class);
 }
@@ -91,18 +81,6 @@ struct bt_clock_class *bt_clock_class_create(bt_self_component *self_comp)
                goto error;
        }
 
-       clock_class->name.str = g_string_new(NULL);
-       if (!clock_class->name.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
-               goto error;
-       }
-
-       clock_class->description.str = g_string_new(NULL);
-       if (!clock_class->description.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
-               goto error;
-       }
-
        clock_class->frequency = UINT64_C(1000000000);
        clock_class->origin_is_unix_epoch = BT_TRUE;
        set_base_offset(clock_class);
@@ -132,7 +110,7 @@ BT_EXPORT
 const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class)
 {
        BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class);
-       return clock_class->name.value;
+       return clock_class->name;
 }
 
 BT_EXPORT
@@ -143,8 +121,8 @@ enum bt_clock_class_set_name_status bt_clock_class_set_name(
        BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class);
        BT_ASSERT_PRE_NAME_NON_NULL(name);
        BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
-       g_string_assign(clock_class->name.str, name);
-       clock_class->name.value = clock_class->name.str->str;
+       g_free(clock_class->name);
+       clock_class->name = g_strdup(name);
        BT_LIB_LOGD("Set clock class's name: %!+K", clock_class);
        return BT_FUNC_STATUS_OK;
 }
@@ -154,7 +132,7 @@ const char *bt_clock_class_get_description(
                const struct bt_clock_class *clock_class)
 {
        BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class);
-       return clock_class->description.value;
+       return clock_class->description;
 }
 
 BT_EXPORT
@@ -165,8 +143,8 @@ enum bt_clock_class_set_description_status bt_clock_class_set_description(
        BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class);
        BT_ASSERT_PRE_DESCR_NON_NULL(descr);
        BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
-       g_string_assign(clock_class->description.str, descr);
-       clock_class->description.value = clock_class->description.str->str;
+       g_free(clock_class->description);
+       clock_class->description = g_strdup(descr);
        BT_LIB_LOGD("Set clock class's description: %!+K",
                clock_class);
        return BT_FUNC_STATUS_OK;
index e2e90412c797f53e01cb5f279a8ac2f83b673b21..54eeb0c85de21bd8d2398b9c99d5b1314aaa4688 100644 (file)
@@ -27,19 +27,8 @@ struct bt_clock_class {
        /* Owned by this */
        struct bt_value *user_attributes;
 
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } name;
-
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } description;
+       gchar *name;
+       gchar *description;
 
        uint64_t frequency;
        uint64_t precision;
index 0d90717561ca9727a5eddcce141450de73edc87b..76ad226bf2b532425c2d8b2a372cf360c9a43dea 100644 (file)
@@ -41,16 +41,8 @@ void destroy_event_class(struct bt_object *obj)
        BT_LIB_LOGD("Destroying event class: %!+E", event_class);
        BT_OBJECT_PUT_REF_AND_RESET(event_class->user_attributes);
 
-       if (event_class->name.str) {
-               g_string_free(event_class->name.str, TRUE);
-               event_class->name.str = NULL;
-       }
-
-       if (event_class->emf_uri.str) {
-               g_string_free(event_class->emf_uri.str, TRUE);
-               event_class->emf_uri.str = NULL;
-       }
-
+       g_free(event_class->name);
+       g_free(event_class->emf_uri);
        BT_LOGD_STR("Putting context field class.");
        BT_OBJECT_PUT_REF_AND_RESET(event_class->specific_context_fc);
        BT_LOGD_STR("Putting payload field class.");
@@ -119,17 +111,6 @@ struct bt_event_class *create_event_class_with_id(
        event_class->id = id;
        bt_property_uint_init(&event_class->log_level,
                        BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE, 0);
-       event_class->name.str = g_string_new(NULL);
-       if (!event_class->name.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
-               goto error;
-       }
-
-       event_class->emf_uri.str = g_string_new(NULL);
-       if (!event_class->emf_uri.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
-               goto error;
-       }
 
        ret = bt_object_pool_initialize(&event_class->event_pool,
                (bt_object_pool_new_object_func) bt_event_new,
@@ -187,7 +168,7 @@ BT_EXPORT
 const char *bt_event_class_get_name(const struct bt_event_class *event_class)
 {
        BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class);
-       return event_class->name.value;
+       return event_class->name;
 }
 
 BT_EXPORT
@@ -198,8 +179,8 @@ enum bt_event_class_set_name_status bt_event_class_set_name(
        BT_ASSERT_PRE_EC_NON_NULL(event_class);
        BT_ASSERT_PRE_NAME_NON_NULL(name);
        BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
-       g_string_assign(event_class->name.str, name);
-       event_class->name.value = event_class->name.str->str;
+       g_free(event_class->name);
+       event_class->name = g_strdup(name);
        BT_LIB_LOGD("Set event class's name: %!+E", event_class);
        return BT_FUNC_STATUS_OK;
 }
@@ -240,7 +221,7 @@ BT_EXPORT
 const char *bt_event_class_get_emf_uri(const struct bt_event_class *event_class)
 {
        BT_ASSERT_PRE_DEV_EC_NON_NULL(event_class);
-       return event_class->emf_uri.value;
+       return event_class->emf_uri;
 }
 
 BT_EXPORT
@@ -252,8 +233,8 @@ enum bt_event_class_set_emf_uri_status bt_event_class_set_emf_uri(
        BT_ASSERT_PRE_EC_NON_NULL(event_class);
        BT_ASSERT_PRE_NON_NULL("emf-uri", emf_uri, "EMF URI");
        BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
-       g_string_assign(event_class->emf_uri.str, emf_uri);
-       event_class->emf_uri.value = event_class->emf_uri.str->str;
+       g_free(event_class->emf_uri);
+       event_class->emf_uri = g_strdup(emf_uri);
        BT_LIB_LOGD("Set event class's EMF URI: %!+E", event_class);
        return BT_FUNC_STATUS_OK;
 }
index 67d93695e84711c271c1a5fd012396fb8651ca19..ccbc0009778c90a0baa0255d81c9a8fec9dc480f 100644 (file)
@@ -29,22 +29,12 @@ struct bt_event_class {
        /* Owned by this */
        struct bt_value *user_attributes;
 
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } name;
+       gchar *name;
 
        uint64_t id;
        struct bt_property_uint log_level;
 
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } emf_uri;
+       gchar *emf_uri;
 
        /* Pool of `struct bt_event *` */
        struct bt_object_pool event_pool;
index 08395849b03c9331fde5cfe8b7422d00ccb6f077..c997086101cee2a48707d976beb8fd4ff9d6be4e 100644 (file)
@@ -47,12 +47,7 @@ void destroy_stream_class(struct bt_object *obj)
                stream_class->event_classes = NULL;
        }
 
-       if (stream_class->name.str) {
-               g_string_free(stream_class->name.str, TRUE);
-               stream_class->name.str = NULL;
-               stream_class->name.value = NULL;
-       }
-
+       g_free(stream_class->name);
        BT_LOGD_STR("Putting packet context field class.");
        BT_OBJECT_PUT_REF_AND_RESET(stream_class->packet_context_fc);
        BT_LOGD_STR("Putting event common context field class.");
@@ -117,12 +112,6 @@ struct bt_stream_class *create_stream_class_with_id(
                goto error;
        }
 
-       stream_class->name.str = g_string_new(NULL);
-       if (!stream_class->name.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
-               goto error;
-       }
-
        stream_class->id = id;
        stream_class->assigns_automatic_event_class_id = true;
        stream_class->assigns_automatic_stream_id = true;
@@ -203,7 +192,7 @@ BT_EXPORT
 const char *bt_stream_class_get_name(const struct bt_stream_class *stream_class)
 {
        BT_ASSERT_PRE_DEV_SC_NON_NULL(stream_class);
-       return stream_class->name.value;
+       return stream_class->name;
 }
 
 BT_EXPORT
@@ -215,8 +204,8 @@ enum bt_stream_class_set_name_status bt_stream_class_set_name(
        BT_ASSERT_PRE_SC_NON_NULL(stream_class);
        BT_ASSERT_PRE_NAME_NON_NULL(name);
        BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
-       g_string_assign(stream_class->name.str, name);
-       stream_class->name.value = stream_class->name.str->str;
+       g_free(stream_class->name);
+       stream_class->name = g_strdup(name);
        BT_LIB_LOGD("Set stream class's name: %!+S", stream_class);
        return BT_FUNC_STATUS_OK;
 }
index 771a5899197d22161e0098f7f95b4e4de05f25c5..a1d9ab60e073cb49e885874d3ae25dbbc6599ec5 100644 (file)
@@ -23,12 +23,7 @@ struct bt_stream_class {
        /* Owned by this */
        struct bt_value *user_attributes;
 
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } name;
+       gchar *name;
 
        uint64_t id;
        bool assigns_automatic_event_class_id;
index 7cb124f425bfe5661436d94a38169952e582f297..471623e8c0412bcabb03c96b1e5d13fca08af51e 100644 (file)
@@ -37,12 +37,7 @@ void destroy_stream(struct bt_object *obj)
        BT_LIB_LOGD("Destroying stream object: %!+s", stream);
        BT_OBJECT_PUT_REF_AND_RESET(stream->user_attributes);
 
-       if (stream->name.str) {
-               g_string_free(stream->name.str, TRUE);
-               stream->name.str = NULL;
-               stream->name.value = NULL;
-       }
-
+       g_free(stream->name);
        BT_LOGD_STR("Putting stream's class.");
        bt_object_put_ref(stream->class);
        bt_object_pool_finalize(&stream->packet_pool);
@@ -114,12 +109,6 @@ struct bt_stream *create_stream_with_id(struct bt_stream_class *stream_class,
                goto error;
        }
 
-       stream->name.str = g_string_new(NULL);
-       if (!stream->name.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GString.");
-               goto error;
-       }
-
        stream->id = id;
        ret = bt_object_pool_initialize(&stream->packet_pool,
                (bt_object_pool_new_object_func) bt_packet_new,
@@ -211,7 +200,7 @@ BT_EXPORT
 const char *bt_stream_get_name(const struct bt_stream *stream)
 {
        BT_ASSERT_PRE_DEV_STREAM_NON_NULL(stream);
-       return stream->name.value;
+       return stream->name;
 }
 
 BT_EXPORT
@@ -222,8 +211,8 @@ enum bt_stream_set_name_status bt_stream_set_name(struct bt_stream *stream,
        BT_ASSERT_PRE_STREAM_NON_NULL(stream);
        BT_ASSERT_PRE_NAME_NON_NULL(name);
        BT_ASSERT_PRE_DEV_STREAM_HOT(stream);
-       g_string_assign(stream->name.str, name);
-       stream->name.value = stream->name.str->str;
+       g_free(stream->name);
+       stream->name = g_strdup(name);
        BT_LIB_LOGD("Set stream's name: %!+s", stream);
        return BT_FUNC_STATUS_OK;
 }
index 89d7bf73afd47e3018e16d2290981f69f82abc10..89e236a65105317be427af36e25674d16a36892c 100644 (file)
@@ -26,12 +26,7 @@ struct bt_stream {
        /* Owned by this */
        struct bt_stream_class *class;
 
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } name;
+       gchar *name;
 
        uint64_t id;
 
index 8cc005a785530654984cd837d5e2a7e7107212c4..ef9581ee0e6d01f175eed5de0d45b01f6698ed48 100644 (file)
@@ -105,11 +105,7 @@ void destroy_trace(struct bt_object *obj)
                }
        }
 
-       if (trace->name.str) {
-               g_string_free(trace->name.str, TRUE);
-               trace->name.str = NULL;
-               trace->name.value = NULL;
-       }
+       g_free(trace->name);
 
        if (trace->environment) {
                BT_LOGD_STR("Destroying environment attributes.");
@@ -170,12 +166,6 @@ struct bt_trace *bt_trace_create(struct bt_trace_class *tc)
                goto error;
        }
 
-       trace->name.str = g_string_new(NULL);
-       if (!trace->name.str) {
-               BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one GString.");
-               goto error;
-       }
-
        trace->environment = bt_attributes_create();
        if (!trace->environment) {
                BT_LIB_LOGE_APPEND_CAUSE("Cannot create empty attributes object.");
@@ -205,7 +195,7 @@ BT_EXPORT
 const char *bt_trace_get_name(const struct bt_trace *trace)
 {
        BT_ASSERT_PRE_DEV_TRACE_NON_NULL(trace);
-       return trace->name.value;
+       return trace->name;
 }
 
 BT_EXPORT
@@ -216,8 +206,8 @@ enum bt_trace_set_name_status bt_trace_set_name(struct bt_trace *trace,
        BT_ASSERT_PRE_TRACE_NON_NULL(trace);
        BT_ASSERT_PRE_NAME_NON_NULL(name);
        BT_ASSERT_PRE_DEV_TRACE_HOT(trace);
-       g_string_assign(trace->name.str, name);
-       trace->name.value = trace->name.str->str;
+       g_free(trace->name);
+       trace->name = g_strdup(name);
        BT_LIB_LOGD("Set trace's name: %!+t", trace);
        return BT_FUNC_STATUS_OK;
 }
index 294e8943cd2ffb5933cb7a14888092e435f2b7a7..ed0df692f7bcb059fc8178407864536a2ba43bd0 100644 (file)
@@ -31,12 +31,7 @@ struct bt_trace {
        /* Owned by this */
        struct bt_trace_class *class;
 
-       struct {
-               GString *str;
-
-               /* NULL or `str->str` above */
-               const char *value;
-       } name;
+       gchar *name;
 
        struct {
                bt_uuid_t uuid;
index 0b700e91250458ba0df0c8d05522b5747356d753..4143f9c0888ffb6a2872189bfbc7fdf339e1cf15 100644 (file)
@@ -74,7 +74,7 @@ bt2::Value::Shared metadata_info_query(const bt2::ConstMapValue params, const bt
     ctf_metadata_decoder_up decoder = ctf_metadata_decoder_create(&decoder_cfg);
     if (!decoder) {
         BT_CPPLOGE_APPEND_CAUSE_AND_THROW_SPEC(
-            logger, bt2::Error, "Cannot create metadata decoder: path=\"{}}\".", path);
+            logger, bt2::Error, "Cannot create metadata decoder: path=\"{}\".", path);
     }
 
     rewind(metadataFp.get());
index df035d36509f6551ac6179fdbe9bc091fb353410..7c73aa2b9bc776ff58bea91c42edc3e5c3844214 100755 (executable)
@@ -21,13 +21,27 @@ data_dir=$BT_TESTS_DATADIR/plugins/src.ctf.fs/field
 test_pass() {
     local -r mp_path=$1
     local -r output_dir=$(mktemp -d)
+    local -r py_cmd=(
+        "$BT_TESTS_PYTHON_BIN" "$data_dir/data_from_mp.py"
+        "$mp_path" "$output_dir"
+    )
 
-    run_python "$BT_TESTS_PYTHON_BIN" "$data_dir/data_from_mp.py" "$mp_path" "$output_dir"
+    if ! bt_run_in_py_env "${py_cmd[@]}"; then
+        fail "Failed to run \`${py_cmd[*]}\`"
+        return 1
+    fi
 
     local -r res_path=$(mktemp)
-
-    bt_cli "$res_path" /dev/null --plugin-path="$data_dir" \
+    local -r cli_cmd=(
+        "$res_path" /dev/null --plugin-path="$data_dir"
         -c sink.test-text.single "$output_dir/trace"
+    )
+
+    if ! bt_cli "${cli_cmd[@]}"; then
+        fail "Failed to run \`bt_cli ${cli_cmd[*]}\`"
+        return 1
+    fi
+
     bt_diff "$res_path" "$output_dir/expect"
     ok $? "$mp_path"
     rm -rf "$output_dir" "$res_path"
index 692def5d7656d58e7b68e39b99481b038dbdf401..f3d4d94572482114443dd0f21dbbbb67bf78d18e 100644 (file)
@@ -239,6 +239,16 @@ bt_diff() {
        local -r expected_file=$1
        local -r actual_file=$2
 
+       if [[ ! -e $expected_file ]]; then
+               echo "ERROR: expected file \`$expected_file\` doesn't exist" >&2
+               return 1
+       fi
+
+       if [[ ! -e $actual_file ]]; then
+               echo "ERROR: actual file \`$actual_file\` doesn't exist" >&2
+               return 1
+       fi
+
        diff -u <(bt_remove_cr_inline "$expected_file") <(bt_remove_cr_inline "$actual_file") 1>&2
 }
 
This page took 0.050872 seconds and 4 git commands to generate.