lib: make public reference count functions have strict types
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 7 Dec 2018 22:33:41 +0000 (17:33 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
Instead of having generic bt_object_get_ref() and bt_object_put_ref()
accepting `const void *`, have one pair of such functions for each
shared object API.

This can help catch reference count bugs (not putting or getting the
correct object type) and makes it illegal at build time to get or put a
unique object's reference.

Each shared object API also has its own BT_X_PUT_REF_AND_RESET() and
BT_X_MOVE_REF() macros.

bt_object_get_ref() and bt_object_put_ref() are now internal and only
used by the library's implementation.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
116 files changed:
cli/babeltrace-cfg-cli-args-connect.c
cli/babeltrace-cfg-cli-args-default.c
cli/babeltrace-cfg-cli-args.c
cli/babeltrace-cfg-cli-args.h
cli/babeltrace-cfg.h
cli/babeltrace.c
include/Makefile.am
include/babeltrace/assert-pre-internal.h
include/babeltrace/babeltrace.h
include/babeltrace/graph/component-class-const.h
include/babeltrace/graph/component-class-filter-const.h
include/babeltrace/graph/component-class-sink-const.h
include/babeltrace/graph/component-class-source-const.h
include/babeltrace/graph/component-const.h
include/babeltrace/graph/component-filter-const.h
include/babeltrace/graph/component-sink-const.h
include/babeltrace/graph/component-source-const.h
include/babeltrace/graph/connection-const.h
include/babeltrace/graph/const-notification.h [deleted file]
include/babeltrace/graph/graph-const.h
include/babeltrace/graph/notification-const.h
include/babeltrace/graph/port-const.h
include/babeltrace/graph/port-input-const.h
include/babeltrace/graph/port-output-const.h
include/babeltrace/graph/port-output-notification-iterator.h
include/babeltrace/graph/query-executor-const.h
include/babeltrace/graph/self-component-port-input-notification-iterator.h
include/babeltrace/object-internal.h
include/babeltrace/object.h [deleted file]
include/babeltrace/plugin/plugin-const.h
include/babeltrace/plugin/plugin-internal.h
include/babeltrace/plugin/plugin-set-const.h
include/babeltrace/trace-ir/clock-class-const.h
include/babeltrace/trace-ir/event-class-const.h
include/babeltrace/trace-ir/field-class-const.h
include/babeltrace/trace-ir/field-path-const.h
include/babeltrace/trace-ir/packet-const.h
include/babeltrace/trace-ir/stream-class-const.h
include/babeltrace/trace-ir/stream-const.h
include/babeltrace/trace-ir/trace-class-const.h
include/babeltrace/trace-ir/trace-const.h
include/babeltrace/value-const.h
lib/Makefile.am
lib/graph/component-class-sink-colander.c
lib/graph/component-class.c
lib/graph/component-filter.c
lib/graph/component-sink.c
lib/graph/component-source.c
lib/graph/component.c
lib/graph/connection.c
lib/graph/graph.c
lib/graph/iterator.c
lib/graph/notification/event.c
lib/graph/notification/inactivity.c
lib/graph/notification/notification.c
lib/graph/notification/packet.c
lib/graph/notification/stream.c
lib/graph/port.c
lib/graph/query-executor.c
lib/lib-logging.c
lib/object-pool.c
lib/object.c [deleted file]
lib/plugin/plugin-so.c
lib/plugin/plugin.c
lib/trace-ir/attributes.c
lib/trace-ir/clock-class.c
lib/trace-ir/clock-value.c
lib/trace-ir/event-class.c
lib/trace-ir/event.c
lib/trace-ir/field-class.c
lib/trace-ir/field-path.c
lib/trace-ir/field.c
lib/trace-ir/packet.c
lib/trace-ir/resolve-field-path.c
lib/trace-ir/stream-class.c
lib/trace-ir/stream.c
lib/trace-ir/trace-class.c
lib/trace-ir/trace.c
lib/trace-ir/utils.c
lib/value.c
plugins/ctf/common/bfcr/bfcr.c
plugins/ctf/common/metadata/ctf-meta-translate.c
plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c
plugins/ctf/common/metadata/ctf-meta.h
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/notif-iter/notif-iter.c
plugins/ctf/fs-sink/write.c
plugins/ctf/fs-sink/writer.c
plugins/ctf/fs-src/data-stream-file.c
plugins/ctf/fs-src/fs.c
plugins/ctf/fs-src/metadata.c
plugins/ctf/fs-src/query.c
plugins/ctf/lttng-live/lttng-live.c
plugins/ctf/lttng-live/metadata.c
plugins/ctf/lttng-live/viewer-connection.c
plugins/libctfcopytrace/clock-fields.c
plugins/libctfcopytrace/ctfcopytrace.c
plugins/lttng-utils/copy.c
plugins/lttng-utils/debug-info.c
plugins/lttng-utils/plugin.c
plugins/text/dmesg/dmesg.c
plugins/text/pretty/pretty.c
plugins/utils/counter/counter.c
plugins/utils/dummy/dummy.c
plugins/utils/muxer/muxer.c
plugins/utils/trimmer/copy.c
plugins/utils/trimmer/iterator.c
plugins/utils/trimmer/trimmer.c
python-plugin-provider/python-plugin-provider.c
tests/lib/test-plugin-plugins/sfs.c
tests/lib/test_bt_notification_iterator.c
tests/lib/test_bt_values.c
tests/lib/test_ctf_writer.c
tests/lib/test_graph_topo.c
tests/lib/test_plugin.c
tests/lib/test_trace_ir_ref.c

index e72ff30e9701715a7dfb7bf4db49ad17bc1ca15e..020fbdcc137e3f4b7a98252bd3409eeef992e791 100644 (file)
@@ -584,7 +584,7 @@ static int validate_all_components_connected(struct bt_config *cfg,
        }
 
 end:
-       bt_object_put_ref(connected_components);
+       bt_value_put_ref(connected_components);
        return ret;
 }
 
@@ -635,7 +635,7 @@ static int validate_no_duplicate_connection(struct bt_config *cfg,
        }
 
 end:
-       bt_object_put_ref(flat_connection_names);
+       bt_value_put_ref(flat_connection_names);
 
        if (flat_connection_name) {
                g_string_free(flat_connection_name, TRUE);
index d0bfe1e59f557758c3087e52dd24a0649c4699a7..27eae102dd11b6411b954750cab60956ee6efb97 100644 (file)
@@ -61,7 +61,7 @@ error:
        BT_OBJECT_PUT_REF_AND_RESET(cfg);
 
 end:
-       bt_object_put_ref(initial_plugin_paths);
+       bt_value_put_ref(initial_plugin_paths);
        return cfg;
 }
 
index 6130947b7cb02c5f2edbc6683a9e9a74ac033434..d881e75c6160633d61598efaa3614e7912d20351 100644 (file)
@@ -417,7 +417,7 @@ success:
        }
 
 end:
-       BT_OBJECT_PUT_REF_AND_RESET(value);
+       BT_VALUE_PUT_REF_AND_RESET(value);
        return ret;
 }
 
@@ -535,7 +535,7 @@ struct bt_value *bt_value_from_ini(const char *arg,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(state.params);
+       BT_VALUE_PUT_REF_AND_RESET(state.params);
 
 end:
        if (state.scanner) {
@@ -759,7 +759,7 @@ void bt_config_component_destroy(struct bt_object *obj)
                g_string_free(bt_config_component->instance_name, TRUE);
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(bt_config_component->params);
+       BT_VALUE_PUT_REF_AND_RESET(bt_config_component->params);
        g_free(bt_config_component);
 
 end:
@@ -875,7 +875,7 @@ void bt_config_destroy(struct bt_object *obj)
                goto end;
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(cfg->plugin_paths);
+       BT_VALUE_PUT_REF_AND_RESET(cfg->plugin_paths);
 
        switch (cfg->command) {
        case BT_CONFIG_COMMAND_RUN:
@@ -1104,7 +1104,7 @@ end:
        return names;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(names);
+       BT_VALUE_PUT_REF_AND_RESET(names);
        if (scanner) {
                g_scanner_destroy(scanner);
        }
@@ -1177,7 +1177,7 @@ struct bt_value *fields_from_arg(const char *arg)
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(fields);
+       BT_VALUE_PUT_REF_AND_RESET(fields);
 
 end:
        if (scanner) {
@@ -2036,7 +2036,7 @@ struct bt_config *bt_config_query_from_args(int argc, const char *argv[],
                        break;
                case OPT_PARAMS:
                {
-                       bt_object_put_ref(params);
+                       bt_value_put_ref(params);
                        params = bt_value_from_arg(arg);
                        if (!params) {
                                printf_err("Invalid format for --params option's argument:\n    %s\n",
@@ -2127,7 +2127,7 @@ end:
                poptFreeContext(pc);
        }
 
-       bt_object_put_ref(params);
+       bt_value_put_ref(params);
        free(arg);
        return cfg;
 }
@@ -2503,7 +2503,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                        }
 
                        BT_ASSERT(cur_base_params);
-                       bt_object_put_ref(cur_cfg_comp->params);
+                       bt_value_put_ref(cur_cfg_comp->params);
                        status = bt_value_copy(cur_base_params,
                                &cur_cfg_comp->params);
                        if (status != BT_VALUE_STATUS_OK) {
@@ -2534,7 +2534,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
 
                        status = bt_value_map_extend(cur_cfg_comp->params,
                                params, &params_to_set);
-                       BT_OBJECT_PUT_REF_AND_RESET(params);
+                       BT_VALUE_PUT_REF_AND_RESET(params);
                        if (status != BT_VALUE_STATUS_OK) {
                                printf_err("Cannot extend current component parameters with --params option's argument:\n    %s\n",
                                        arg);
@@ -2595,7 +2595,7 @@ struct bt_config *bt_config_run_from_args(int argc, const char *argv[],
                        break;
                }
                case OPT_RESET_BASE_PARAMS:
-                       BT_OBJECT_PUT_REF_AND_RESET(cur_base_params);
+                       BT_VALUE_PUT_REF_AND_RESET(cur_base_params);
                        cur_base_params = bt_value_map_create();
                        if (!cur_base_params) {
                                print_err_oom();
@@ -2696,9 +2696,9 @@ end:
 
        free(arg);
        BT_OBJECT_PUT_REF_AND_RESET(cur_cfg_comp);
-       BT_OBJECT_PUT_REF_AND_RESET(cur_base_params);
-       BT_OBJECT_PUT_REF_AND_RESET(instance_names);
-       BT_OBJECT_PUT_REF_AND_RESET(connection_args);
+       BT_VALUE_PUT_REF_AND_RESET(cur_base_params);
+       BT_VALUE_PUT_REF_AND_RESET(instance_names);
+       BT_VALUE_PUT_REF_AND_RESET(connection_args);
        return cfg;
 }
 
@@ -3092,7 +3092,7 @@ void finalize_implicit_component_args(struct implicit_component_args *args)
                g_string_free(args->params_arg, TRUE);
        }
 
-       bt_object_put_ref(args->extra_params);
+       bt_value_put_ref(args->extra_params);
 }
 
 static
@@ -3541,7 +3541,7 @@ int fill_implicit_ctf_inputs_args(GPtrArray *implicit_ctf_inputs_args,
                 * We need our own copy of the extra parameters because
                 * this is where the unique path goes.
                 */
-               BT_OBJECT_PUT_REF_AND_RESET(impl_args->extra_params);
+               BT_VALUE_PUT_REF_AND_RESET(impl_args->extra_params);
                status = bt_value_copy(base_implicit_ctf_input_args->extra_params,
                        &impl_args->extra_params);
                if (status != BT_VALUE_STATUS_OK) {
@@ -4164,7 +4164,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        ret = insert_flat_params_from_array(
                                implicit_text_args.params_arg,
                                fields, "field");
-                       bt_object_put_ref(fields);
+                       bt_value_put_ref(fields);
                        if (ret) {
                                goto error;
                        }
@@ -4182,7 +4182,7 @@ struct bt_config *bt_config_convert_from_args(int argc, const char *argv[],
                        ret = insert_flat_params_from_array(
                                implicit_text_args.params_arg,
                                names, "name");
-                       bt_object_put_ref(names);
+                       bt_value_put_ref(names);
                        if (ret) {
                                goto error;
                        }
@@ -4748,8 +4748,8 @@ end:
                g_ptr_array_free(implicit_ctf_inputs_args, TRUE);
        }
 
-       bt_object_put_ref(run_args);
-       bt_object_put_ref(all_names);
+       bt_value_put_ref(run_args);
+       bt_value_put_ref(all_names);
        destroy_glist_of_gstring(source_names);
        destroy_glist_of_gstring(filter_names);
        destroy_glist_of_gstring(sink_names);
@@ -4762,7 +4762,7 @@ end:
        finalize_implicit_component_args(&implicit_debug_info_args);
        finalize_implicit_component_args(&implicit_muxer_args);
        finalize_implicit_component_args(&implicit_trimmer_args);
-       bt_object_put_ref(plugin_paths);
+       bt_value_put_ref(plugin_paths);
        bt_common_destroy_lttng_live_url_parts(&lttng_live_url_parts);
        return cfg;
 }
@@ -4857,7 +4857,7 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
                        goto end;
                }
        } else {
-               bt_object_get_ref(initial_plugin_paths);
+               bt_value_get_ref(initial_plugin_paths);
        }
 
        if (argc <= 1) {
@@ -5019,6 +5019,6 @@ struct bt_config *bt_config_cli_args_create(int argc, const char *argv[],
        }
 
 end:
-       bt_object_put_ref(initial_plugin_paths);
+       bt_value_put_ref(initial_plugin_paths);
        return config;
 }
index fd2227249849565d9fe1c70d5ed6ae11a1bf7f8d..ff9a329126e7ebeb312a913965144998551420f4 100644 (file)
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <babeltrace/value.h>
-#include <babeltrace/object.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/graph/component-class.h>
index e7e98372a460664625b99fe78b689161b1e945bf..e8796652514a35d218ce9e6bce828efd6790d3a7 100644 (file)
@@ -29,7 +29,6 @@
 #include <stdint.h>
 #include <stdbool.h>
 #include <babeltrace/value.h>
-#include <babeltrace/object.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/graph/component-class.h>
index 537ab44da224818b850d69cf9778dd50595ea2a5..3dc37e19723a73dcb1b5962cc890fe244a98793d 100644 (file)
@@ -165,7 +165,7 @@ int create_the_query_executor(void)
 static
 void destroy_the_query_executor(void)
 {
-       BT_OBJECT_PUT_REF_AND_RESET(the_query_executor);
+       BT_QUERY_EXECUTOR_PUT_REF_AND_RESET(the_query_executor);
 }
 
 static
@@ -256,7 +256,7 @@ error:
 
 end:
        destroy_the_query_executor();
-       bt_object_put_ref(result);
+       bt_value_put_ref(result);
        return ret;
 }
 
@@ -287,7 +287,7 @@ const struct bt_plugin *find_plugin(const char *name)
                }
        }
 
-       bt_object_get_ref(plugin);
+       bt_plugin_get_ref(plugin);
        return plugin;
 }
 
@@ -312,7 +312,7 @@ const void *find_component_class_from_plugin(const char *plugin_name,
 
        comp_class = plugin_borrow_comp_cls_func(plugin, comp_class_name);
        bt_object_get_ref(comp_class);
-       BT_OBJECT_PUT_REF_AND_RESET(plugin);
+       BT_PLUGIN_PUT_REF_AND_RESET(plugin);
 
 end:
        if (BT_LOG_ON_DEBUG) {
@@ -777,12 +777,12 @@ void add_to_loaded_plugins(const struct bt_plugin_set *plugin_set)
                                bt_plugin_get_name(plugin),
                                bt_plugin_get_path(plugin),
                                bt_plugin_get_path(loaded_plugin));
-                       bt_object_put_ref(loaded_plugin);
+                       bt_plugin_put_ref(loaded_plugin);
                } else {
                        /* Add to global array. */
                        BT_LOGD("Adding plugin to loaded plugins: plugin-path=\"%s\"",
                                bt_plugin_get_name(plugin));
-                       bt_object_get_ref(plugin);
+                       bt_plugin_get_ref(plugin);
                        g_ptr_array_add(loaded_plugins, (void *) plugin);
                }
        }
@@ -831,7 +831,7 @@ int load_dynamic_plugins(const struct bt_value *plugin_paths)
                }
 
                add_to_loaded_plugins(plugin_set);
-               bt_object_put_ref(plugin_set);
+               bt_plugin_set_put_ref(plugin_set);
        }
 end:
        return ret;
@@ -852,7 +852,7 @@ int load_static_plugins(void)
        }
 
        add_to_loaded_plugins(plugin_set);
-       bt_object_put_ref(plugin_set);
+       bt_plugin_set_put_ref(plugin_set);
 end:
        return ret;
 }
@@ -995,8 +995,8 @@ failed:
        ret = -1;
 
 end:
-       bt_object_put_ref(comp_cls);
-       bt_object_put_ref(results);
+       bt_component_class_put_ref(comp_cls);
+       bt_value_put_ref(results);
        return ret;
 }
 
@@ -1092,8 +1092,8 @@ int cmd_help(struct bt_config *cfg)
                needed_comp_cls);
 
 end:
-       bt_object_put_ref(needed_comp_cls);
-       bt_object_put_ref(plugin);
+       bt_component_class_put_ref(needed_comp_cls);
+       bt_plugin_put_ref(plugin);
        return ret;
 }
 
@@ -1343,9 +1343,9 @@ error:
        ret = -1;
 
 end:
-       bt_object_put_ref(results);
-       bt_object_put_ref(params);
-       bt_object_put_ref(comp_cls);
+       bt_value_put_ref(results);
+       bt_value_put_ref(params);
+       bt_component_class_put_ref(comp_cls);
 
        if (out_stream && out_stream != stdout) {
                int fclose_ret = fclose(out_stream);
@@ -1455,9 +1455,9 @@ failed:
                bt_common_color_reset());
 
 end:
-       bt_object_put_ref(results);
-       bt_object_put_ref(params);
-       bt_object_put_ref(comp_cls);
+       bt_value_put_ref(results);
+       bt_value_put_ref(params);
+       bt_component_class_put_ref(comp_cls);
 
        if (out_stream && out_stream != stdout) {
                int fclose_ret = fclose(out_stream);
@@ -1902,9 +1902,9 @@ error:
 end:
        free(intersection_begin);
        free(intersection_end);
-       BT_OBJECT_PUT_REF_AND_RESET(trimmer_params);
-       BT_OBJECT_PUT_REF_AND_RESET(trimmer_class);
-       BT_OBJECT_PUT_REF_AND_RESET(trimmer);
+       BT_VALUE_PUT_REF_AND_RESET(trimmer_params);
+       BT_COMPONENT_CLASS_FILTER_PUT_REF_AND_RESET(trimmer_class);
+       BT_COMPONENT_FILTER_PUT_REF_AND_RESET(trimmer);
        return ret;
 }
 
@@ -2067,7 +2067,7 @@ void cmd_run_ctx_destroy(struct cmd_run_ctx *ctx)
                ctx->intersections = NULL;
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(ctx->graph);
+       BT_GRAPH_PUT_REF_AND_RESET(ctx->graph);
        the_graph = NULL;
        ctx->cfg = NULL;
 }
@@ -2370,8 +2370,8 @@ error:
                path ? path : "(unknown)",
                bt_common_color_reset());
 end:
-       bt_object_put_ref(query_params);
-       bt_object_put_ref(query_result);
+       bt_value_put_ref(query_params);
+       bt_value_put_ref(query_result);
        g_free(port_id);
        g_free(trace_range);
        return ret;
index fa75c7c359a6ca46a4713333053b11ff9b8ab958..09bfcf750fbf0d4028a76fe9333204bf29b34037 100644 (file)
@@ -73,7 +73,6 @@ babeltraceincludedir = "$(includedir)/babeltrace"
 babeltraceinclude_HEADERS = \
        babeltrace/babeltrace.h \
        babeltrace/logging.h \
-       babeltrace/object.h \
        babeltrace/property.h \
        babeltrace/types.h \
        babeltrace/value-const.h \
index e56d90ecc387b6e75854a357f5f095df42166d3c..3cb08b4ca23188fc758ee8da8cb9e6efdea0b909 100644 (file)
@@ -36,6 +36,7 @@
  * <babeltrace/assert-pre-internal.h>, you also need to use logging
  * explicitly.
  */
+
 #ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H
 # error Include <babeltrace/lib-logging-internal.h> before this header.
 #endif
index a1fb21d92313a495b2180af06da66e788e69f029..0d3499951a0cfb7504d434134eea65e945459992 100644 (file)
@@ -27,7 +27,6 @@
 
 /* Core API */
 #include <babeltrace/logging.h>
-#include <babeltrace/object.h>
 #include <babeltrace/property.h>
 #include <babeltrace/types.h>
 #include <babeltrace/value-const.h>
index bfd1b904dded28265a971ccfc1e83c6b92a8c9d5..59dba54ca4387da7d5fe22a6afb1d8fe4a05e897 100644 (file)
@@ -75,6 +75,25 @@ bt_bool bt_component_class_is_sink(
                BT_COMPONENT_CLASS_TYPE_SINK;
 }
 
+extern void bt_component_class_get_ref(
+               const struct bt_component_class *component_class);
+
+extern void bt_component_class_put_ref(
+               const struct bt_component_class *component_class);
+
+#define BT_COMPONENT_CLASS_PUT_REF_AND_RESET(_var)     \
+       do {                                            \
+               bt_component_class_put_ref(_var);       \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_COMPONENT_CLASS_MOVE_REF(_var_dst, _var_src)        \
+       do {                                            \
+               bt_component_class_put_ref(_var_dst);   \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 9430899eccae7fd2065f2187fdbe602798b5f261..3fa6dca031b690b0bb320b2f3d84fddb14ce5d14 100644 (file)
@@ -39,6 +39,25 @@ bt_component_class_filter_as_component_class_const(
        return (const void *) comp_cls_filter;
 }
 
+extern void bt_component_class_filter_get_ref(
+               const struct bt_component_class_filter *component_class_filter);
+
+extern void bt_component_class_filter_put_ref(
+               const struct bt_component_class_filter *component_class_filter);
+
+#define BT_COMPONENT_CLASS_FILTER_PUT_REF_AND_RESET(_var)      \
+       do {                                                    \
+               bt_component_class_filter_put_ref(_var);        \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_COMPONENT_CLASS_FILTER_MOVE_REF(_var_dst, _var_src) \
+       do {                                                    \
+               bt_component_class_filter_put_ref(_var_dst);    \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 613b91635e7cd2c664d27e670037753109343dd9..4cfa7b7aa0fb3ec01cc20ada33524f646dc65558 100644 (file)
@@ -39,6 +39,25 @@ bt_component_class_sink_as_component_class_const(
        return (const void *) comp_cls_sink;
 }
 
+extern void bt_component_class_sink_get_ref(
+               const struct bt_component_class_sink *component_class_sink);
+
+extern void bt_component_class_sink_put_ref(
+               const struct bt_component_class_sink *component_class_sink);
+
+#define BT_COMPONENT_CLASS_SINK_PUT_REF_AND_RESET(_var)                \
+       do {                                                    \
+               bt_component_class_sink_put_ref(_var);          \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_COMPONENT_CLASS_SINK_MOVE_REF(_var_dst, _var_src)   \
+       do {                                                    \
+               bt_component_class_sink_put_ref(_var_dst);      \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 29815718e96df00d53818b823e1ecc10ef4a6590..aaf6d65860fd28cbe8eef6416954ea0dd46eca6e 100644 (file)
@@ -39,6 +39,25 @@ bt_component_class_source_as_component_class_const(
        return (const void *) comp_cls_source;
 }
 
+extern void bt_component_class_source_get_ref(
+               const struct bt_component_class_source *component_class_source);
+
+extern void bt_component_class_source_put_ref(
+               const struct bt_component_class_source *component_class_source);
+
+#define BT_COMPONENT_CLASS_SOURCE_PUT_REF_AND_RESET(_var)      \
+       do {                                                    \
+               bt_component_class_source_put_ref(_var);        \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_COMPONENT_CLASS_SOURCE_MOVE_REF(_var_dst, _var_src) \
+       do {                                                    \
+               bt_component_class_source_put_ref(_var_dst);    \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 1877988cdffcf66639c7b2616dd949d67089687b..a737d0d59ae79c5bcefc6d5831b6ac2e51164532 100644 (file)
@@ -84,6 +84,23 @@ bt_bool bt_component_is_sink(const struct bt_component *component)
 extern bt_bool bt_component_graph_is_canceled(
                const struct bt_component *component);
 
+extern void bt_component_get_ref(const struct bt_component *component);
+
+extern void bt_component_put_ref(const struct bt_component *component);
+
+#define BT_COMPONENT_PUT_REF_AND_RESET(_var)           \
+       do {                                            \
+               bt_component_put_ref(_var);             \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_COMPONENT_MOVE_REF(_var_dst, _var_src)      \
+       do {                                            \
+               bt_component_put_ref(_var_dst);         \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 4cc119e146014d39dc9bfa0b3144944811ec091f..5da4869bb3c87cf68061ccbf04b5305f60a52abf 100644 (file)
@@ -64,6 +64,25 @@ extern const struct bt_port_output *
 bt_component_filter_borrow_output_port_by_index_const(
                const struct bt_component_filter *component, uint64_t index);
 
+extern void bt_component_filter_get_ref(
+               const struct bt_component_filter *component_filter);
+
+extern void bt_component_filter_put_ref(
+               const struct bt_component_filter *component_filter);
+
+#define BT_COMPONENT_FILTER_PUT_REF_AND_RESET(_var)            \
+       do {                                                    \
+               bt_component_filter_put_ref(_var);              \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_COMPONENT_FILTER_MOVE_REF(_var_dst, _var_src)       \
+       do {                                                    \
+               bt_component_filter_put_ref(_var_dst);          \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 0afeb5148efc19f2758d3859c51690f67353ae54..bda32846b2e440b4af9b50af603fd833bc833a41 100644 (file)
@@ -52,6 +52,25 @@ extern const struct bt_port_input *
 bt_component_sink_borrow_input_port_by_index_const(
                const struct bt_component_sink *component, uint64_t index);
 
+extern void bt_component_sink_get_ref(
+               const struct bt_component_sink *component_sink);
+
+extern void bt_component_sink_put_ref(
+               const struct bt_component_sink *component_sink);
+
+#define BT_COMPONENT_SINK_PUT_REF_AND_RESET(_var)              \
+       do {                                                    \
+               bt_component_sink_put_ref(_var);                \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_COMPONENT_SINK_MOVE_REF(_var_dst, _var_src)         \
+       do {                                                    \
+               bt_component_sink_put_ref(_var_dst);            \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index daaaa4ef78e5368c79b05471df67eecbac994225..7c16d03e15453bbfdf320298af13463b8e03efcb 100644 (file)
@@ -52,6 +52,25 @@ extern const struct bt_port_output *
 bt_component_source_borrow_output_port_by_index_const(
                const struct bt_component_source *component, uint64_t index);
 
+extern void bt_component_source_get_ref(
+               const struct bt_component_source *component_source);
+
+extern void bt_component_source_put_ref(
+               const struct bt_component_source *component_source);
+
+#define BT_COMPONENT_SOURCE_PUT_REF_AND_RESET(_var)            \
+       do {                                                    \
+               bt_component_source_put_ref(_var);              \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_COMPONENT_SOURCE_MOVE_REF(_var_dst, _var_src)       \
+       do {                                                    \
+               bt_component_source_put_ref(_var_dst);          \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 59959063f43b7e19c4cc593e4ffe800bd119dc85..52f605e054fa9fad55504aad6471137234d30410 100644 (file)
@@ -43,6 +43,23 @@ extern const struct bt_port_output *bt_connection_borrow_upstream_port_const(
 
 extern bt_bool bt_connection_is_ended(const struct bt_connection *connection);
 
+extern void bt_connection_get_ref(const struct bt_connection *connection);
+
+extern void bt_connection_put_ref(const struct bt_connection *connection);
+
+#define BT_CONNECTION_PUT_REF_AND_RESET(_var)          \
+       do {                                            \
+               bt_connection_put_ref(_var);            \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_CONNECTION_MOVE_REF(_var_dst, _var_src)     \
+       do {                                            \
+               bt_connection_put_ref(_var_dst);        \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/babeltrace/graph/const-notification.h b/include/babeltrace/graph/const-notification.h
deleted file mode 100644 (file)
index 335a1c1..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef BABELTRACE_GRAPH_NOTIFICATION_CONST_H
-#define BABELTRACE_GRAPH_NOTIFICATION_CONST_H
-
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 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.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_notification;
-
-typedef struct bt_notification **bt_notification_array;
-
-/**
- * Notification types. Unhandled notification types should be ignored.
- */
-enum bt_notification_type {
-       BT_NOTIFICATION_TYPE_EVENT =                    0,
-       BT_NOTIFICATION_TYPE_INACTIVITY =               1,
-       BT_NOTIFICATION_TYPE_STREAM_BEGINNING =         2,
-       BT_NOTIFICATION_TYPE_STREAM_END =               3,
-       BT_NOTIFICATION_TYPE_PACKET_BEGINNING =         4,
-       BT_NOTIFICATION_TYPE_PACKET_END =               5,
-};
-
-/**
- * Get a notification's type.
- *
- * @param notification Notification instance
- * @returns            One of #bt_notification_type
- */
-extern enum bt_notification_type bt_notification_get_type(
-               const struct bt_notification *notification);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_GRAPH_NOTIFICATION_CONST_H */
index fe96ee717d531bc96082d668f81080140cd16de9..c920209c45acaf40bdb4ddb3901480f8b2d784f9 100644 (file)
@@ -46,6 +46,23 @@ enum bt_graph_status {
 
 extern bt_bool bt_graph_is_canceled(const struct bt_graph *graph);
 
+extern void bt_graph_get_ref(const struct bt_graph *graph);
+
+extern void bt_graph_put_ref(const struct bt_graph *graph);
+
+#define BT_GRAPH_PUT_REF_AND_RESET(_var)       \
+       do {                                    \
+               bt_graph_put_ref(_var);         \
+               (_var) = NULL;                  \
+       } while (0)
+
+#define BT_GRAPH_MOVE_REF(_var_dst, _var_src)  \
+       do {                                    \
+               bt_graph_put_ref(_var_dst);     \
+               (_var_dst) = (_var_src);        \
+               (_var_src) = NULL;              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 47e2f606c3effb146de370f30ed8915986a0b06b..a513c0c6fb537f8edc01f69da6508effb1e8bc2b 100644 (file)
@@ -53,6 +53,23 @@ enum bt_notification_type {
 extern enum bt_notification_type bt_notification_get_type(
                const struct bt_notification *notification);
 
+extern void bt_notification_get_ref(const struct bt_notification *notification);
+
+extern void bt_notification_put_ref(const struct bt_notification *notification);
+
+#define BT_NOTIFICATION_PUT_REF_AND_RESET(_var)                \
+       do {                                            \
+               bt_notification_put_ref(_var);          \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_NOTIFICATION_MOVE_REF(_var_dst, _var_src)   \
+       do {                                            \
+               bt_notification_put_ref(_var_dst);      \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 414c5ccde842163e279d4566631005b6b3d276c8..826ab02b034a456589e2807d42c798cc792b87fc 100644 (file)
@@ -66,6 +66,23 @@ bt_bool bt_port_is_output(const struct bt_port *port)
        return bt_port_get_type(port) == BT_PORT_TYPE_OUTPUT;
 }
 
+extern void bt_port_get_ref(const struct bt_port *port);
+
+extern void bt_port_put_ref(const struct bt_port *port);
+
+#define BT_PORT_PUT_REF_AND_RESET(_var)                \
+       do {                                    \
+               bt_port_put_ref(_var);          \
+               (_var) = NULL;                  \
+       } while (0)
+
+#define BT_PORT_MOVE_REF(_var_dst, _var_src)   \
+       do {                                    \
+               bt_port_put_ref(_var_dst);      \
+               (_var_dst) = (_var_src);        \
+               (_var_src) = NULL;              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index d23fd558053c46e6d756af78f8cf2d4bb1b7dd7b..1f13de9dd10a3a6b6b3732272ea8fc2ae3cc2087 100644 (file)
@@ -40,6 +40,23 @@ const struct bt_port *bt_port_input_as_port_const(
        return (const void *) port_input;
 }
 
+extern void bt_port_input_get_ref(const struct bt_port_input *port_input);
+
+extern void bt_port_input_put_ref(const struct bt_port_input *port_input);
+
+#define BT_PORT_INPUT_PUT_REF_AND_RESET(_var)          \
+       do {                                            \
+               bt_port_input_put_ref(_var);            \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_PORT_INPUT_MOVE_REF(_var_dst, _var_src)     \
+       do {                                            \
+               bt_port_input_put_ref(_var_dst);        \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 898bdac637d7aeefebe468eed4e0e5777bf9a94a..d13c7395c777e81c0611c7b0e5fd77359cf87e0e 100644 (file)
@@ -40,6 +40,23 @@ const struct bt_port *bt_port_output_as_port_const(
        return (const void *) port_output;
 }
 
+extern void bt_port_output_get_ref(const struct bt_port_output *port_output);
+
+extern void bt_port_output_put_ref(const struct bt_port_output *port_output);
+
+#define BT_PORT_OUTPUT_PUT_REF_AND_RESET(_var)         \
+       do {                                            \
+               bt_port_output_put_ref(_var);           \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_PORT_OUTPUT_MOVE_REF(_var_dst, _var_src)    \
+       do {                                            \
+               bt_port_output_put_ref(_var_dst);       \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index a13d59e3c0b26f45238174eb76c91b05a04f29fa..dfe5a3f4905fc2725337dd4719e83f0b31ce1d4a 100644 (file)
@@ -60,6 +60,25 @@ bt_port_output_notification_iterator_next(
                struct bt_port_output_notification_iterator *iterator,
                bt_notification_array_const *notifs, uint64_t *count);
 
+extern void bt_port_output_notification_iterator_get_ref(
+               const struct bt_port_output_notification_iterator *port_output_notification_iterator);
+
+extern void bt_port_output_notification_iterator_put_ref(
+               const struct bt_port_output_notification_iterator *port_output_notification_iterator);
+
+#define BT_PORT_OUTPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(_var)   \
+       do {                                                            \
+               bt_port_output_notification_iterator_put_ref(_var);     \
+               (_var) = NULL;                                          \
+       } while (0)
+
+#define BT_PORT_OUTPUT_NOTIFICATION_ITERATOR_MOVE_REF(_var_dst, _var_src) \
+       do {                                                            \
+               bt_port_output_notification_iterator_put_ref(_var_dst); \
+               (_var_dst) = (_var_src);                                \
+               (_var_src) = NULL;                                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 7da47da06bf408ec6b37bc35021efcf6e739f023..d2e846cedf7ad25824afce8b054c1c53773027c9 100644 (file)
@@ -47,6 +47,25 @@ extern
 bt_bool bt_query_executor_is_canceled(
                const struct bt_query_executor *query_executor);
 
+extern void bt_query_executor_get_ref(
+               const struct bt_query_executor *query_executor);
+
+extern void bt_query_executor_put_ref(
+               const struct bt_query_executor *query_executor);
+
+#define BT_QUERY_EXECUTOR_PUT_REF_AND_RESET(_var)              \
+       do {                                                    \
+               bt_query_executor_put_ref(_var);                \
+               (_var) = NULL;                                  \
+       } while (0)
+
+#define BT_QUERY_EXECUTOR_MOVE_REF(_var_dst, _var_src)         \
+       do {                                                    \
+               bt_query_executor_put_ref(_var_dst);            \
+               (_var_dst) = (_var_src);                        \
+               (_var_src) = NULL;                              \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index d79f1bc066d5273e58b84efc9aecd1a951441699..45f7e194306c85d2d443aa35aa38a38723ca1d9b 100644 (file)
@@ -61,6 +61,25 @@ bt_self_component_port_input_notification_iterator_next(
                struct bt_self_component_port_input_notification_iterator *iterator,
                bt_notification_array_const *notifs, uint64_t *count);
 
+extern void bt_self_component_port_input_notification_iterator_get_ref(
+               const struct bt_self_component_port_input_notification_iterator *self_component_port_input_notification_iterator);
+
+extern void bt_self_component_port_input_notification_iterator_put_ref(
+               const struct bt_self_component_port_input_notification_iterator *self_component_port_input_notification_iterator);
+
+#define BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(_var) \
+       do {                                                            \
+               bt_self_component_port_input_notification_iterator_put_ref(_var); \
+               (_var) = NULL;                                          \
+       } while (0)
+
+#define BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_MOVE_REF(_var_dst, _var_src) \
+       do {                                                            \
+               bt_self_component_port_input_notification_iterator_put_ref(_var_dst); \
+               (_var_dst) = (_var_src);                                \
+               (_var_src) = NULL;                                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 1420d9fedea298fc8c98a79f755baf955609afcd..00f48ef675e6bdd3cb0b4ebca47ca85c6a1ddc95 100644 (file)
@@ -324,4 +324,51 @@ void bt_object_put_no_null_check(const void *c_obj)
        }
 }
 
+static inline
+void bt_object_get_ref(const void *ptr)
+{
+       struct bt_object *obj = (void *) ptr;
+
+       if (unlikely(!obj)) {
+               return;
+       }
+
+#ifdef BT_ASSERT_PRE
+       BT_ASSERT_PRE(obj->is_shared, "Object is not shared: %!+O", obj);
+#endif
+
+       bt_object_get_no_null_check(obj);
+}
+
+static inline
+void bt_object_put_ref(const void *ptr)
+{
+       struct bt_object *obj = (void *) ptr;
+
+       if (unlikely(!obj)) {
+               return;
+       }
+
+#ifdef BT_ASSERT_PRE
+       BT_ASSERT_PRE(obj->is_shared, "Object is not shared: %!+O", obj);
+       BT_ASSERT_PRE(bt_object_get_ref_count(obj) > 0,
+               "Decrementing a reference count set to 0: %!+O", ptr);
+#endif
+
+       bt_object_put_no_null_check(obj);
+}
+
+#define BT_OBJECT_PUT_REF_AND_RESET(_var)      \
+       do {                                    \
+               bt_object_put_ref(_var);        \
+               (_var) = NULL;                  \
+       } while (0)
+
+#define BT_OBJECT_MOVE_REF(_var_dst, _var_src) \
+       do {                                    \
+               bt_object_put_ref(_var_dst);    \
+               (_var_dst) = (_var_src);        \
+               (_var_src) = NULL;              \
+       } while (0)
+
 #endif /* BABELTRACE_OBJECT_INTERNAL_H */
diff --git a/include/babeltrace/object.h b/include/babeltrace/object.h
deleted file mode 100644 (file)
index 96506d8..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-#ifndef BABELTRACE_OBJECT_H
-#define BABELTRACE_OBJECT_H
-
-/*
- * Copyright (c) 2015-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright (c) 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 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.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
-@defgroup refs Reference counting management
-@ingroup apiref
-@brief Common reference counting management for all Babeltrace objects.
-
-@code
-#include <babeltrace/object.h>
-@endcode
-
-The macros and functions of this module are everything that is needed
-to handle the <strong><em>reference counting</em></strong> of
-Babeltrace objects.
-
-Any Babeltrace object can be shared by multiple owners thanks to
-<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
-counting</a>.
-
-The Babeltrace C API complies with the following key principles:
-
-1. When you call an API function which accepts a Babeltrace object
-   pointer as a parameter, the API function <strong>borrows the
-   reference</strong> for the <strong>duration of the function</strong>.
-
-   @image html ref-count-user-calls.png
-
-   The API function can also get a new reference if the system needs a
-   more persistent reference, but the ownership is <strong>never
-   transferred</strong> from the caller to the API function.
-
-   In other words, the caller still owns the object after calling any
-   API function: no function "steals" the user's reference (except
-   bt_object_put_ref()).
-
-2. An API function which \em returns a Babeltrace object pointer to the
-   user returns a <strong>new reference</strong>. The caller becomes an
-   owner of the object.
-
-   @image html ref-count-api-returns.png
-
-   It is your responsibility to discard the object when you don't
-   need it anymore with bt_object_put_ref().
-
-   For example, see bt_value_array_get().
-
-3. A Babeltrace object pointer received as a parameter in a user
-   function called back from an API function is a
-   <strong>borrowed</strong>, or <strong>weak reference</strong>: if you
-   need a reference which is more persistent than the duration of the
-   user function, call bt_object_get_ref() on the pointer.
-
-   @image html ref-count-callback.png
-
-   For example, see bt_value_map_foreach_entry().
-
-The two macros BT_OBJECT_PUT_REF_AND_RESET() and BT_OBJECT_MOVE_REF() operate on \em variables rather
-than pointer values. You should use BT_OBJECT_PUT_REF_AND_RESET() instead of bt_object_put_ref() when
-possible to avoid "double puts". For the same reason, you should use use
-BT_OBJECT_MOVE_REF() instead of performing manual reference moves between
-variables.
-
-@file
-@brief Reference counting management macros and functions.
-@sa refs
-
-@addtogroup refs
-@{
-*/
-
-/**
-@brief Calls bt_object_put_ref() on a variable named \p _var, then
-       sets \p _var to \c NULL.
-
-Using this macro is considered safer than calling bt_object_put_ref() because it
-makes sure that the variable which used to contain a reference to a
-Babeltrace object is set to \c NULL so that a future BT_OBJECT_PUT_REF_AND_RESET() or
-bt_object_put_ref() call will not cause another, unwanted reference decrementation.
-
-@param[in,out] _var    Name of a variable containing a
-                       Babeltrace object's address (this address
-                       can be \c NULL).
-
-@post <strong>If \p _var does not contain \p NULL</strong>,
-       its reference count is decremented.
-@post \p _var contains \c NULL.
-
-@sa BT_OBJECT_MOVE_REF(): Transfers the ownership of a Babeltrace object from a
-       variable to another.
-*/
-#define BT_OBJECT_PUT_REF_AND_RESET(_var)      \
-       do {                                    \
-               bt_object_put_ref(_var);        \
-               (_var) = NULL;                  \
-       } while (0)
-
-/**
-@brief Transfers the ownership of a Babeltrace object from a variable
-       named \p _var_src to a variable named \p _var_dst.
-
-This macro implements the following common pattern:
-
-  1. Call bt_object_put_ref() on \p _var_dst to make sure the previous reference
-     held by \p _var_dst is discarded.
-  2. Assign \p _var_src to \p _var_dst.
-  3. Set \p _var_src to \c NULL to avoid future, unwanted reference
-     decrementation of \p _var_src.
-
-@warning
-You must \em not use this macro when both \p _var_dst and
-\p _var_src contain the same Babeltrace object address and the reference
-count of this object is 1. The initial call to bt_object_put_ref() on \p _var_dst
-would destroy the object and leave a dangling pointer in \p _var_dst.
-
-@param[in,out] _var_dst        Name of the destination variable, containing
-                       either the address of a Babeltrace object to
-                       put first, or \c NULL.
-@param[in,out] _var_src        Name of the source variable, containing
-                       either the address of a Babeltrace object to
-                       move, or \c NULL.
-
-@pre <strong>If \p _var_dst and \p _var_src contain the same
-       value which is not \c NULL</strong>, this object's reference
-       count is greater than 1.
-@post <strong>If \c _var_dst is not \c NULL</strong>, its reference
-       count is decremented.
-@post \p _var_dst is equal to the value of \p _var_src \em before
-       you called this macro.
-@post \p _var_src is \c NULL.
-
-@sa BT_OBJECT_PUT_REF_AND_RESET(): Calls bt_object_put_ref() on a variable, then sets it to \c NULL.
-*/
-#define BT_OBJECT_MOVE_REF(_var_dst, _var_src) \
-       do {                                    \
-               bt_object_put_ref(_var_dst);    \
-               (_var_dst) = (_var_src);        \
-               (_var_src) = NULL;              \
-       } while (0)
-
-/**
-@brief  Increments the reference count of the Babeltrace object \p obj.
-
-@param[in] obj Babeltrace object of which to get a new reference
-               (can be \c NULL).
-@returns       \p obj
-
-@post <strong>If \c obj is not \c NULL</strong>, its reference
-       count is incremented.
-
-@sa bt_object_put_ref(): Decrements the reference count of a Babeltrace object.
-*/
-void bt_object_get_ref(const void *obj);
-
-/**
-@brief Decrements the reference count of the Babeltrace object
-       \p obj.
-
-When the object's reference count reaches 0, the object can no longer
-be accessed and is considered \em destroyed.
-
-@remarks
-You should use the BT_OBJECT_PUT_REF_AND_RESET() macro instead of calling bt_object_put_ref() since the
-former is generally safer.
-
-@param[in] obj Babeltrace object of which to drop a reference
-               (can be \c NULL).
-
-@post <strong>If \c obj is not \c NULL</strong>, its reference
-       count is decremented.
-
-@sa BT_OBJECT_PUT_REF_AND_RESET(): Calls bt_object_put_ref() on a variable, then sets it to \c NULL.
-@sa BT_OBJECT_MOVE_REF(): Transfers the ownership of a Babeltrace object from a
-       variable to another.
-@sa bt_object_get_ref(): Increments the reference count of a Babeltrace object.
-*/
-void bt_object_put_ref(const void *obj);
-
-/**
-@}
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_OBJECT_H */
index 4bf3564c59ad931f61ec671dd166e43b194de4b1..ad0b454d4b9cb02ddbad611ee879969018ca30f3 100644 (file)
@@ -121,6 +121,23 @@ extern const struct bt_component_class_sink *
 bt_plugin_borrow_sink_component_class_by_name_const(
                const struct bt_plugin *plugin, const char *name);
 
+extern void bt_plugin_get_ref(const struct bt_plugin *plugin);
+
+extern void bt_plugin_put_ref(const struct bt_plugin *plugin);
+
+#define BT_PLUGIN_PUT_REF_AND_RESET(_var)              \
+       do {                                            \
+               bt_plugin_put_ref(_var);                \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_PLUGIN_MOVE_REF(_var_dst, _var_src)         \
+       do {                                            \
+               bt_plugin_put_ref(_var_dst);            \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 02b74742acc86fb18dcf406358ff805f5f8ef573..65926c0b770bd4027dc794aa6c67ece06d4e5390 100644 (file)
@@ -30,7 +30,6 @@
 #include <babeltrace/plugin/plugin-dev.h>
 #include <babeltrace/plugin/plugin-so-internal.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/types.h>
 #include <babeltrace/assert-internal.h>
 #include <glib.h>
index 66e0622594795c95d42dec2911d32b3d0e2ff245..53f8c24a8bbdb4c05a854c21fd89faaafe9202b2 100644 (file)
@@ -39,6 +39,23 @@ extern uint64_t bt_plugin_set_get_plugin_count(
 extern const struct bt_plugin *bt_plugin_set_borrow_plugin_by_index_const(
                const struct bt_plugin_set *plugin_set, uint64_t index);
 
+extern void bt_plugin_set_get_ref(const struct bt_plugin_set *plugin_set);
+
+extern void bt_plugin_set_put_ref(const struct bt_plugin_set *plugin_set);
+
+#define BT_PLUGIN_SET_PUT_REF_AND_RESET(_var)          \
+       do {                                            \
+               bt_plugin_set_put_ref(_var);            \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_PLUGIN_SET_MOVE_REF(_var_dst, _var_src)     \
+       do {                                            \
+               bt_plugin_set_put_ref(_var_dst);        \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 3032b316b8082d04d0cf019fe83b9c54f16343dd..0a0cecf84dca9a59cc0e91d144112b4c9fde6e33 100644 (file)
@@ -63,6 +63,23 @@ extern int bt_clock_class_cycles_to_ns_from_origin(
                const struct bt_clock_class *clock_class,
                uint64_t cycles, int64_t *ns_from_origin);
 
+extern void bt_clock_class_get_ref(const struct bt_clock_class *clock_class);
+
+extern void bt_clock_class_put_ref(const struct bt_clock_class *clock_class);
+
+#define BT_CLOCK_CLASS_PUT_REF_AND_RESET(_var)         \
+       do {                                            \
+               bt_clock_class_put_ref(_var);           \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_CLOCK_CLASS_MOVE_REF(_var_dst, _var_src)    \
+       do {                                            \
+               bt_clock_class_put_ref(_var_dst);       \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 39d025f609ba44dceee55a8da8dc0462cfb44c8c..2cc9d793b0310a6a2ad2ba95e976e58adbbcf7ee 100644 (file)
@@ -80,6 +80,23 @@ bt_event_class_borrow_specific_context_field_class(
 extern const struct bt_field_class *bt_event_class_borrow_payload_field_class(
                const struct bt_event_class *event_class);
 
+extern void bt_event_class_get_ref(const struct bt_event_class *event_class);
+
+extern void bt_event_class_put_ref(const struct bt_event_class *event_class);
+
+#define BT_EVENT_CLASS_PUT_REF_AND_RESET(_var)         \
+       do {                                            \
+               bt_event_class_put_ref(_var);           \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_EVENT_CLASS_MOVE_REF(_var_dst, _var_src)    \
+       do {                                            \
+               bt_event_class_put_ref(_var_dst);       \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 3e0e16e6f40d6b0efc0e79679eca6f16b73b6ca4..3f902cebe42ea34c114821b173d661339457b031 100644 (file)
@@ -158,6 +158,24 @@ bt_field_class_variant_borrow_option_field_class_by_name_const(
                const struct bt_field_class *field_class,
                const char *name);
 
+extern void bt_field_class_get_ref(const struct bt_field_class *field_class);
+
+extern void bt_field_class_put_ref(const struct bt_field_class *field_class);
+
+#define BT_FIELD_CLASS_PUT_REF_AND_RESET(_var)         \
+       do {                                            \
+               bt_field_class_put_ref(_var);           \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_FIELD_CLASS_MOVE_REF(_var_dst, _var_src)    \
+       do {                                            \
+               bt_field_class_put_ref(_var_dst);       \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
+
 #ifdef __cplusplus
 }
 #endif
index a832bc4d1db738d12674b56cdb58737444ff8f9f..066bc4568761446ecaaabdfd50bc1766bb9d9ea0 100644 (file)
@@ -52,6 +52,23 @@ extern uint64_t bt_field_path_get_index_count(
 extern uint64_t bt_field_path_get_index_by_index(
                const struct bt_field_path *field_path, uint64_t index);
 
+extern void bt_field_path_get_ref(const struct bt_field_path *field_path);
+
+extern void bt_field_path_put_ref(const struct bt_field_path *field_path);
+
+#define BT_FIELD_PATH_PUT_REF_AND_RESET(_var)          \
+       do {                                            \
+               bt_field_path_put_ref(_var);            \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_FIELD_PATH_MOVE_REF(_var_dst, _var_src)     \
+       do {                                            \
+               bt_field_path_put_ref(_var_dst);        \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index a59324fc7b9b160a94fae10e64364a1084205111..3aee95ec60c194badfc0c385efe8c49b70c325ea 100644 (file)
@@ -73,6 +73,23 @@ extern
 enum bt_property_availability bt_packet_get_packet_counter_snapshot(
                const struct bt_packet *packet, uint64_t *value);
 
+extern void bt_packet_get_ref(const struct bt_packet *packet);
+
+extern void bt_packet_put_ref(const struct bt_packet *packet);
+
+#define BT_PACKET_PUT_REF_AND_RESET(_var)              \
+       do {                                            \
+               bt_packet_put_ref(_var);                \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_PACKET_MOVE_REF(_var_dst, _var_src)         \
+       do {                                            \
+               bt_packet_put_ref(_var_dst);            \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 8452c56c85c49db75b6f6cbaa882d22a182ce906..b740b936002e291ffb3a197cdb6c043a44805fbb 100644 (file)
@@ -39,7 +39,7 @@ extern "C" {
 struct bt_trace_class;
 struct bt_stream_class;
 struct bt_event_class;
-struct bt_clock_class;
+struct bt_stream_class;
 struct bt_event_header_field;
 struct bt_packet_context_field;
 
@@ -100,6 +100,23 @@ extern bt_bool bt_stream_class_packets_have_default_beginning_clock_value(
 extern bt_bool bt_stream_class_packets_have_default_end_clock_value(
                const struct bt_stream_class *stream_class);
 
+extern void bt_stream_class_get_ref(const struct bt_stream_class *stream_class);
+
+extern void bt_stream_class_put_ref(const struct bt_stream_class *stream_class);
+
+#define BT_STREAM_CLASS_PUT_REF_AND_RESET(_var)                \
+       do {                                            \
+               bt_stream_class_put_ref(_var);          \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_STREAM_CLASS_MOVE_REF(_var_dst, _var_src)   \
+       do {                                            \
+               bt_stream_class_put_ref(_var_dst);      \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index e204f4c92687c07619f476b295b72e216a9ceeaa..328441c8fc6fc7ef745b551fdb96181f8685ddea 100644 (file)
@@ -47,6 +47,23 @@ extern const char *bt_stream_get_name(const struct bt_stream *stream);
 
 extern uint64_t bt_stream_get_id(const struct bt_stream *stream);
 
+extern void bt_stream_get_ref(const struct bt_stream *stream);
+
+extern void bt_stream_put_ref(const struct bt_stream *stream);
+
+#define BT_STREAM_PUT_REF_AND_RESET(_var)              \
+       do {                                            \
+               bt_stream_put_ref(_var);                \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_STREAM_MOVE_REF(_var_dst, _var_src)         \
+       do {                                            \
+               bt_stream_put_ref(_var_dst);            \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 539e1f624d3702993cfc073dc6e2253c8368c2db..179d3ce6c8c553af85fcd28d55df3d5c6695b1d6 100644 (file)
@@ -75,6 +75,23 @@ bt_trace_class_borrow_stream_class_by_index_const(
 extern const struct bt_stream_class *bt_trace_class_borrow_stream_class_by_id_const(
                const struct bt_trace_class *trace_class, uint64_t id);
 
+extern void bt_trace_class_get_ref(const struct bt_trace_class *trace_class);
+
+extern void bt_trace_class_put_ref(const struct bt_trace_class *trace_class);
+
+#define BT_TRACE_CLASS_PUT_REF_AND_RESET(_var)         \
+       do {                                            \
+               bt_trace_class_put_ref(_var);           \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_TRACE_CLASS_MOVE_REF(_var_dst, _var_src)    \
+       do {                                            \
+               bt_trace_class_put_ref(_var_dst);       \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index d5987801147823d4b0de8aadd81ff6052f647366..ba629e053c9599929f521a7affe087de6b99a597 100644 (file)
@@ -71,6 +71,23 @@ extern int bt_trace_add_is_static_listener(const struct bt_trace *trace,
 extern int bt_trace_remove_is_static_listener(const struct bt_trace *trace,
                uint64_t listener_id);
 
+extern void bt_trace_get_ref(const struct bt_trace *trace);
+
+extern void bt_trace_put_ref(const struct bt_trace *trace);
+
+#define BT_TRACE_PUT_REF_AND_RESET(_var)               \
+       do {                                            \
+               bt_trace_put_ref(_var);                 \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_TRACE_MOVE_REF(_var_dst, _var_src)          \
+       do {                                            \
+               bt_trace_put_ref(_var_dst);             \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 1b335c45050b48d4cfe7f49072b0b0e7cc69cb26..a1bf532ed31796e8000f630b6be93f59aed09bb3 100644 (file)
@@ -164,6 +164,23 @@ extern enum bt_value_status bt_value_map_extend(
                const struct bt_value *extension_map_obj,
                struct bt_value **extended_map_obj);
 
+extern void bt_value_get_ref(const struct bt_value *value);
+
+extern void bt_value_put_ref(const struct bt_value *value);
+
+#define BT_VALUE_PUT_REF_AND_RESET(_var)               \
+       do {                                            \
+               bt_value_put_ref(_var);                 \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_VALUE_MOVE_REF(_var_dst, _var_src)          \
+       do {                                            \
+               bt_value_put_ref(_var_dst);             \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
index 011876508417baa9d4bed3eb5c1c7e4bf4a59e1b..5665b0131095b8d238a41ab17abee8c9669e616d 100644 (file)
@@ -5,7 +5,6 @@ lib_LTLIBRARIES = libbabeltrace.la libbabeltrace-ctf.la
 libbabeltrace_la_SOURCES = \
        babeltrace.c \
        value.c \
-       object.c \
        lib-logging.c \
        logging.c \
        object-pool.c
index 6161244b7b678c6478993a8c14e36165c9321cfd..582176753d4c47cc18c9d272e5356107a1a16470 100644 (file)
 #define BT_LOG_TAG "COLANDER"
 #include <babeltrace/lib-logging-internal.h>
 
-#include <babeltrace/object.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object-internal.h>
 #include <babeltrace/graph/component-class-sink.h>
 #include <babeltrace/graph/self-component-sink.h>
 #include <babeltrace/graph/self-component-port.h>
 #include <babeltrace/graph/self-component-port-input-notification-iterator.h>
 #include <babeltrace/graph/self-component.h>
 #include <babeltrace/graph/component-class-sink-colander-internal.h>
-#include <babeltrace/assert-internal.h>
 #include <glib.h>
 
 static
index 57ade14d70eb1a3da7c241e1cdd9e5be2b7a3aa6..12a3eec0307331f39d246b486af60e9870c1c1dc 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "COMP-CLASS"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/graph/component-class.h>
 #include <babeltrace/graph/component-class-const.h>
 #include <babeltrace/graph/component-class-sink.h>
 #include <babeltrace/graph/component-class-sink-const.h>
 #include <babeltrace/graph/component-class-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/types.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 #include <glib.h>
 
 #define BT_ASSERT_PRE_COMP_CLS_HOT(_cc) \
@@ -652,3 +651,51 @@ void _bt_component_class_freeze(const struct bt_component_class *comp_cls)
        BT_LIB_LOGD("Freezing component class: %!+C", comp_cls);
        ((struct bt_component_class *) comp_cls)->frozen = true;
 }
+
+void bt_component_class_get_ref(
+               const struct bt_component_class *component_class)
+{
+       bt_object_get_ref(component_class);
+}
+
+void bt_component_class_put_ref(
+               const struct bt_component_class *component_class)
+{
+       bt_object_put_ref(component_class);
+}
+
+void bt_component_class_source_get_ref(
+               const struct bt_component_class_source *component_class_source)
+{
+       bt_object_get_ref(component_class_source);
+}
+
+void bt_component_class_source_put_ref(
+               const struct bt_component_class_source *component_class_source)
+{
+       bt_object_put_ref(component_class_source);
+}
+
+void bt_component_class_filter_get_ref(
+               const struct bt_component_class_filter *component_class_filter)
+{
+       bt_object_get_ref(component_class_filter);
+}
+
+void bt_component_class_filter_put_ref(
+               const struct bt_component_class_filter *component_class_filter)
+{
+       bt_object_put_ref(component_class_filter);
+}
+
+void bt_component_class_sink_get_ref(
+               const struct bt_component_class_sink *component_class_sink)
+{
+       bt_object_get_ref(component_class_sink);
+}
+
+void bt_component_class_sink_put_ref(
+               const struct bt_component_class_sink *component_class_sink)
+{
+       bt_object_put_ref(component_class_sink);
+}
index a27b6e72ce57365dc9a8b4ba894e998c3a60a692..32a12924737f7af43569dafecdaf0cc2c8dfa5e7 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "COMP-FILTER"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/value.h>
 #include <babeltrace/graph/self-component-filter.h>
@@ -32,9 +34,6 @@
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/component-class-internal.h>
 #include <babeltrace/graph/graph.h>
-#include <babeltrace/object.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 BT_HIDDEN
 void bt_component_filter_destroy(struct bt_component *component)
@@ -190,3 +189,15 @@ end:
        bt_object_put_ref(port);
        return status;
 }
+
+void bt_component_filter_get_ref(
+               const struct bt_component_filter *component_filter)
+{
+       bt_object_get_ref(component_filter);
+}
+
+void bt_component_filter_put_ref(
+               const struct bt_component_filter *component_filter)
+{
+       bt_object_put_ref(component_filter);
+}
index 1d32d609784ec8cb7a823b0a986963114059801b..41a9a376108ff93e67730a2d4293708b21587c1e 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "COMP-SINK"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/value.h>
 #include <babeltrace/graph/self-component-sink.h>
@@ -31,9 +33,6 @@
 #include <babeltrace/graph/component-sink-internal.h>
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/graph.h>
-#include <babeltrace/object.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 BT_HIDDEN
 void bt_component_sink_destroy(struct bt_component *component)
@@ -123,3 +122,15 @@ end:
        bt_object_put_ref(port);
        return status;
 }
+
+void bt_component_sink_get_ref(
+               const struct bt_component_sink *component_sink)
+{
+       bt_object_get_ref(component_sink);
+}
+
+void bt_component_sink_put_ref(
+               const struct bt_component_sink *component_sink)
+{
+       bt_object_put_ref(component_sink);
+}
index d6a492a8aa8b0e217c6d776cee3ffc3b24341e6f..e23200a508493506a433940522d868be737a493d 100644 (file)
@@ -24,7 +24,8 @@
 #define BT_LOG_TAG "COMP-SOURCE"
 #include <babeltrace/lib-logging-internal.h>
 
-#include <babeltrace/object.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/graph/self-component-source.h>
 #include <babeltrace/graph/component-source-const.h>
@@ -34,8 +35,6 @@
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/notification-iterator-internal.h>
 #include <babeltrace/graph/graph.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 BT_HIDDEN
 void bt_component_source_destroy(struct bt_component *component)
@@ -120,3 +119,15 @@ end:
        bt_object_put_ref(port);
        return status;
 }
+
+void bt_component_source_get_ref(
+               const struct bt_component_source *component_source)
+{
+       bt_object_get_ref(component_source);
+}
+
+void bt_component_source_put_ref(
+               const struct bt_component_source *component_source)
+{
+       bt_object_put_ref(component_source);
+}
index 7448be02e15699c056d9b87deaf5c5ba9f8e801e..eb9118613750027fe4279444fbce3fce7bc536a3 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "COMP"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/graph/self-component.h>
 #include <babeltrace/graph/component-const.h>
 #include <babeltrace/graph/component-source-const.h>
 #include <babeltrace/graph/port-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/types.h>
 #include <babeltrace/value.h>
 #include <babeltrace/value-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 #include <stdint.h>
 #include <inttypes.h>
 
@@ -822,3 +821,13 @@ void bt_component_remove_destroy_listener(struct bt_component *component,
                }
        }
 }
+
+void bt_component_get_ref(const struct bt_component *component)
+{
+       bt_object_get_ref(component);
+}
+
+void bt_component_put_ref(const struct bt_component *component)
+{
+       bt_object_put_ref(component);
+}
index 3fabe213d3fd5498462cfc5bae4008962c0be665..ebe03903025ea30305c80b2d08b977b90b8d9a6f 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "CONNECTION"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/graph/notification-iterator-internal.h>
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/connection-internal.h>
@@ -32,9 +34,6 @@
 #include <babeltrace/graph/port-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/object.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 #include <stdlib.h>
 #include <glib.h>
 
@@ -284,3 +283,13 @@ bt_bool bt_connection_is_ended(const struct bt_connection *connection)
 {
        return !connection->downstream_port && !connection->upstream_port;
 }
+
+void bt_connection_get_ref(const struct bt_connection *connection)
+{
+       bt_object_get_ref(connection);
+}
+
+void bt_connection_put_ref(const struct bt_connection *connection)
+{
+       bt_object_put_ref(connection);
+}
index 56f98b13aecee5970e969b924f39c24acee2cca6..3588c54a054d7a0c954b69fce72987eb57394c98 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "GRAPH"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/graph/component-internal.h>
 #include <babeltrace/graph/graph.h>
 #include <babeltrace/graph/graph-const.h>
@@ -42,9 +44,6 @@
 #include <babeltrace/value.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/value-internal.h>
-#include <babeltrace/object.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 #include <unistd.h>
 #include <glib.h>
 
@@ -1937,3 +1936,13 @@ void bt_graph_add_notification(struct bt_graph *graph,
         */
        g_ptr_array_add(graph->notifications, notif);
 }
+
+void bt_graph_get_ref(const struct bt_graph *graph)
+{
+       bt_object_get_ref(graph);
+}
+
+void bt_graph_put_ref(const struct bt_graph *graph)
+{
+       bt_object_put_ref(graph);
+}
index 46b30db00e521138fb2fb81a32b0eae96903667b..db774dfd298a6b13d7a6f79ad1807906b2be3e0e 100644 (file)
@@ -25,7 +25,6 @@
 #include <babeltrace/lib-logging-internal.h>
 
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/trace-ir/field.h>
 #include <babeltrace/trace-ir/event-const.h>
 #include <babeltrace/trace-ir/event-internal.h>
@@ -1041,3 +1040,27 @@ end:
        bt_object_put_ref(colander_comp_cls);
        return (void *) iterator;
 }
+
+void bt_port_output_notification_iterator_get_ref(
+               const struct bt_port_output_notification_iterator *iterator)
+{
+       bt_object_get_ref(iterator);
+}
+
+void bt_port_output_notification_iterator_put_ref(
+               const struct bt_port_output_notification_iterator *iterator)
+{
+       bt_object_put_ref(iterator);
+}
+
+void bt_self_component_port_input_notification_iterator_get_ref(
+               const struct bt_self_component_port_input_notification_iterator *iterator)
+{
+       bt_object_get_ref(iterator);
+}
+
+void bt_self_component_port_input_notification_iterator_put_ref(
+               const struct bt_self_component_port_input_notification_iterator *iterator)
+{
+       bt_object_put_ref(iterator);
+}
index 038da740f46a3cc8a1ceaa6764e3123907ec3600..3321af220abee0717ffedb50b8f83e5446d905e9 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "NOTIF-EVENT"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/trace-ir/event.h>
@@ -36,9 +38,6 @@
 #include <babeltrace/graph/notification-event.h>
 #include <babeltrace/graph/notification-event-internal.h>
 #include <babeltrace/types.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/object.h>
 #include <stdbool.h>
 #include <inttypes.h>
 
index a8bd036756ce3754134fbfb8b32336ab0ee68720..47d759d4d3aa33f7ef058841b8624c85d360cb70 100644 (file)
@@ -23,6 +23,7 @@
 #define BT_LOG_TAG "NOTIF-INACTIVITY"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/trace-ir/clock-class.h>
@@ -31,8 +32,6 @@
 #include <babeltrace/graph/notification-inactivity-const.h>
 #include <babeltrace/graph/notification-inactivity.h>
 #include <babeltrace/graph/notification-inactivity-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/object.h>
 
 static
 void bt_notification_inactivity_destroy(struct bt_object *obj)
index 3338780d435efd68f90dbeb8da25d30621b1032c..7a2d859b073fef1e47645e6ff46f070af2d6379f 100644 (file)
 #define BT_LOG_TAG "NOTIF"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/graph/notification-const.h>
 #include <babeltrace/graph/notification-internal.h>
 #include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 BT_ASSERT_PRE_FUNC
 static inline void _init_seq_num(struct bt_notification *notification)
@@ -73,3 +73,13 @@ void bt_notification_unlink_graph(struct bt_notification *notif)
        BT_ASSERT(notif);
        notif->graph = NULL;
 }
+
+void bt_notification_get_ref(const struct bt_notification *notification)
+{
+       bt_object_get_ref(notification);
+}
+
+void bt_notification_put_ref(const struct bt_notification *notification)
+{
+       bt_object_put_ref(notification);
+}
index d5b8625b7fc82b111463e4c85aa2a8b297a0f183..f548f8c5ee868f0e475e98354fac54016eb99e8b 100644 (file)
@@ -34,7 +34,6 @@
 #include <babeltrace/graph/notification-packet-const.h>
 #include <babeltrace/graph/notification-packet.h>
 #include <babeltrace/graph/notification-packet-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/assert-internal.h>
 #include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/object-internal.h>
index 44456ee23f906dcb0c2507e1148f340e042cc869..61ff2780243b187ccfd1c2a92a7fc67f2010e28a 100644 (file)
@@ -33,7 +33,6 @@
 #include <babeltrace/graph/notification-stream-const.h>
 #include <babeltrace/graph/notification-stream-internal.h>
 #include <babeltrace/assert-internal.h>
-#include <babeltrace/object.h>
 #include <inttypes.h>
 
 static
index 01ee3944fc62bc83d101545da44266055e966399..da83725ee8b1ac0b96a9ec136df945997331c1b2 100644 (file)
@@ -24,6 +24,8 @@
 #define BT_LOG_TAG "PORT"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/graph/port-const.h>
 #include <babeltrace/graph/port-input-const.h>
 #include <babeltrace/graph/port-output-const.h>
 #include <babeltrace/graph/port-internal.h>
 #include <babeltrace/graph/connection-internal.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 static
 void destroy_port(struct bt_object *obj)
@@ -171,3 +170,33 @@ void *bt_self_component_port_get_data(const struct bt_self_component_port *port)
        BT_ASSERT_PRE_NON_NULL(port, "Port");
        return ((struct bt_port *) port)->user_data;
 }
+
+void bt_port_get_ref(const struct bt_port *port)
+{
+       bt_object_get_ref(port);
+}
+
+void bt_port_put_ref(const struct bt_port *port)
+{
+       bt_object_put_ref(port);
+}
+
+void bt_port_input_get_ref(const struct bt_port_input *port_input)
+{
+       bt_object_get_ref(port_input);
+}
+
+void bt_port_input_put_ref(const struct bt_port_input *port_input)
+{
+       bt_object_put_ref(port_input);
+}
+
+void bt_port_output_get_ref(const struct bt_port_output *port_output)
+{
+       bt_object_get_ref(port_output);
+}
+
+void bt_port_output_put_ref(const struct bt_port_output *port_output)
+{
+       bt_object_put_ref(port_output);
+}
index 4ef28cc73515d7ea5c4a83c34daf280b1db55ef0..c7613ce9adc65626546879d47592e43507bb165b 100644 (file)
@@ -23,6 +23,8 @@
 #define BT_LOG_TAG "QUERY-EXECUTOR"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/graph/query-executor-const.h>
 #include <babeltrace/graph/query-executor.h>
 #include <babeltrace/graph/query-executor-internal.h>
 #include <babeltrace/value.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 static
 void bt_query_executor_destroy(struct bt_object *obj)
@@ -157,3 +156,13 @@ bt_bool bt_query_executor_is_canceled(const struct bt_query_executor *query_exec
        BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor");
        return query_exec->canceled;
 }
+
+void bt_query_executor_get_ref(const struct bt_query_executor *query_executor)
+{
+       bt_object_get_ref(query_executor);
+}
+
+void bt_query_executor_put_ref(const struct bt_query_executor *query_executor)
+{
+       bt_object_put_ref(query_executor);
+}
index 46ac3a54d490d31c588dcaf18df1d140d2f5bb08..d3d709bb887a5c752e6de41a7d6fafcaee3f5ef2 100644 (file)
@@ -30,6 +30,8 @@
 #include <stdint.h>
 #include <wchar.h>
 #include <glib.h>
+#include <babeltrace/lib-logging-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/common-internal.h>
 #include <babeltrace/lib-logging-internal.h>
 #include <babeltrace/value-internal.h>
index 1612a05c481599ba527bf7ec3e558ff4cb0c2ba3..3b88650a816a9d6ebdbf9df7e7d1573d15ed5ea4 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <stdint.h>
 #include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/object-pool-internal.h>
 
 int bt_object_pool_initialize(struct bt_object_pool *pool,
diff --git a/lib/object.c b/lib/object.c
deleted file mode 100644 (file)
index f28831d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright (c) 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * 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_LOG_TAG "OBJECT"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/object-internal.h>
-
-void bt_object_get_ref(const void *ptr)
-{
-       struct bt_object *obj = (void *) ptr;
-
-       if (unlikely(!obj)) {
-               goto end;
-       }
-
-       BT_ASSERT_PRE(obj->is_shared, "Object is not shared: addr=%p", obj);
-       bt_object_get_no_null_check(obj);
-
-end:
-       return;
-}
-
-void bt_object_put_ref(const void *ptr)
-{
-       struct bt_object *obj = (void *) ptr;
-
-       if (unlikely(!obj)) {
-               return;
-       }
-
-       BT_ASSERT_PRE(obj->is_shared, "Object is not shared: addr=%p", obj);
-       BT_ASSERT_PRE(bt_object_get_ref_count(obj) > 0,
-               "Decrementing a reference count set to 0: addr=%p", ptr);
-       bt_object_put_no_null_check(obj);
-}
index 35233b81c54b693b4d62ef974a6b47c3dfaac758..b06a1b6b689538478ae7fd29e40b2552c6ae4c6a 100644 (file)
@@ -26,8 +26,9 @@
 #define BT_LOG_TAG "PLUGIN-SO"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/plugin/plugin-internal.h>
 #include <babeltrace/plugin/plugin-so-internal.h>
 #include <babeltrace/plugin/plugin-dev.h>
@@ -39,7 +40,6 @@
 #include <babeltrace/graph/component-class-sink.h>
 #include <babeltrace/types.h>
 #include <babeltrace/list-internal.h>
-#include <babeltrace/assert-internal.h>
 #include <string.h>
 #include <stdlib.h>
 #include <glib.h>
index 09d85974a694c4f1506b3687760518904254af96..1d7661de67611fb23730a9a7e0f8ce684f0efc1e 100644 (file)
 #define BT_LOG_TAG "PLUGIN"
 #include <babeltrace/lib-logging-internal.h>
 
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/common-internal.h>
 #include <babeltrace/plugin/plugin-internal.h>
 #include <babeltrace/plugin/plugin-so-internal.h>
@@ -36,8 +37,6 @@
 #include <babeltrace/graph/component-class-const.h>
 #include <babeltrace/graph/component-class-internal.h>
 #include <babeltrace/types.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 #include <glib.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -613,3 +612,23 @@ bt_plugin_borrow_sink_component_class_by_name_const(
        return (const void *) borrow_component_class_by_name(plugin,
                plugin->sink_comp_classes, name);
 }
+
+void bt_plugin_get_ref(const struct bt_plugin *plugin)
+{
+       bt_object_get_ref(plugin);
+}
+
+void bt_plugin_put_ref(const struct bt_plugin *plugin)
+{
+       bt_object_put_ref(plugin);
+}
+
+void bt_plugin_set_get_ref(const struct bt_plugin_set *plugin_set)
+{
+       bt_object_get_ref(plugin_set);
+}
+
+void bt_plugin_set_put_ref(const struct bt_plugin_set *plugin_set)
+{
+       bt_object_put_ref(plugin_set);
+}
index af8a49365ac0e6e167af0a6d7d2ef2cd4bb7ba1b..8c1a0823e1ce23d99c6949e420b47740c33097b0 100644 (file)
 #define BT_LOG_TAG "ATTRS"
 #include <babeltrace/lib-logging-internal.h>
 
-#include <babeltrace/object.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/value.h>
+#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object-internal.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/value-internal.h>
 #include <babeltrace/trace-ir/attributes-internal.h>
index fd82342ff9d689de3034e21c7c0333cc29ef8a92..45b47c1e139179b8791afebf1f49b5c213891885 100644 (file)
@@ -29,7 +29,6 @@
 #include <babeltrace/trace-ir/clock-class-internal.h>
 #include <babeltrace/trace-ir/clock-value-internal.h>
 #include <babeltrace/trace-ir/utils-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/compat/string-internal.h>
@@ -322,3 +321,13 @@ int bt_clock_class_cycles_to_ns_from_origin(
 
        return ret;
 }
+
+void bt_clock_class_get_ref(const struct bt_clock_class *clock_class)
+{
+       bt_object_get_ref(clock_class);
+}
+
+void bt_clock_class_put_ref(const struct bt_clock_class *clock_class)
+{
+       bt_object_put_ref(clock_class);
+}
index a89fdca9f060ff78586875372108cf3327e91cf1..8bd2b1cbef923a7381c87748a8865060370b6794 100644 (file)
@@ -27,7 +27,6 @@
 #include <babeltrace/compat/uuid-internal.h>
 #include <babeltrace/trace-ir/clock-class-internal.h>
 #include <babeltrace/trace-ir/clock-value-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/types.h>
 #include <babeltrace/compat/string-internal.h>
index 52d23a6bb66d75fe0fc76baa63b577c2510a90e8..0c8b9f6cda42f183ed724a2c69b84d2f80e37d52 100644 (file)
@@ -38,7 +38,6 @@
 #include <babeltrace/trace-ir/trace-internal.h>
 #include <babeltrace/trace-ir/utils-internal.h>
 #include <babeltrace/trace-ir/resolve-field-path-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/trace-ir/attributes-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/endian-internal.h>
@@ -387,3 +386,13 @@ void _bt_event_class_freeze(const struct bt_event_class *event_class)
        BT_LIB_LOGD("Freezing event class: %!+E", event_class);
        ((struct bt_event_class *) event_class)->frozen = true;
 }
+
+void bt_event_class_get_ref(const struct bt_event_class *event_class)
+{
+       bt_object_get_ref(event_class);
+}
+
+void bt_event_class_put_ref(const struct bt_event_class *event_class)
+{
+       bt_object_put_ref(event_class);
+}
index 433963ca8ecc46b62254c75ce7111b593e3ccb5a..d65d76379f37240d2bd701ab7e26cdf2bd210270 100644 (file)
 #include <babeltrace/trace-ir/trace.h>
 #include <babeltrace/trace-ir/trace-internal.h>
 #include <babeltrace/trace-ir/packet-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/trace-ir/attributes-internal.h>
-#include <babeltrace/compiler-internal.h>
 #include <babeltrace/assert-internal.h>
+#include <babeltrace/compiler-internal.h>
 #include <inttypes.h>
 
 BT_HIDDEN
index ed7b2121b9513212aeb7dc97a97f14d4a9575bd4..2361c5d5b805240a72e183b91803d5b89616ebc0 100644 (file)
 #include <babeltrace/trace-ir/field-const.h>
 #include <babeltrace/trace-ir/field.h>
 #include <babeltrace/trace-ir/utils-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/trace-ir/clock-class.h>
 #include <babeltrace/trace-ir/clock-class-internal.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/endian-internal.h>
 #include <babeltrace/assert-internal.h>
@@ -1196,3 +1194,13 @@ void _bt_field_class_make_part_of_trace_class(const struct bt_field_class *c_fc)
                break;
        }
 }
+
+void bt_field_class_get_ref(const struct bt_field_class *field_class)
+{
+       bt_object_get_ref(field_class);
+}
+
+void bt_field_class_put_ref(const struct bt_field_class *field_class)
+{
+       bt_object_put_ref(field_class);
+}
index ca0c81be8d3a6ef5acce4afd8848acd0ef30faf7..3303134b08ba3e248024642ac18ff90dd12877eb 100644 (file)
@@ -29,7 +29,6 @@
 #include <babeltrace/trace-ir/field-class-internal.h>
 #include <babeltrace/trace-ir/field-path-internal.h>
 #include <babeltrace/trace-ir/field-path-const.h>
-#include <babeltrace/object.h>
 #include <limits.h>
 #include <stdint.h>
 #include <inttypes.h>
@@ -98,3 +97,13 @@ uint64_t bt_field_path_get_index_by_index(
        BT_ASSERT_PRE_VALID_INDEX(index, field_path->indexes->len);
        return bt_field_path_get_index_by_index_inline(field_path, index);
 }
+
+void bt_field_path_get_ref(const struct bt_field_path *field_path)
+{
+       bt_object_get_ref(field_path);
+}
+
+void bt_field_path_put_ref(const struct bt_field_path *field_path)
+{
+       bt_object_put_ref(field_path);
+}
index 8880611810e7b9ad9303d42fe8cda690c6422ecd..ef0319630855bd1c950b4c9ee1f6353acfe8f5e7 100644 (file)
@@ -30,7 +30,6 @@
 #include <babeltrace/trace-ir/field-internal.h>
 #include <babeltrace/trace-ir/field-class-internal.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/compat/fcntl-internal.h>
 #include <babeltrace/align-internal.h>
index 6a5d3f90c607dd2baed664f199291facdb936afa..cf320389dace89cfa34af3d61024146a636a4151 100644 (file)
@@ -37,7 +37,6 @@
 #include <babeltrace/trace-ir/clock-value-internal.h>
 #include <babeltrace/trace-ir/trace-internal.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/assert-internal.h>
 #include <inttypes.h>
 
@@ -506,3 +505,13 @@ void bt_packet_set_packet_counter_snapshot(struct bt_packet *packet,
                "%![packet-]+a", packet);
        bt_property_uint_set(&packet->packet_counter_snapshot, value);
 }
+
+void bt_packet_get_ref(const struct bt_packet *packet)
+{
+       bt_object_get_ref(packet);
+}
+
+void bt_packet_put_ref(const struct bt_packet *packet)
+{
+       bt_object_put_ref(packet);
+}
index 0254dd425455d2d8b60fc55c6f7f41bce6522f55..00ec6447b49fd9f00e75ac814a21bb44a6271180 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/assert-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/trace-ir/field-class-internal.h>
 #include <babeltrace/trace-ir/field-path-internal.h>
 #include <babeltrace/trace-ir/field-path-const.h>
index 49a3f350cdc7295271d4a981a7f2e401a3831b67..b032b8ee6f2f2a704a2033d22fad80d1b2318a63 100644 (file)
@@ -35,7 +35,6 @@
 #include <babeltrace/trace-ir/utils-internal.h>
 #include <babeltrace/trace-ir/field-wrapper-internal.h>
 #include <babeltrace/trace-ir/resolve-field-path-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/align-internal.h>
 #include <babeltrace/endian-internal.h>
@@ -601,3 +600,13 @@ bt_bool bt_stream_class_default_clock_is_always_known(
        /* BT_CLOCK_VALUE_STATUS_UNKNOWN is not supported as of 2.0 */
        return BT_TRUE;
 }
+
+void bt_stream_class_get_ref(const struct bt_stream_class *stream_class)
+{
+       bt_object_get_ref(stream_class);
+}
+
+void bt_stream_class_put_ref(const struct bt_stream_class *stream_class)
+{
+       bt_object_put_ref(stream_class);
+}
index 503717506e86559afe9ef81ccf34de302834a3a4..b578d3be66da7b2a6554968ca8462471b74e550e 100644 (file)
@@ -33,7 +33,6 @@
 #include <babeltrace/trace-ir/trace.h>
 #include <babeltrace/trace-ir/trace-internal.h>
 #include <babeltrace/trace-ir/packet-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/align-internal.h>
 #include <babeltrace/assert-internal.h>
@@ -233,3 +232,13 @@ void _bt_stream_freeze(const struct bt_stream *stream)
        BT_LIB_LOGD("Freezing stream: %!+s", stream);
        ((struct bt_stream *) stream)->frozen = true;
 }
+
+void bt_stream_get_ref(const struct bt_stream *stream)
+{
+       bt_object_get_ref(stream);
+}
+
+void bt_stream_put_ref(const struct bt_stream *stream)
+{
+       bt_object_put_ref(stream);
+}
index 6bff90a7b99fcd2399dc8d679453dbbc37e015d0..265aa73a137027107482413d7213bc888411edbb 100644 (file)
@@ -45,7 +45,6 @@
 #include <babeltrace/value.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/value-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/types.h>
 #include <babeltrace/endian-internal.h>
 #include <babeltrace/assert-internal.h>
@@ -419,3 +418,13 @@ void bt_trace_class_set_assigns_automatic_stream_class_id(struct bt_trace_class
        BT_LIB_LOGV("Set trace class's automatic stream class ID "
                "assignment property: %!+T", tc);
 }
+
+void bt_trace_class_get_ref(const struct bt_trace_class *trace_class)
+{
+       bt_object_get_ref(trace_class);
+}
+
+void bt_trace_class_put_ref(const struct bt_trace_class *trace_class)
+{
+       bt_object_put_ref(trace_class);
+}
index d30e3ccd79dfb081d729cd218d70256b7bfe0674..46380fd3309fd2465cf84e5747fdf8b1a7f060ca 100644 (file)
@@ -46,7 +46,6 @@
 #include <babeltrace/value.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/value-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/types.h>
 #include <babeltrace/endian-internal.h>
 #include <babeltrace/assert-internal.h>
@@ -416,3 +415,13 @@ const struct bt_trace_class *bt_trace_borrow_class_const(
 {
        return bt_trace_borrow_class((void *) trace);
 }
+
+void bt_trace_get_ref(const struct bt_trace *trace)
+{
+       bt_object_get_ref(trace);
+}
+
+void bt_trace_put_ref(const struct bt_trace *trace)
+{
+       bt_object_put_ref(trace);
+}
index 54063b9471f20a7e51c6b48ef281b4bd2041a1e3..508c579014ee0651844abda5d0bd86560f56da84 100644 (file)
@@ -28,5 +28,4 @@
 #include <glib.h>
 #include <babeltrace/trace-ir/field-class-internal.h>
 #include <babeltrace/trace-ir/clock-class.h>
-#include <babeltrace/object.h>
 #include <babeltrace/assert-internal.h>
index 93c2d832ac8c439e0a2bd6765cb54f6d18ea84be..eb78ca9ecd10b5ba975ad0776c4d4b47b9a9f852 100644 (file)
 #include <inttypes.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/common-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/value-const.h>
 #include <babeltrace/value.h>
 #include <babeltrace/compat/glib-internal.h>
 #include <babeltrace/types.h>
+#include <babeltrace/assert-pre-internal.h>
 #include <babeltrace/object-internal.h>
 #include <babeltrace/value-internal.h>
 #include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
 
 #define BT_VALUE_FROM_CONCRETE(_concrete) ((struct bt_value *) (_concrete))
 #define BT_VALUE_TO_BOOL(_base) ((struct bt_value_bool *) (_base))
@@ -1299,3 +1298,13 @@ bt_bool bt_value_compare(const struct bt_value *object_a,
 end:
        return ret;
 }
+
+void bt_value_get_ref(const struct bt_value *value)
+{
+       bt_object_get_ref(value);
+}
+
+void bt_value_put_ref(const struct bt_value *value)
+{
+       bt_object_put_ref(value);
+}
index 40d5b2a16b7c3779c4f27c5b59d42d921ad3bdda..6ddd1dd1a838db35d74294a19f51fc04cfaab77b 100644 (file)
@@ -37,7 +37,6 @@
 #include <babeltrace/bitfield-internal.h>
 #include <babeltrace/common-internal.h>
 #include <babeltrace/babeltrace.h>
-#include <babeltrace/object.h>
 #include <babeltrace/align-internal.h>
 #include <glib.h>
 
index ddd24f4fc23082fbcf682a1717b53c723119a87b..4b5e219a8584a9cee4d7e1d5206d843aa6b6429c 100644 (file)
@@ -151,7 +151,7 @@ struct bt_field_class *ctf_field_class_struct_to_ir(
                ret = bt_field_class_structure_append_member(
                        ir_fc, named_fc->name->str, member_ir_fc);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(member_ir_fc);
+               bt_field_class_put_ref(member_ir_fc);
        }
 
        return ir_fc;
@@ -205,7 +205,7 @@ struct bt_field_class *ctf_field_class_variant_to_ir(
                ret = bt_field_class_variant_append_option(
                        ir_fc, named_fc->name->str, option_ir_fc);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(option_ir_fc);
+               bt_field_class_put_ref(option_ir_fc);
        }
 
        return ir_fc;
@@ -232,7 +232,7 @@ struct bt_field_class *ctf_field_class_array_to_ir(
        ir_fc = bt_field_class_static_array_create(elem_ir_fc,
                fc->length);
        BT_ASSERT(ir_fc);
-       bt_object_put_ref(elem_ir_fc);
+       bt_field_class_put_ref(elem_ir_fc);
 
 end:
        return ir_fc;
@@ -259,7 +259,7 @@ struct bt_field_class *ctf_field_class_sequence_to_ir(
        BT_ASSERT(elem_ir_fc);
        ir_fc = bt_field_class_dynamic_array_create(elem_ir_fc);
        BT_ASSERT(ir_fc);
-       bt_object_put_ref(elem_ir_fc);
+       bt_field_class_put_ref(elem_ir_fc);
        BT_ASSERT(ir_fc);
        ret = bt_field_class_dynamic_array_set_length_field_class(
                ir_fc,
@@ -407,7 +407,7 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec,
 
        ir_ec = bt_event_class_create_with_id(ir_sc, ec->id);
        BT_ASSERT(ir_ec);
-       bt_object_put_ref(ir_ec);
+       bt_event_class_put_ref(ir_ec);
 
        if (ec->spec_context_fc) {
                struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
@@ -417,7 +417,7 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec,
                        ret = bt_event_class_set_specific_context_field_class(
                                ir_ec, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -429,7 +429,7 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec,
                        ret = bt_event_class_set_payload_field_class(ir_ec,
                                ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -471,7 +471,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
 
        ir_sc = bt_stream_class_create_with_id(ir_tc, sc->id);
        BT_ASSERT(ir_sc);
-       bt_object_put_ref(ir_sc);
+       bt_stream_class_put_ref(ir_sc);
 
        if (sc->packet_context_fc) {
                struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
@@ -481,7 +481,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                        ret = bt_stream_class_set_packet_context_field_class(
                                ir_sc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -493,7 +493,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                        ret = bt_stream_class_set_event_header_field_class(
                                ir_sc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -505,7 +505,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc,
                        ret = bt_stream_class_set_event_common_context_field_class(
                                ir_sc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
@@ -581,7 +581,7 @@ int ctf_trace_class_to_ir(struct bt_trace_class *ir_tc,
                        ret = bt_trace_class_set_packet_header_field_class(
                                ir_tc, ir_fc);
                        BT_ASSERT(ret == 0);
-                       bt_object_put_ref(ir_fc);
+                       bt_field_class_put_ref(ir_fc);
                }
        }
 
index d000c688860c1b45d529e3d46abf9ac2e29ab1dc..8bc957f2b22c37ce5b4a54467d1ecdf0a36aa7f2 100644 (file)
@@ -161,7 +161,7 @@ int update_stream_class_default_clock_class(
 
        if (!stream_class->default_clock_class) {
                stream_class->default_clock_class = clock_class;
-               bt_object_get_ref(stream_class->default_clock_class);
+               bt_clock_class_get_ref(stream_class->default_clock_class);
        }
 
 end:
index 76e24d4274fea6c17b62213cd85f529c46b9cf6e..a52995251998fc0220b1d2bac2d9d7ccaba559b3 100644 (file)
@@ -471,7 +471,7 @@ static inline
 void _ctf_field_class_int_destroy(struct ctf_field_class_int *fc)
 {
        BT_ASSERT(fc);
-       bt_object_put_ref(fc->mapped_clock_class);
+       bt_clock_class_put_ref(fc->mapped_clock_class);
        g_free(fc);
 }
 
@@ -479,7 +479,7 @@ static inline
 void _ctf_field_class_enum_destroy(struct ctf_field_class_enum *fc)
 {
        BT_ASSERT(fc);
-       bt_object_put_ref(fc->base.mapped_clock_class);
+       bt_clock_class_put_ref(fc->base.mapped_clock_class);
 
        if (fc->mappings) {
                uint64_t i;
@@ -1108,7 +1108,7 @@ void ctf_field_class_int_copy_content(
        dst_fc->disp_base = src_fc->disp_base;
        dst_fc->encoding = src_fc->encoding;
        dst_fc->mapped_clock_class = src_fc->mapped_clock_class;
-       bt_object_get_ref(dst_fc->mapped_clock_class);
+       bt_clock_class_get_ref(dst_fc->mapped_clock_class);
        dst_fc->storing_index = src_fc->storing_index;
 }
 
@@ -1397,7 +1397,7 @@ void ctf_stream_class_destroy(struct ctf_stream_class *sc)
        ctf_field_class_destroy(sc->packet_context_fc);
        ctf_field_class_destroy(sc->event_header_fc);
        ctf_field_class_destroy(sc->event_common_context_fc);
-       bt_object_put_ref(sc->default_clock_class);
+       bt_clock_class_put_ref(sc->default_clock_class);
        g_free(sc);
 }
 
@@ -1451,7 +1451,7 @@ struct ctf_trace_class *ctf_trace_class_create(void)
        BT_ASSERT(tc);
        tc->default_byte_order = -1;
        tc->clock_classes = g_ptr_array_new_with_free_func(
-               (GDestroyNotify) bt_object_put_ref);
+               (GDestroyNotify) bt_clock_class_put_ref);
        BT_ASSERT(tc->clock_classes);
        tc->stream_classes = g_ptr_array_new_with_free_func(
                (GDestroyNotify) ctf_stream_class_destroy);
index e57d0b30648128eebb8f9b80b489ddb25c1795cf..c225491b9c304b39f851b92413599f16072b341e 100644 (file)
@@ -551,7 +551,7 @@ void ctx_destroy(struct ctx *ctx)
                scope = parent_scope;
        }
 
-       bt_object_put_ref(ctx->trace_class);
+       bt_trace_class_put_ref(ctx->trace_class);
 
        if (ctx->ctf_tc) {
                ctf_trace_class_destroy(ctx->ctf_tc);
@@ -2705,7 +2705,7 @@ int visit_integer_decl(struct ctx *ctx,
        (*integer_decl)->disp_base = base;
        (*integer_decl)->encoding = encoding;
        (*integer_decl)->mapped_clock_class = mapped_clock_class;
-       bt_object_get_ref((*integer_decl)->mapped_clock_class);
+       bt_clock_class_get_ref((*integer_decl)->mapped_clock_class);
        return 0;
 
 error:
@@ -3599,7 +3599,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                BT_ASSERT(ret == 0);
                g_ptr_array_add(ctx->ctf_tc->clock_classes,
                        clock_class_to_map_to);
-               bt_object_get_ref(clock_class_to_map_to);
+               bt_clock_class_get_ref(clock_class_to_map_to);
                break;
        case 1:
                /*
@@ -3607,7 +3607,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                 * this one.
                 */
                clock_class_to_map_to = ctx->ctf_tc->clock_classes->pdata[0];
-               bt_object_get_ref(clock_class_to_map_to);
+               bt_clock_class_get_ref(clock_class_to_map_to);
                break;
        default:
                /*
@@ -3622,10 +3622,10 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
 
        BT_ASSERT(clock_class_to_map_to);
        int_fc->mapped_clock_class = clock_class_to_map_to;
-       bt_object_get_ref(int_fc->mapped_clock_class);
+       bt_clock_class_get_ref(int_fc->mapped_clock_class);
 
 end:
-       bt_object_put_ref(clock_class_to_map_to);
+       bt_clock_class_put_ref(clock_class_to_map_to);
        return ret;
 }
 
@@ -4729,10 +4729,10 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node)
        bt_clock_class_set_offset(clock, offset_seconds, offset_cycles);
        apply_clock_class_offset(ctx, clock);
        g_ptr_array_add(ctx->ctf_tc->clock_classes, clock);
-       bt_object_get_ref(clock);
+       bt_clock_class_get_ref(clock);
 
 end:
-       BT_OBJECT_PUT_REF_AND_RESET(clock);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock);
        return ret;
 }
 
@@ -4837,7 +4837,7 @@ struct bt_trace_class *ctf_visitor_generate_ir_get_ir_trace_class(
 
        BT_ASSERT(ctx);
        BT_ASSERT(ctx->trace_class);
-       bt_object_get_ref(ctx->trace_class);
+       bt_trace_class_get_ref(ctx->trace_class);
        return ctx->trace_class;
 }
 
index 501c3004dcbabd0e2a5f9d04506ac66cb2793107..a9e35552fc039ed29a0740439fd2c6645744ecde 100644 (file)
@@ -801,7 +801,7 @@ enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit)
        stream = notit->medium.medops.borrow_stream(
                notit->meta.sc->ir_sc, notit->cur_data_stream_id,
                notit->medium.data);
-       bt_object_get_ref(stream);
+       bt_stream_get_ref(stream);
        BT_LOGV("User function returned: stream-addr=%p", stream);
        if (!stream) {
                BT_LOGW_STR("User function failed to return a stream object "
@@ -817,10 +817,10 @@ enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit)
                goto end;
        }
 
-       BT_OBJECT_MOVE_REF(notit->stream, stream);
+       BT_STREAM_MOVE_REF(notit->stream, stream);
 
 end:
-       bt_object_put_ref(stream);
+       bt_stream_put_ref(stream);
        return status;
 }
 
@@ -855,11 +855,11 @@ enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit)
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(packet);
+       BT_PACKET_PUT_REF_AND_RESET(packet);
        status = BT_NOTIF_ITER_STATUS_ERROR;
 
 end:
-       BT_OBJECT_MOVE_REF(notit->packet, packet);
+       BT_PACKET_MOVE_REF(notit->packet, packet);
        return status;
 }
 
@@ -1215,11 +1215,11 @@ enum bt_notif_iter_status set_current_event_notification(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(notif);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
        status = BT_NOTIF_ITER_STATUS_ERROR;
 
 end:
-       BT_OBJECT_MOVE_REF(notit->event_notif, notif);
+       BT_NOTIFICATION_MOVE_REF(notit->event_notif, notif);
        return status;
 }
 
@@ -1571,9 +1571,9 @@ void bt_notif_iter_reset(struct bt_notif_iter *notit)
        stack_clear(notit->stack);
        notit->meta.sc = NULL;
        notit->meta.ec = NULL;
-       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(notit->stream);
-       BT_OBJECT_PUT_REF_AND_RESET(notit->event_notif);
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_STREAM_PUT_REF_AND_RESET(notit->stream);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(notit->event_notif);
        release_all_dscopes(notit);
        notit->cur_dscope_field = NULL;
 
@@ -1628,8 +1628,8 @@ int bt_notif_iter_switch_packet(struct bt_notif_iter *notit)
                notit->cur_packet_offset);
        stack_clear(notit->stack);
        notit->meta.ec = NULL;
-       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(notit->event_notif);
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(notit->event_notif);
        release_all_dscopes(notit);
        notit->cur_dscope_field = NULL;
 
@@ -2268,7 +2268,7 @@ void notify_new_stream(struct bt_notif_iter *notit,
 
        status = set_current_stream(notit);
        if (status != BT_NOTIF_ITER_STATUS_OK) {
-               BT_OBJECT_PUT_REF_AND_RESET(ret);
+               BT_NOTIFICATION_PUT_REF_AND_RESET(ret);
                goto end;
        }
 
@@ -2433,7 +2433,7 @@ void notify_end_of_packet(struct bt_notif_iter *notit,
 
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
        *notification = notif;
 }
 
@@ -2508,8 +2508,8 @@ error:
 
 void bt_notif_iter_destroy(struct bt_notif_iter *notit)
 {
-       BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
-       BT_OBJECT_PUT_REF_AND_RESET(notit->stream);
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_STREAM_PUT_REF_AND_RESET(notit->stream);
        release_all_dscopes(notit);
 
        BT_LOGD("Destroying CTF plugin notification iterator: addr=%p", notit);
index b386eec88c14f6bf02d968ee4a49e94569a1e4b8..55d7b3449e55d43e7fb8324f2ce465b09a543fea 100644 (file)
 static
 void unref_stream_class(const struct bt_stream_class *writer_stream_class)
 {
-       bt_object_put_ref(writer_stream_class);
+       bt_stream_class_put_ref(writer_stream_class);
 }
 
 static
 void unref_stream(const struct bt_stream_class *writer_stream)
 {
-       bt_object_put_ref(writer_stream);
+       bt_stream_class_put_ref(writer_stream);
 }
 
 static
@@ -145,10 +145,10 @@ const struct bt_stream_class *insert_new_stream_class(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream_class);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(writer_stream_class);
 end:
-       bt_object_put_ref(writer_trace);
-       bt_object_put_ref(trace);
+       bt_trace_put_ref(writer_trace);
+       bt_trace_put_ref(trace);
        return writer_stream_class;
 }
 
@@ -328,7 +328,7 @@ struct fs_writer *insert_new_writer(
        fs_writer->trace = trace;
        fs_writer->writer_trace = writer_trace;
        fs_writer->writer_component = writer_component;
-       BT_OBJECT_PUT_REF_AND_RESET(writer_trace);
+       BT_TRACE_PUT_REF_AND_RESET(writer_trace);
        fs_writer->stream_class_map = g_hash_table_new_full(g_direct_hash,
                        g_direct_equal, NULL, (GDestroyNotify) unref_stream_class);
        fs_writer->stream_map = g_hash_table_new_full(g_direct_hash,
@@ -343,7 +343,7 @@ struct fs_writer *insert_new_writer(
                BT_ASSERT(stream);
 
                insert_new_stream_state(writer_component, fs_writer, stream);
-               BT_OBJECT_PUT_REF_AND_RESET(stream);
+               BT_STREAM_PUT_REF_AND_RESET(stream);
        }
 
        /* Check if the trace is already static or register a listener. */
@@ -366,8 +366,8 @@ struct fs_writer *insert_new_writer(
 error:
        g_free(fs_writer);
        fs_writer = NULL;
-       bt_object_put_ref(writer_trace);
-       bt_object_put_ref(stream);
+       bt_trace_put_ref(writer_trace);
+       bt_stream_put_ref(stream);
        BT_OBJECT_PUT_REF_AND_RESET(ctf_writer);
 end:
        return fs_writer;
@@ -388,7 +388,7 @@ struct fs_writer *get_fs_writer(struct writer_component *writer_component,
        if (!fs_writer) {
                fs_writer = insert_new_writer(writer_component, trace);
        }
-       BT_OBJECT_PUT_REF_AND_RESET(trace);
+       BT_TRACE_PUT_REF_AND_RESET(trace);
 
        return fs_writer;
 }
@@ -406,7 +406,7 @@ struct fs_writer *get_fs_writer_from_stream(
 
        fs_writer = get_fs_writer(writer_component, stream_class);
 
-       bt_object_put_ref(stream_class);
+       bt_stream_class_put_ref(stream_class);
        return fs_writer;
 }
 
@@ -454,7 +454,7 @@ const struct bt_stream *insert_new_stream(
                        goto error;
                }
        }
-       bt_object_get_ref(writer_stream_class);
+       bt_stream_class_get_ref(writer_stream_class);
 
        writer_stream = bt_stream_create(writer_stream_class,
                bt_stream_get_name(stream));
@@ -466,10 +466,10 @@ const struct bt_stream *insert_new_stream(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+       BT_STREAM_PUT_REF_AND_RESET(writer_stream);
 end:
        bt_object_put_ref(ctf_writer);
-       bt_object_put_ref(writer_stream_class);
+       bt_stream_class_put_ref(writer_stream_class);
        return writer_stream;
 }
 
@@ -494,12 +494,12 @@ const struct bt_stream *get_writer_stream(
                BT_LOGE_STR("Failed to find existing stream.");
                goto error;
        }
-       bt_object_get_ref(writer_stream);
+       bt_stream_get_ref(writer_stream);
 
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+       BT_STREAM_PUT_REF_AND_RESET(writer_stream);
 end:
        return writer_stream;
 }
index 7ff4584010f2759ad2da32043b0f01065a8049d9..74e0b7eb8dc3e34c0ad972076c9b300ecfaa1c02 100644 (file)
@@ -132,7 +132,7 @@ enum bt_component_status handle_notification(
                }
 
                ret = writer_new_packet(writer_component, packet);
-               bt_object_put_ref(packet);
+               bt_packet_put_ref(packet);
                break;
        }
        case BT_NOTIFICATION_TYPE_PACKET_END:
@@ -145,7 +145,7 @@ enum bt_component_status handle_notification(
                        goto end;
                }
                ret = writer_close_packet(writer_component, packet);
-               bt_object_put_ref(packet);
+               bt_packet_put_ref(packet);
                break;
        }
        case BT_NOTIFICATION_TYPE_EVENT:
@@ -174,7 +174,7 @@ enum bt_component_status handle_notification(
                        goto end;
                }
                ret = writer_stream_begin(writer_component, stream);
-               bt_object_put_ref(stream);
+               bt_stream_put_ref(stream);
                break;
        }
        case BT_NOTIFICATION_TYPE_STREAM_END:
@@ -187,7 +187,7 @@ enum bt_component_status handle_notification(
                        goto end;
                }
                ret = writer_stream_end(writer_component, stream);
-               bt_object_put_ref(stream);
+               bt_stream_put_ref(stream);
                break;
        }
        default:
@@ -285,7 +285,7 @@ enum bt_component_status apply_one_bool(const char *key,
                *found = true;
        }
 end:
-       bt_object_put_ref(value);
+       bt_value_put_ref(value);
        return ret;
 }
 
index 803d424f518108c62879f1dba11966997bcbd4ef..b6e301ccaa33c71d28c5286ee098eee16d0309ed 100644 (file)
@@ -643,7 +643,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create(
        }
 
        ds_file->stream = stream;
-       bt_object_get_ref(ds_file->stream);
+       bt_stream_get_ref(ds_file->stream);
        ds_file->metadata = ctf_fs_trace->metadata;
        g_string_assign(ds_file->file->path, path);
        ret = ctf_fs_file_open(ds_file->file, "rb");
@@ -695,7 +695,7 @@ void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file)
                return;
        }
 
-       bt_object_put_ref(ds_file->stream);
+       bt_stream_put_ref(ds_file->stream);
        (void) ds_file_munmap(ds_file);
 
        if (ds_file->file) {
index 7241e732b4b0b2a382dc344079d7ef6a7b7c7147..abdf8e2b39a979b4247eb8406effb46c6847ef7b 100644 (file)
@@ -109,7 +109,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one(
                         * BT_NOTIFICATION_TYPE_STREAM_BEGINNING
                         * notification: skip this one, get a new one.
                         */
-                       BT_OBJECT_PUT_REF_AND_RESET(*notif);
+                       BT_NOTIFICATION_PUT_REF_AND_RESET(*notif);
                        status = ctf_fs_ds_file_next(notif_iter_data->ds_file,
                                &priv_notif);
                        *notif = priv_notif;
@@ -144,7 +144,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one(
                        goto end;
                }
 
-               BT_OBJECT_PUT_REF_AND_RESET(*notif);
+               BT_NOTIFICATION_PUT_REF_AND_RESET(*notif);
                bt_notif_iter_reset(notif_iter_data->notif_iter);
 
                /*
@@ -181,7 +181,7 @@ enum bt_self_notification_iterator_status ctf_fs_iterator_next_one(
                if (status == BT_SELF_NOTIFICATION_ITERATOR_STATUS_OK) {
                        BT_ASSERT(bt_notification_get_type(*notif) ==
                                BT_NOTIFICATION_TYPE_STREAM_BEGINNING);
-                       BT_OBJECT_PUT_REF_AND_RESET(*notif);
+                       BT_NOTIFICATION_PUT_REF_AND_RESET(*notif);
                        status = ctf_fs_ds_file_next(notif_iter_data->ds_file,
                                &priv_notif);
                        *notif = priv_notif;
@@ -322,7 +322,7 @@ void ctf_fs_trace_destroy(struct ctf_fs_trace *ctf_fs_trace)
                g_ptr_array_free(ctf_fs_trace->ds_file_groups, TRUE);
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(ctf_fs_trace->trace);
+       BT_TRACE_PUT_REF_AND_RESET(ctf_fs_trace->trace);
 
        if (ctf_fs_trace->path) {
                g_string_free(ctf_fs_trace->path, TRUE);
@@ -512,8 +512,8 @@ void ctf_fs_ds_file_group_destroy(struct ctf_fs_ds_file_group *ds_file_group)
                g_ptr_array_free(ds_file_group->ds_file_infos, TRUE);
        }
 
-       bt_object_put_ref(ds_file_group->stream);
-       bt_object_put_ref(ds_file_group->stream_class);
+       bt_stream_put_ref(ds_file_group->stream);
+       bt_stream_class_put_ref(ds_file_group->stream_class);
        g_free(ds_file_group);
 }
 
@@ -539,7 +539,7 @@ struct ctf_fs_ds_file_group *ctf_fs_ds_file_group_create(
        ds_file_group->stream_id = stream_instance_id;
        BT_ASSERT(stream_class);
        ds_file_group->stream_class = stream_class;
-       bt_object_get_ref(ds_file_group->stream_class);
+       bt_stream_class_get_ref(ds_file_group->stream_class);
        ds_file_group->ctf_fs_trace = ctf_fs_trace;
        goto end;
 
index 48d416c8b0b8edab8d6cf93096ba643bccf85070..7d480d1685acc7033dcb22f153ac5b4ff732a893 100644 (file)
@@ -145,7 +145,7 @@ void ctf_fs_metadata_fini(struct ctf_fs_metadata *metadata)
        }
 
        if (metadata->trace_class) {
-               BT_OBJECT_PUT_REF_AND_RESET(metadata->trace_class);
+               BT_TRACE_CLASS_PUT_REF_AND_RESET(metadata->trace_class);
        }
 
        if (metadata->decoder) {
index 6f2017b20688147e52806b96727bc9d011a4026a..7b2228662a9b3fc74f877b3ff8834516a9d54806 100644 (file)
@@ -158,7 +158,7 @@ enum bt_query_status metadata_info_query(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(result);
+       BT_VALUE_PUT_REF_AND_RESET(result);
        result = NULL;
 
        if (status >= 0) {
@@ -221,7 +221,7 @@ int add_range(struct bt_value *info, struct range *range,
        }
 
 end:
-       bt_object_put_ref(range_map);
+       bt_value_put_ref(range_map);
        return ret;
 }
 
@@ -336,7 +336,7 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
                goto end;
        }
 end:
-       bt_object_put_ref(file_paths);
+       bt_value_put_ref(file_paths);
        return ret;
 }
 
@@ -408,7 +408,7 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
 
                ret = populate_stream_info(group, group_info, &group_range);
                if (ret) {
-                       bt_object_put_ref(group_info);
+                       bt_value_put_ref(group_info);
                        goto end;
                }
 
@@ -427,7 +427,7 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
                        status = bt_value_array_append_element(
                                file_groups,
                                group_info);
-                       bt_object_put_ref(group_info);
+                       bt_value_put_ref(group_info);
                        if (status != BT_VALUE_STATUS_OK) {
                                goto end;
                        }
@@ -449,14 +449,14 @@ int populate_trace_info(const char *trace_path, const char *trace_name,
 
        status = bt_value_map_insert_entry(trace_info, "streams",
                file_groups);
-       BT_OBJECT_PUT_REF_AND_RESET(file_groups);
+       BT_VALUE_PUT_REF_AND_RESET(file_groups);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
                goto end;
        }
 
 end:
-       bt_object_put_ref(file_groups);
+       bt_value_put_ref(file_groups);
        ctf_fs_trace_destroy(trace);
        return ret;
 }
@@ -532,12 +532,12 @@ enum bt_query_status trace_info_query(
                ret = populate_trace_info(trace_path->str, trace_name->str,
                        trace_info);
                if (ret) {
-                       bt_object_put_ref(trace_info);
+                       bt_value_put_ref(trace_info);
                        goto error;
                }
 
                status = bt_value_array_append_element(result, trace_info);
-               bt_object_put_ref(trace_info);
+               bt_value_put_ref(trace_info);
                if (status != BT_VALUE_STATUS_OK) {
                        goto error;
                }
@@ -546,7 +546,7 @@ enum bt_query_status trace_info_query(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(result);
+       BT_VALUE_PUT_REF_AND_RESET(result);
        result = NULL;
 
        if (status >= 0) {
index 4878934837c902360c81279e7a017135de4c7b18..c61bff6ca6e2264bb543e2cacd861128b197a2c9 100644 (file)
@@ -76,7 +76,7 @@ void print_stream_state(struct lttng_live_stream_iterator *stream)
                print_state(stream),
                stream->last_returned_inactivity_timestamp,
                stream->current_inactivity_timestamp);
-       bt_object_put_ref(port);
+       bt_port_put_ref(port);
 }
 
 BT_HIDDEN
@@ -93,8 +93,8 @@ bt_bool lttng_live_is_canceled(struct lttng_live_component *lttng_live)
        component = bt_component_from_private(lttng_live->private_component);
        graph = bt_component_get_graph(component);
        ret = bt_graph_is_canceled(graph);
-       bt_object_put_ref(graph);
-       bt_object_put_ref(component);
+       bt_graph_put_ref(graph);
+       bt_component_put_ref(component);
        return ret;
 }
 
@@ -154,7 +154,7 @@ int lttng_live_remove_port(struct lttng_live_component *lttng_live,
        if (nr_ports < 0) {
                return -1;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(component);
+       BT_COMPONENT_PUT_REF_AND_RESET(component);
        if (nr_ports == 1) {
                enum bt_component_status status;
 
@@ -214,7 +214,7 @@ void lttng_live_destroy_trace(struct bt_object *obj)
 
                retval = bt_trace_set_is_static(trace->trace);
                BT_ASSERT(!retval);
-               BT_OBJECT_PUT_REF_AND_RESET(trace->trace);
+               BT_TRACE_PUT_REF_AND_RESET(trace->trace);
        }
        lttng_live_metadata_fini(trace);
        BT_OBJECT_PUT_REF_AND_RESET(trace->cc_prio_map);
@@ -590,12 +590,12 @@ enum bt_lttng_live_iterator_status emit_inactivity_notification(
        *notification = notif;
 end:
        bt_object_put_ref(clock_value);
-       bt_object_put_ref(clock_class);
+       bt_clock_class_put_ref(clock_class);
        return ret;
 
 error:
        ret = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
-       bt_object_put_ref(notif);
+       bt_notification_put_ref(notif);
        goto end;
 }
 
@@ -628,7 +628,7 @@ enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent
                        lttng_live_stream->current_inactivity_timestamp;
 end:
        bt_object_put_ref(clock_value);
-       bt_object_put_ref(clock_class);
+       bt_clock_class_put_ref(clock_class);
        return ret;
 }
 
@@ -999,7 +999,7 @@ end:
        if (viewer_connection) {
                bt_live_viewer_connection_destroy(viewer_connection);
        }
-       BT_OBJECT_PUT_REF_AND_RESET(url_value);
+       BT_VALUE_PUT_REF_AND_RESET(url_value);
        return query_ret;
 }
 
@@ -1085,7 +1085,7 @@ struct lttng_live_component *lttng_live_component_create(struct bt_value *params
        if (!lttng_live->url) {
                goto error;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(value);
+       BT_VALUE_PUT_REF_AND_RESET(value);
        lttng_live->viewer_connection =
                bt_live_viewer_connection_create(lttng_live->url->str, lttng_live);
        if (!lttng_live->viewer_connection) {
@@ -1164,7 +1164,7 @@ enum bt_component_status lttng_live_accept_port_connection(
        const struct bt_port *self_port = bt_port_from_private(self_private_port);
 
        other_component = bt_port_get_component(other_port);
-       bt_object_put_ref(other_component);     /* weak */
+       bt_component_put_ref(other_component);  /* weak */
 
        if (!lttng_live->downstream_component) {
                lttng_live->downstream_component = other_component;
@@ -1184,6 +1184,6 @@ enum bt_component_status lttng_live_accept_port_connection(
                goto end;
        }
 end:
-       bt_object_put_ref(self_port);
+       bt_port_put_ref(self_port);
        return status;
 }
index 4cfd88301572e7de05cc1f8b7177443040e642f1..0beb0f1ef9df921efb956aa1750806b9e0b407fc 100644 (file)
@@ -78,7 +78,7 @@ enum bt_lttng_live_iterator_status lttng_live_update_clock_map(
                BT_ASSERT(clock_class);
                ret = bt_clock_class_priority_map_add_clock_class(
                        trace->cc_prio_map, clock_class, 0);
-               BT_OBJECT_PUT_REF_AND_RESET(clock_class);
+               BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
 
                if (ret) {
                        goto error;
index f371095ce5eed5ccf87945993a58fe457cad8cc4..17fc234de4f4371938614de8e9248468f9d5a8f4 100644 (file)
@@ -351,7 +351,7 @@ enum bt_value_status list_update_session(struct bt_value *results,
                        if (ret != BT_VALUE_STATUS_OK) {
                                goto end;
                        }
-                       BT_OBJECT_PUT_REF_AND_RESET(btval);
+                       BT_VALUE_PUT_REF_AND_RESET(btval);
 
                        btval = bt_value_map_get(map, "client-count");
                        if (!btval) {
@@ -365,22 +365,22 @@ enum bt_value_status list_update_session(struct bt_value *results,
                        if (ret != BT_VALUE_STATUS_OK) {
                                goto end;
                        }
-                       BT_OBJECT_PUT_REF_AND_RESET(btval);
+                       BT_VALUE_PUT_REF_AND_RESET(btval);
                }
 
-               BT_OBJECT_PUT_REF_AND_RESET(hostname);
-               BT_OBJECT_PUT_REF_AND_RESET(session_name);
-               BT_OBJECT_PUT_REF_AND_RESET(map);
+               BT_VALUE_PUT_REF_AND_RESET(hostname);
+               BT_VALUE_PUT_REF_AND_RESET(session_name);
+               BT_VALUE_PUT_REF_AND_RESET(map);
 
                if (found) {
                        break;
                }
        }
 end:
-       BT_OBJECT_PUT_REF_AND_RESET(btval);
-       BT_OBJECT_PUT_REF_AND_RESET(hostname);
-       BT_OBJECT_PUT_REF_AND_RESET(session_name);
-       BT_OBJECT_PUT_REF_AND_RESET(map);
+       BT_VALUE_PUT_REF_AND_RESET(btval);
+       BT_VALUE_PUT_REF_AND_RESET(hostname);
+       BT_VALUE_PUT_REF_AND_RESET(session_name);
+       BT_VALUE_PUT_REF_AND_RESET(map);
        *_found = found;
        return ret;
 }
@@ -497,7 +497,7 @@ end:
        if (url) {
                g_string_free(url, TRUE);
        }
-       BT_OBJECT_PUT_REF_AND_RESET(map);
+       BT_VALUE_PUT_REF_AND_RESET(map);
        return ret;
 }
 
@@ -603,7 +603,7 @@ struct bt_value *bt_live_viewer_connection_list_sessions(struct bt_live_viewer_c
        }
        goto end;
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(results);
+       BT_VALUE_PUT_REF_AND_RESET(results);
 end:
        return results;
 }
index 5f7c7246e5c418dfebaaa3739360c7230c094726..c7199d8b81df017bf5631f703d5e24f566c03c4c 100644 (file)
@@ -91,7 +91,7 @@ int update_header_clock_int_field_type(FILE *err, struct bt_field_type *type,
        if (!clock) {
                return 0;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(clock);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock);
 
        ret = bt_field_type_integer_set_size(type, 64);
        if (ret) {
@@ -322,12 +322,12 @@ struct bt_field_type *override_header_type(FILE *err,
                BT_LOGE_STR("Failed to find clock fields in struct.");
                goto error;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
 
        goto end;
 
 error:
-       bt_object_put_ref(writer_clock_class);
+       bt_clock_class_put_ref(writer_clock_class);
        BT_OBJECT_PUT_REF_AND_RESET(new_type);
 end:
        return new_type;
@@ -732,7 +732,7 @@ const struct bt_clock_class *stream_class_get_clock_class(FILE *err,
        /* FIXME multi-clock? */
        clock_class = bt_trace_get_clock_class_by_index(trace, 0);
 
-       bt_object_put_ref(trace);
+       bt_trace_put_ref(trace);
 
        return clock_class;
 }
@@ -747,11 +747,11 @@ const struct bt_clock_class *event_get_clock_class(FILE *err, const struct bt_ev
        BT_ASSERT(event_class);
 
        stream_class = bt_event_class_get_stream_class(event_class);
-       BT_OBJECT_PUT_REF_AND_RESET(event_class);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(event_class);
        BT_ASSERT(stream_class);
 
        clock_class = stream_class_get_clock_class(err, stream_class);
-       bt_object_put_ref(stream_class);
+       bt_stream_class_put_ref(stream_class);
 
        return clock_class;
 }
@@ -773,7 +773,7 @@ int copy_find_clock_int_field(FILE *err,
        }
 
        clock_value = bt_event_get_clock_value(event, clock_class);
-       BT_OBJECT_PUT_REF_AND_RESET(clock_class);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
        BT_ASSERT(clock_value);
 
        ret = bt_clock_value_get_value(clock_value, &value);
@@ -793,7 +793,7 @@ int copy_find_clock_int_field(FILE *err,
        BT_ASSERT(writer_clock_class);
 
        writer_clock_value = bt_clock_value_create(writer_clock_class, value);
-       BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
        if (!writer_clock_value) {
                BT_LOGE_STR("Failed to create clock value.");
                goto error;
index 62ce7425a3cc6258f12bbfb09316c203fbe78d60..3ce5663fbf8ee433382346970a251b4359266ebf 100644 (file)
@@ -112,7 +112,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err,
                BT_ASSERT(clock_class);
 
                writer_clock_class = ctf_copy_clock_class(err, clock_class);
-               bt_object_put_ref(clock_class);
+               bt_clock_class_put_ref(clock_class);
                if (!writer_clock_class) {
                        BT_LOGE_STR("Failed to copy clock class.");
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -121,7 +121,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err,
 
                int_ret = bt_trace_add_clock_class(writer_trace, writer_clock_class);
                if (int_ret != 0) {
-                       BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class);
+                       BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
                        BT_LOGE_STR("Failed to add clock class.");
                        ret = BT_COMPONENT_STATUS_ERROR;
                        goto end;
@@ -130,7 +130,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err,
                /*
                 * Ownership transferred to the trace.
                 */
-               bt_object_put_ref(writer_clock_class);
+               bt_clock_class_put_ref(writer_clock_class);
        }
 
        ret = BT_COMPONENT_STATUS_OK;
@@ -168,8 +168,8 @@ void replace_clock_classes(const struct bt_trace *trace_copy,
                ret = bt_field_type_integer_set_mapped_clock_class(
                        field_type, clock_class_copy);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(mapped_clock_class);
-               bt_object_put_ref(clock_class_copy);
+               bt_clock_class_put_ref(mapped_clock_class);
+               bt_clock_class_put_ref(clock_class_copy);
                break;
        }
        case BT_FIELD_TYPE_ID_ENUM:
@@ -334,7 +334,7 @@ const struct bt_event_class *ctf_copy_event_class(FILE *err,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_event_class);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(writer_event_class);
 end:
        BT_OBJECT_PUT_REF_AND_RESET(context);
        BT_OBJECT_PUT_REF_AND_RESET(payload_type);
@@ -373,8 +373,8 @@ enum bt_component_status ctf_copy_event_classes(FILE *err,
                                 * event_classes after a trace has become
                                 * static.
                                 */
-                               BT_OBJECT_PUT_REF_AND_RESET(writer_event_class);
-                               BT_OBJECT_PUT_REF_AND_RESET(event_class);
+                               BT_EVENT_CLASS_PUT_REF_AND_RESET(writer_event_class);
+                               BT_EVENT_CLASS_PUT_REF_AND_RESET(event_class);
                                continue;
                        }
                }
@@ -394,17 +394,17 @@ enum bt_component_status ctf_copy_event_classes(FILE *err,
                        ret = BT_COMPONENT_STATUS_ERROR;
                        goto error;
                }
-               BT_OBJECT_PUT_REF_AND_RESET(writer_event_class);
-               BT_OBJECT_PUT_REF_AND_RESET(event_class);
+               BT_EVENT_CLASS_PUT_REF_AND_RESET(writer_event_class);
+               BT_EVENT_CLASS_PUT_REF_AND_RESET(event_class);
        }
 
        goto end;
 
 error:
-       bt_object_put_ref(event_class);
-       bt_object_put_ref(writer_event_class);
+       bt_event_class_put_ref(event_class);
+       bt_event_class_put_ref(writer_event_class);
 end:
-       bt_object_put_ref(writer_trace);
+       bt_trace_put_ref(writer_trace);
        return ret;
 }
 
@@ -502,7 +502,7 @@ const struct bt_stream_class *ctf_copy_stream_class(FILE *err,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream_class);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(writer_stream_class);
 end:
        bt_object_put_ref(type);
        bt_object_put_ref(type_copy);
@@ -668,7 +668,7 @@ int ctf_copy_event_header(FILE *err, const struct bt_event *event,
        }
 
        clock_value = bt_event_get_clock_value(event, clock_class);
-       BT_OBJECT_PUT_REF_AND_RESET(clock_class);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
        BT_ASSERT(clock_value);
 
        ret = bt_clock_value_get_value(clock_value, &value);
@@ -685,7 +685,7 @@ int ctf_copy_event_header(FILE *err, const struct bt_event *event,
        }
 
        writer_clock_value = bt_clock_value_create(writer_clock_class, value);
-       BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class);
+       BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
        if (!writer_clock_value) {
                BT_LOGE_STR("Failed to create clock value.");
                goto error;
@@ -734,7 +734,7 @@ const struct bt_trace *event_class_get_trace(FILE *err,
        trace = bt_stream_class_get_trace(stream_class);
        BT_ASSERT(trace);
 
-       bt_object_put_ref(stream_class);
+       bt_stream_class_put_ref(stream_class);
        return trace;
 }
 
@@ -850,7 +850,7 @@ error:
 end:
        bt_object_put_ref(field);
        bt_object_put_ref(copy_field);
-       bt_object_put_ref(writer_trace);
+       bt_trace_put_ref(writer_trace);
        return writer_event;
 }
 
@@ -881,7 +881,7 @@ enum bt_component_status ctf_copy_trace(FILE *err, const struct bt_trace *trace,
 
                ret_int = bt_trace_set_environment_field(writer_trace,
                                name, value);
-               BT_OBJECT_PUT_REF_AND_RESET(value);
+               BT_VALUE_PUT_REF_AND_RESET(value);
                if (ret_int < 0) {
                        BT_LOGE("Failed to set environment: field-name=\"%s\"",
                                        name);
index adb6619e184f365fbdad592c26fefb3846d013a5..0a4dbf1dc46d7a989fb5146f5cbf2897de995914 100644 (file)
@@ -45,19 +45,19 @@ const struct bt_stream *insert_new_stream(
 static
 void unref_stream(const struct bt_stream *stream)
 {
-       bt_object_put_ref(stream);
+       bt_stream_put_ref(stream);
 }
 
 static
 void unref_packet(const struct bt_packet *packet)
 {
-       bt_object_put_ref(packet);
+       bt_packet_put_ref(packet);
 }
 
 static
 void unref_stream_class(const struct bt_stream_class *stream_class)
 {
-       bt_object_put_ref(stream_class);
+       bt_stream_class_put_ref(stream_class);
 }
 
 static
@@ -94,7 +94,7 @@ const struct bt_field *get_payload_field(FILE *err,
        field = bt_field_structure_get_field_by_name(payload, field_name);
 
 end:
-       bt_object_put_ref(payload_class);
+       bt_field_class_put_ref(payload_class);
        bt_object_put_ref(payload);
        return field;
 }
@@ -123,7 +123,7 @@ const struct bt_field *get_stream_event_context_field(FILE *err,
        field = bt_field_structure_get_field_by_name(sec, field_name);
 
 end:
-       bt_object_put_ref(sec_class);
+       bt_field_class_put_ref(sec_class);
        bt_object_put_ref(sec);
        return field;
 }
@@ -168,7 +168,7 @@ int get_stream_event_context_unsigned_int_field_value(FILE *err,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
        return ret;
 }
@@ -206,7 +206,7 @@ int get_stream_event_context_int_field_value(FILE *err, const struct bt_event *e
 error:
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
        return ret;
 }
@@ -252,7 +252,7 @@ int get_payload_unsigned_int_field_value(FILE *err,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
        return ret;
 }
@@ -296,7 +296,7 @@ int get_payload_int_field_value(FILE *err, const struct bt_event *event,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
        return ret;
 }
@@ -340,7 +340,7 @@ int get_payload_string_field_value(FILE *err,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
        return ret;
 }
@@ -371,7 +371,7 @@ int get_payload_build_id_field_value(FILE *err,
                BT_LOGE("Wrong type, expected sequence: field-name=\"%s\"", field_name);
                goto error;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(field_class);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(field_class);
 
        seq_len = bt_field_sequence_get_length(field);
        BT_ASSERT(seq_len);
@@ -417,7 +417,7 @@ error:
        g_free(*build_id);
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
        return ret;
 }
@@ -454,7 +454,7 @@ struct debug_info *insert_new_debug_info(struct debug_info_iterator *debug_it,
        if (strcmp(str_value, "ust") != 0) {
                goto end;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(field);
+       BT_VALUE_PUT_REF_AND_RESET(field);
 
        /* No tracer_name, no debug info */
        field = bt_trace_get_environment_field_value_by_name(writer_trace,
@@ -469,7 +469,7 @@ struct debug_info *insert_new_debug_info(struct debug_info_iterator *debug_it,
        if (strcmp(str_value, "lttng-ust") != 0) {
                goto end;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(field);
+       BT_VALUE_PUT_REF_AND_RESET(field);
 
        debug_info = debug_info_create(debug_it->debug_info_component);
        if (!debug_info) {
@@ -481,7 +481,7 @@ struct debug_info *insert_new_debug_info(struct debug_info_iterator *debug_it,
                        debug_info);
 
 end:
-       bt_object_put_ref(field);
+       bt_value_put_ref(field);
        return debug_info;
 }
 
@@ -613,8 +613,8 @@ int sync_event_classes(struct debug_info_iterator *debug_it,
 error:
        int_ret = -1;
 end:
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(writer_stream_class);
+       bt_stream_class_put_ref(stream_class);
+       bt_stream_class_put_ref(writer_stream_class);
        return int_ret;
 }
 
@@ -644,8 +644,8 @@ void trace_is_static_listener(const struct bt_trace *trace, void *data)
                        BT_LOGE_STR("Failed to synchronize the event classes.");
                        goto error;
                }
-               BT_OBJECT_PUT_REF_AND_RESET(stream);
-               BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+               BT_STREAM_PUT_REF_AND_RESET(stream);
+               BT_STREAM_PUT_REF_AND_RESET(writer_stream);
        }
 
        bt_trace_set_is_static(di_trace->writer_trace);
@@ -660,8 +660,8 @@ void trace_is_static_listener(const struct bt_trace *trace, void *data)
        }
 
 error:
-       bt_object_put_ref(writer_stream);
-       bt_object_put_ref(stream);
+       bt_stream_put_ref(writer_stream);
+       bt_stream_put_ref(stream);
 }
 
 static
@@ -726,14 +726,14 @@ struct debug_info_trace *insert_new_trace(struct debug_info_iterator *debug_it,
                        BT_LOGE_STR("Failed to insert new stream.");
                        goto error;
                }
-               bt_object_get_ref(writer_stream);
+               bt_stream_get_ref(writer_stream);
                ret = sync_event_classes(debug_it, stream, writer_stream);
                if (ret) {
                        BT_LOGE_STR("Failed to synchronize event classes.");
                        goto error;
                }
-               BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
-               BT_OBJECT_PUT_REF_AND_RESET(stream);
+               BT_STREAM_PUT_REF_AND_RESET(writer_stream);
+               BT_STREAM_PUT_REF_AND_RESET(stream);
        }
 
        /* Check if the trace is already static or register a listener. */
@@ -752,14 +752,14 @@ struct debug_info_trace *insert_new_trace(struct debug_info_iterator *debug_it,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_trace);
+       BT_TRACE_PUT_REF_AND_RESET(writer_trace);
        g_free(di_trace);
        di_trace = NULL;
 end:
-       bt_object_put_ref(stream);
-       bt_object_put_ref(writer_stream);
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(trace);
+       bt_stream_put_ref(stream);
+       bt_stream_put_ref(writer_stream);
+       bt_stream_class_put_ref(stream_class);
+       bt_trace_put_ref(trace);
        return di_trace;
 }
 
@@ -799,7 +799,7 @@ const struct bt_packet *insert_new_packet(struct debug_info_iterator *debug_it,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+       BT_PACKET_PUT_REF_AND_RESET(writer_packet);
 end:
        return writer_packet;
 }
@@ -820,7 +820,7 @@ int add_debug_info_fields(FILE *err,
        if (!ip_field) {
                goto end;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(ip_field);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(ip_field);
 
        debug_field_class = bt_field_class_structure_get_field_class_by_name(
                        writer_event_context_class,
@@ -886,13 +886,13 @@ int add_debug_info_fields(FILE *err,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(debug_field_class);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(debug_field_class);
        ret = -1;
 end:
-       bt_object_put_ref(src_field_class);
-       bt_object_put_ref(func_field_class);
-       bt_object_put_ref(bin_field_class);
-       bt_object_put_ref(debug_field_class);
+       bt_field_class_put_ref(src_field_class);
+       bt_field_class_put_ref(func_field_class);
+       bt_field_class_put_ref(bin_field_class);
+       bt_field_class_put_ref(debug_field_class);
        return ret;
 }
 
@@ -918,7 +918,7 @@ int create_debug_info_event_context_class(FILE *err,
 
                ret = bt_field_class_structure_add_field(writer_event_context_class,
                                field_class, field_name);
-               BT_OBJECT_PUT_REF_AND_RESET(field_class);
+               BT_FIELD_CLASS_PUT_REF_AND_RESET(field_class);
                if (ret) {
                        BT_LOGE("Failed to add a field to the event-context: field-name=\"%s\"",
                                        field_name);
@@ -997,15 +997,15 @@ const struct bt_stream_class *copy_stream_class_debug_info(FILE *err,
                        BT_LOGE_STR("Failed to set event_context type.");
                        goto error;
                }
-               BT_OBJECT_PUT_REF_AND_RESET(writer_event_context_class);
+               BT_FIELD_CLASS_PUT_REF_AND_RESET(writer_event_context_class);
        }
 
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream_class);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(writer_stream_class);
 end:
-       bt_object_put_ref(writer_event_context_class);
+       bt_field_class_put_ref(writer_event_context_class);
        bt_object_put_ref(type);
        return writer_stream_class;
 }
@@ -1033,14 +1033,14 @@ int add_clock_classes(FILE *err, const struct bt_trace *writer_trace,
 
                existing_clock_class = bt_trace_get_clock_class_by_name(
                        writer_trace, bt_clock_class_get_name(clock_class));
-               bt_object_put_ref(existing_clock_class);
+               bt_clock_class_put_ref(existing_clock_class);
                if (existing_clock_class) {
-                       bt_object_put_ref(clock_class);
+                       bt_clock_class_put_ref(clock_class);
                        continue;
                }
 
                ret = bt_trace_add_clock_class(writer_trace, clock_class);
-               BT_OBJECT_PUT_REF_AND_RESET(clock_class);
+               BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
                if (ret != 0) {
                        BT_LOGE_STR("Failed to add clock_class.");
                        goto error;
@@ -1078,7 +1078,7 @@ const struct bt_stream_class *insert_new_stream_class(
                goto error;
        }
        writer_trace = di_trace->writer_trace;
-       bt_object_get_ref(writer_trace);
+       bt_trace_get_ref(writer_trace);
 
        writer_stream_class = copy_stream_class_debug_info(debug_it->err, stream_class,
                        writer_trace, debug_it->debug_info_component);
@@ -1106,10 +1106,10 @@ const struct bt_stream_class *insert_new_stream_class(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream_class);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(writer_stream_class);
 end:
-       bt_object_put_ref(trace);
-       bt_object_put_ref(writer_trace);
+       bt_trace_put_ref(trace);
+       bt_trace_put_ref(writer_trace);
        return writer_stream_class;
 }
 
@@ -1139,7 +1139,7 @@ const struct bt_stream *insert_new_stream(
                        goto error;
                }
        }
-       bt_object_get_ref(writer_stream_class);
+       bt_stream_class_get_ref(writer_stream_class);
 
        id = bt_stream_get_id(stream);
        if (id < 0) {
@@ -1162,10 +1162,10 @@ const struct bt_stream *insert_new_stream(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+       BT_STREAM_PUT_REF_AND_RESET(writer_stream);
 end:
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(writer_stream_class);
+       bt_stream_class_put_ref(stream_class);
+       bt_stream_class_put_ref(writer_stream_class);
        return writer_stream;
 }
 
@@ -1205,8 +1205,8 @@ struct debug_info_trace *lookup_di_trace_from_stream(
        di_trace = (struct debug_info_trace *) g_hash_table_lookup(
                        debug_it->trace_map, (gpointer) trace);
 
-       BT_OBJECT_PUT_REF_AND_RESET(stream_class);
-       BT_OBJECT_PUT_REF_AND_RESET(trace);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(stream_class);
+       BT_TRACE_PUT_REF_AND_RESET(trace);
        return di_trace;
 }
 
@@ -1233,14 +1233,14 @@ const struct bt_stream *get_writer_stream(
                BT_LOGE_STR("Failed to find existing stream.");
                goto error;
        }
-       bt_object_get_ref(writer_stream);
+       bt_stream_get_ref(writer_stream);
 
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+       BT_STREAM_PUT_REF_AND_RESET(writer_stream);
 end:
-       bt_object_put_ref(stream_class);
+       bt_stream_class_put_ref(stream_class);
        return writer_stream;
 }
 
@@ -1277,7 +1277,7 @@ const struct bt_packet *debug_info_new_packet(
        writer_packet = lookup_packet(debug_it, packet, di_trace);
        if (writer_packet) {
                g_hash_table_remove(di_trace->packet_map, packet);
-               BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+               BT_PACKET_PUT_REF_AND_RESET(writer_packet);
        }
 
        writer_packet = insert_new_packet(debug_it, packet, writer_stream,
@@ -1298,15 +1298,15 @@ const struct bt_packet *debug_info_new_packet(
                BT_OBJECT_PUT_REF_AND_RESET(packet_context);
        }
 
-       bt_object_get_ref(writer_packet);
+       bt_packet_get_ref(writer_packet);
        goto end;
 
 error:
 
 end:
        bt_object_put_ref(packet_context);
-       bt_object_put_ref(writer_stream);
-       bt_object_put_ref(stream);
+       bt_stream_put_ref(writer_stream);
+       bt_stream_put_ref(stream);
        return writer_packet;
 }
 
@@ -1333,11 +1333,11 @@ const struct bt_packet *debug_info_close_packet(
                BT_LOGE_STR("Failed to find existing packet.");
                goto end;
        }
-       bt_object_get_ref(writer_packet);
+       bt_packet_get_ref(writer_packet);
        g_hash_table_remove(di_trace->packet_map, packet);
 
 end:
-       bt_object_put_ref(stream);
+       bt_stream_put_ref(stream);
        return writer_packet;
 }
 
@@ -1383,12 +1383,12 @@ const struct bt_stream *debug_info_stream_begin(
        if (!writer_stream) {
                writer_stream = insert_new_stream(debug_it, stream, di_trace);
        }
-       bt_object_get_ref(writer_stream);
+       bt_stream_get_ref(writer_stream);
 
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+       BT_STREAM_PUT_REF_AND_RESET(writer_stream);
 end:
        return writer_stream;
 }
@@ -1416,7 +1416,7 @@ const struct bt_stream *debug_info_stream_end(struct debug_info_iterator *debug_
         * Take the ref on the stream and keep it until the notification
         * is created.
         */
-       bt_object_get_ref(writer_stream);
+       bt_stream_get_ref(writer_stream);
 
        state = g_hash_table_lookup(di_trace->stream_states, stream);
        if (*state != DEBUG_INFO_ACTIVE_STREAM) {
@@ -1442,7 +1442,7 @@ const struct bt_stream *debug_info_stream_end(struct debug_info_iterator *debug_
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+       BT_STREAM_PUT_REF_AND_RESET(writer_stream);
 
 end:
        return writer_stream;
@@ -1500,7 +1500,7 @@ int set_debug_info_field(FILE *err, const struct bt_field *debug_field,
                                        field_name);
                        goto error;
                }
-               BT_OBJECT_PUT_REF_AND_RESET(field_class);
+               BT_FIELD_CLASS_PUT_REF_AND_RESET(field_class);
 
                field = bt_field_structure_get_field_by_index(debug_field, i);
                if (!strcmp(field_name, "bin")) {
@@ -1560,9 +1560,9 @@ int set_debug_info_field(FILE *err, const struct bt_field *debug_field,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        bt_object_put_ref(field);
-       bt_object_put_ref(debug_field_class);
+       bt_field_class_put_ref(debug_field_class);
        return ret;
 }
 
@@ -1654,7 +1654,7 @@ int copy_set_debug_info_stream_event_context(FILE *err,
                        }
                        BT_OBJECT_PUT_REF_AND_RESET(copy_field);
                }
-               BT_OBJECT_PUT_REF_AND_RESET(field_class);
+               BT_FIELD_CLASS_PUT_REF_AND_RESET(field_class);
                BT_OBJECT_PUT_REF_AND_RESET(field);
        }
 
@@ -1664,13 +1664,13 @@ int copy_set_debug_info_stream_event_context(FILE *err,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(event_context_class);
-       bt_object_put_ref(writer_event_context_class);
+       bt_field_class_put_ref(event_context_class);
+       bt_field_class_put_ref(writer_event_context_class);
        bt_object_put_ref(writer_event_context);
        bt_object_put_ref(field);
        bt_object_put_ref(copy_field);
        bt_object_put_ref(debug_field);
-       bt_object_put_ref(field_class);
+       bt_field_class_put_ref(field_class);
        return ret;
 }
 
@@ -1692,7 +1692,7 @@ const struct bt_clock_class *stream_class_get_clock_class(FILE *err,
        /* FIXME multi-clock? */
        clock_class = bt_trace_get_clock_class_by_index(trace, 0);
 
-       bt_object_put_ref(trace);
+       bt_trace_put_ref(trace);
 
 end:
        return clock_class;
@@ -1715,8 +1715,8 @@ const struct bt_clock_class *event_get_clock_class(FILE *err, const struct bt_ev
        goto end;
 
 end:
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(event_class);
+       bt_stream_class_put_ref(stream_class);
+       bt_event_class_put_ref(event_class);
        return clock_class;
 }
 
@@ -1756,7 +1756,7 @@ int set_event_clock_value(FILE *err, const struct bt_event *event,
 error:
        ret = -1;
 end:
-       bt_object_put_ref(clock_class);
+       bt_clock_class_put_ref(clock_class);
        bt_object_put_ref(clock_value);
        return ret;
 }
@@ -1886,7 +1886,7 @@ const struct bt_event *debug_info_output_event(
                BT_LOGE_STR("Failed to find existing stream_class.");
                goto error;
        }
-       bt_object_get_ref(writer_stream_class);
+       bt_stream_class_get_ref(writer_stream_class);
        writer_trace = bt_stream_class_get_trace(writer_stream_class);
        BT_ASSERT(writer_trace);
        writer_event_class = get_event_class(debug_it,
@@ -1928,7 +1928,7 @@ const struct bt_event *debug_info_output_event(
                BT_LOGE_STR("Failed to find existing packet.");
                goto error;
        }
-       bt_object_get_ref(writer_packet);
+       bt_packet_get_ref(writer_packet);
 
        int_ret = bt_event_set_packet(writer_event, writer_packet);
        if (int_ret < 0) {
@@ -1944,13 +1944,13 @@ error:
        BT_OBJECT_PUT_REF_AND_RESET(writer_event);
 
 end:
-       bt_object_put_ref(stream);
-       bt_object_put_ref(writer_trace);
-       bt_object_put_ref(writer_packet);
-       bt_object_put_ref(packet);
-       bt_object_put_ref(writer_event_class);
-       bt_object_put_ref(writer_stream_class);
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(event_class);
+       bt_stream_put_ref(stream);
+       bt_trace_put_ref(writer_trace);
+       bt_packet_put_ref(writer_packet);
+       bt_packet_put_ref(packet);
+       bt_event_class_put_ref(writer_event_class);
+       bt_stream_class_put_ref(writer_stream_class);
+       bt_stream_class_put_ref(stream_class);
+       bt_event_class_put_ref(event_class);
        return writer_event;
 }
index 45b0f1c1efce5770474c483ce5170c0883b82517..ff193c2c793995a0fb82a68b907e567d7cbf0a14 100644 (file)
@@ -741,7 +741,7 @@ void debug_info_handle_event(FILE *err, const struct bt_event *event,
        }
 
 end_put_class:
-       bt_object_put_ref(event_class);
+       bt_event_class_put_ref(event_class);
 end:
        return;
 }
index e3ebc514f712b4812ef138195cf049b23e4bcb44..6b2f5349e97dc7fb69ec3cbc3625d09564177886 100644 (file)
@@ -78,7 +78,7 @@ end:
 static
 void unref_trace(struct debug_info_trace *di_trace)
 {
-       bt_object_put_ref(di_trace->writer_trace);
+       bt_trace_put_ref(di_trace->writer_trace);
        g_free(di_trace);
 }
 
@@ -98,7 +98,7 @@ void debug_info_iterator_destroy(struct bt_self_notification_iterator *it)
                        empty_trace_map, it_data);
        g_hash_table_destroy(it_data->trace_map);
 
-       bt_object_put_ref(it_data->current_notification);
+       bt_notification_put_ref(it_data->current_notification);
        bt_object_put_ref(it_data->input_iterator);
 
        g_free(it_data);
@@ -127,8 +127,8 @@ const struct bt_notification *handle_notification(FILE *err,
                new_notification = bt_notification_packet_beginning_create(
                                writer_packet);
                BT_ASSERT(new_notification);
-               bt_object_put_ref(packet);
-               bt_object_put_ref(writer_packet);
+               bt_packet_put_ref(packet);
+               bt_packet_put_ref(writer_packet);
                break;
        }
        case BT_NOTIFICATION_TYPE_PACKET_END:
@@ -146,8 +146,8 @@ const struct bt_notification *handle_notification(FILE *err,
                new_notification = bt_notification_packet_end_create(
                                writer_packet);
                BT_ASSERT(new_notification);
-               bt_object_put_ref(packet);
-               bt_object_put_ref(writer_packet);
+               bt_packet_put_ref(packet);
+               bt_packet_put_ref(writer_packet);
                break;
        }
        case BT_NOTIFICATION_TYPE_EVENT:
@@ -187,8 +187,8 @@ const struct bt_notification *handle_notification(FILE *err,
                new_notification = bt_notification_stream_beginning_create(
                                writer_stream);
                BT_ASSERT(new_notification);
-               bt_object_put_ref(stream);
-               bt_object_put_ref(writer_stream);
+               bt_stream_put_ref(stream);
+               bt_stream_put_ref(writer_stream);
                break;
        }
        case BT_NOTIFICATION_TYPE_STREAM_END:
@@ -206,12 +206,12 @@ const struct bt_notification *handle_notification(FILE *err,
                new_notification = bt_notification_stream_end_create(
                                writer_stream);
                BT_ASSERT(new_notification);
-               bt_object_put_ref(stream);
-               bt_object_put_ref(writer_stream);
+               bt_stream_put_ref(stream);
+               bt_stream_put_ref(writer_stream);
                break;
        }
        default:
-               new_notification = bt_object_get_ref(notification);
+               new_notification = bt_notification_get_ref(notification);
                break;
        }
 
@@ -258,7 +258,7 @@ struct bt_notification_iterator_next_method_return debug_info_iterator_next(
        ret.notification = handle_notification(debug_info->err, debug_it,
                        notification);
        BT_ASSERT(ret.notification);
-       bt_object_put_ref(notification);
+       bt_notification_put_ref(notification);
 
 end:
        bt_object_put_ref(component);
@@ -340,7 +340,7 @@ enum bt_component_status init_from_params(
 
                tmp = bt_value_string_get(value);
                strcpy(debug_info_component->arg_debug_info_field_name, tmp);
-               bt_object_put_ref(value);
+               bt_value_put_ref(value);
        } else {
                debug_info_component->arg_debug_info_field_name =
                        malloc(strlen("debug_info") + 1);
@@ -362,7 +362,7 @@ enum bt_component_status init_from_params(
 
                debug_info_component->arg_debug_dir = bt_value_string_get(value);
        }
-       bt_object_put_ref(value);
+       bt_value_put_ref(value);
        if (ret != BT_COMPONENT_STATUS_OK) {
                goto end;
        }
@@ -373,7 +373,7 @@ enum bt_component_status init_from_params(
 
                debug_info_component->arg_target_prefix = bt_value_string_get(value);
        }
-       bt_object_put_ref(value);
+       bt_value_put_ref(value);
        if (ret != BT_COMPONENT_STATUS_OK) {
                goto end;
        }
@@ -387,7 +387,7 @@ enum bt_component_status init_from_params(
 
                debug_info_component->arg_full_path = bool_val;
        }
-       bt_object_put_ref(value);
+       bt_value_put_ref(value);
        if (ret != BT_COMPONENT_STATUS_OK) {
                goto end;
        }
index c317a7b0c58e25be66d0ee498410398ad2881a11..ffe35fdebc701b864298cf34244d8eb434079020 100644 (file)
@@ -107,10 +107,10 @@ struct bt_field_class *create_event_payload_fc(void)
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(root_fc);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(root_fc);
 
 end:
-       bt_object_put_ref(fc);
+       bt_field_class_put_ref(fc);
        return root_fc;
 }
 
@@ -179,7 +179,7 @@ error:
        ret = -1;
 
 end:
-       bt_object_put_ref(fc);
+       bt_field_class_put_ref(fc);
        return ret;
 }
 
@@ -348,12 +348,12 @@ void destroy_dmesg_component(struct dmesg_component *dmesg_comp)
                g_string_free(dmesg_comp->params.path, TRUE);
        }
 
-       bt_object_put_ref(dmesg_comp->packet);
-       bt_object_put_ref(dmesg_comp->trace);
-       bt_object_put_ref(dmesg_comp->stream_class);
-       bt_object_put_ref(dmesg_comp->event_class);
-       bt_object_put_ref(dmesg_comp->stream);
-       bt_object_put_ref(dmesg_comp->clock_class);
+       bt_packet_put_ref(dmesg_comp->packet);
+       bt_trace_put_ref(dmesg_comp->trace);
+       bt_stream_class_put_ref(dmesg_comp->stream_class);
+       bt_event_class_put_ref(dmesg_comp->event_class);
+       bt_stream_put_ref(dmesg_comp->stream);
+       bt_clock_class_put_ref(dmesg_comp->clock_class);
        g_free(dmesg_comp);
 }
 
@@ -524,7 +524,7 @@ skip_ts:
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(notif);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
 
 end:
        return notif;
@@ -604,7 +604,7 @@ struct bt_notification *create_notif_from_line(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(notif);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
 
 end:
        return notif;
@@ -623,7 +623,7 @@ void destroy_dmesg_notif_iter(struct dmesg_notif_iter *dmesg_notif_iter)
                }
        }
 
-       bt_object_put_ref(dmesg_notif_iter->tmp_event_notif);
+       bt_notification_put_ref(dmesg_notif_iter->tmp_event_notif);
        free(dmesg_notif_iter->linebuf);
        g_free(dmesg_notif_iter);
 }
index ae064c5e0b5a92360921c010a7582d6bed862784..846cbdae7265cbe33f8d4815d42e7bed9f129f6e 100644 (file)
@@ -65,7 +65,7 @@ const char *plugin_options[] = {
 static
 void destroy_pretty_data(struct pretty_component *pretty)
 {
-       bt_object_put_ref(pretty->iterator);
+       bt_self_component_port_input_notification_iterator_put_ref(pretty->iterator);
 
        if (pretty->string) {
                (void) g_string_free(pretty->string, TRUE);
@@ -200,7 +200,8 @@ enum bt_self_component_status pretty_consume(
                goto end;
        case BT_NOTIFICATION_ITERATOR_STATUS_END:
                ret = BT_SELF_COMPONENT_STATUS_END;
-               BT_OBJECT_PUT_REF_AND_RESET(pretty->iterator);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+                       pretty->iterator);
                goto end;
        default:
                ret = BT_SELF_COMPONENT_STATUS_ERROR;
@@ -215,12 +216,12 @@ enum bt_self_component_status pretty_consume(
                        goto end;
                }
 
-               bt_object_put_ref(notifs[i]);
+               bt_notification_put_ref(notifs[i]);
        }
 
 end:
        for (; i < count; i++) {
-               bt_object_put_ref(notifs[i]);
+               bt_notification_put_ref(notifs[i]);
        }
 
        return ret;
@@ -592,7 +593,7 @@ int apply_params(struct pretty_component *pretty, const struct bt_value *params)
        }
 
 end:
-       bt_object_put_ref(pretty->plugin_opt_map);
+       bt_value_put_ref(pretty->plugin_opt_map);
        pretty->plugin_opt_map = NULL;
        g_free(str);
        return ret;
index 3da0fb90883b67384a2aacae695be5980e1c0ad4..ba4c521e10408a157c7394bd4c810c1cdd5bcd78 100644 (file)
@@ -103,7 +103,7 @@ void try_print_last(struct counter *counter)
 
 void destroy_private_counter_data(struct counter *counter)
 {
-       bt_object_put_ref(counter->notif_iter);
+       bt_self_component_port_input_notification_iterator_put_ref(counter->notif_iter);
        g_free(counter);
 }
 
@@ -117,7 +117,7 @@ void counter_finalize(struct bt_self_component_sink *comp)
                        bt_self_component_sink_as_self_component(comp));
        BT_ASSERT(counter);
        try_print_last(counter);
-       bt_object_put_ref(counter->notif_iter);
+       bt_self_component_port_input_notification_iterator_put_ref(counter->notif_iter);
        g_free(counter);
 }
 
@@ -195,7 +195,8 @@ enum bt_self_component_status counter_port_connected(
                goto end;
        }
 
-       BT_OBJECT_MOVE_REF(counter->notif_iter, iterator);
+       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_MOVE_REF(
+               counter->notif_iter, iterator);
 
 end:
        return status;
@@ -261,7 +262,7 @@ enum bt_self_component_status counter_consume(
                                counter->count.other++;
                        }
 
-                       bt_object_put_ref(notif);
+                       bt_notification_put_ref(notif);
                }
 
                ret = BT_SELF_COMPONENT_STATUS_OK;
index d6230f72e00b190a8563bc6b237ebc23128234c9..ebd94674d1844e7edf03e1aa7f124689ac476e16 100644 (file)
@@ -28,7 +28,7 @@
 
 void destroy_private_dummy_data(struct dummy *dummy)
 {
-       bt_object_put_ref(dummy->notif_iter);
+       bt_self_component_port_input_notification_iterator_put_ref(dummy->notif_iter);
        g_free(dummy);
 
 }
@@ -96,7 +96,8 @@ enum bt_self_component_status dummy_port_connected(
                goto end;
        }
 
-       BT_OBJECT_MOVE_REF(dummy->notif_iter, iterator);
+       BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_MOVE_REF(
+               dummy->notif_iter, iterator);
 
 end:
        return status;
@@ -130,7 +131,7 @@ enum bt_self_component_status dummy_consume(
                ret = BT_SELF_COMPONENT_STATUS_OK;
 
                for (i = 0; i < count; i++) {
-                       bt_object_put_ref(notifs[i]);
+                       bt_notification_put_ref(notifs[i]);
                }
 
                break;
index 1d273bebae08fc9f16a2fff9610d902ff04f85d5..4e97a014800eadd6dcd33997c305a7810f846a1f 100644 (file)
@@ -122,14 +122,14 @@ void destroy_muxer_upstream_notif_iter(
                muxer_upstream_notif_iter,
                muxer_upstream_notif_iter->notif_iter,
                muxer_upstream_notif_iter->notifs->length);
-       bt_object_put_ref(muxer_upstream_notif_iter->notif_iter);
+       bt_self_component_port_input_notification_iterator_put_ref(muxer_upstream_notif_iter->notif_iter);
 
        if (muxer_upstream_notif_iter->notifs) {
                const struct bt_notification *notif;
 
                while ((notif = g_queue_pop_head(
                                muxer_upstream_notif_iter->notifs))) {
-                       bt_object_put_ref(notif);
+                       bt_notification_put_ref(notif);
                }
 
                g_queue_free(muxer_upstream_notif_iter->notifs);
@@ -152,7 +152,7 @@ struct muxer_upstream_notif_iter *muxer_notif_iter_add_upstream_notif_iter(
        }
 
        muxer_upstream_notif_iter->notif_iter = self_notif_iter;
-       bt_object_get_ref(muxer_upstream_notif_iter->notif_iter);
+       bt_self_component_port_input_notification_iterator_get_ref(muxer_upstream_notif_iter->notif_iter);
        muxer_upstream_notif_iter->notifs = g_queue_new();
        if (!muxer_upstream_notif_iter->notifs) {
                BT_LOGE_STR("Failed to allocate a GQueue.");
@@ -265,7 +265,7 @@ struct bt_value *get_default_params(void)
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(params);
+       BT_VALUE_PUT_REF_AND_RESET(params);
 
 end:
        return params;
@@ -320,8 +320,8 @@ error:
        ret = -1;
 
 end:
-       bt_object_put_ref(default_params);
-       bt_object_put_ref(real_params);
+       bt_value_put_ref(default_params);
+       bt_value_put_ref(real_params);
        return ret;
 }
 
@@ -498,7 +498,7 @@ enum bt_notification_iterator_status muxer_upstream_notif_iter_next(
                 * won't be considered again to find the youngest
                 * notification.
                 */
-               BT_OBJECT_PUT_REF_AND_RESET(muxer_upstream_notif_iter->notif_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(muxer_upstream_notif_iter->notif_iter);
                status = BT_NOTIFICATION_ITERATOR_STATUS_OK;
                break;
        default:
@@ -568,7 +568,7 @@ int muxer_notif_iter_handle_newly_connected_ports(
                muxer_upstream_notif_iter =
                        muxer_notif_iter_add_upstream_notif_iter(
                                muxer_notif_iter, upstream_notif_iter);
-               BT_OBJECT_PUT_REF_AND_RESET(upstream_notif_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(upstream_notif_iter);
                if (!muxer_upstream_notif_iter) {
                        /*
                         * muxer_notif_iter_add_upstream_notif_iter()
@@ -578,7 +578,7 @@ int muxer_notif_iter_handle_newly_connected_ports(
                }
 
 remove_node:
-               bt_object_put_ref(upstream_notif_iter);
+               bt_self_component_port_input_notification_iterator_put_ref(upstream_notif_iter);
                muxer_notif_iter->newly_connected_self_ports =
                        g_list_delete_link(
                                muxer_notif_iter->newly_connected_self_ports,
index 79d1e8b2b6d7ca0fa284693c3dbd69f8dd8f66e8..423a76658245754f07f8369767d1e0e8726a529e 100644 (file)
@@ -70,7 +70,7 @@ const struct bt_packet *insert_new_packet(struct trimmer_iterator *trim_it,
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+       BT_PACKET_PUT_REF_AND_RESET(writer_packet);
 end:
        return writer_packet;
 }
@@ -170,7 +170,7 @@ const struct bt_packet *trimmer_new_packet(
        writer_packet = lookup_packet(trim_it, packet);
        if (writer_packet) {
                g_hash_table_remove(trim_it->packet_map, packet);
-               BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+               BT_PACKET_PUT_REF_AND_RESET(writer_packet);
        }
 
        writer_packet = insert_new_packet(trim_it, packet, stream);
@@ -178,7 +178,7 @@ const struct bt_packet *trimmer_new_packet(
                BT_LOGE_STR("Failed to insert new packet.");
                goto error;
        }
-       bt_object_get_ref(writer_packet);
+       bt_packet_get_ref(writer_packet);
 
        int_ret = ctf_packet_copy_context(trim_it->err, packet,
                        stream, writer_packet);
@@ -190,9 +190,9 @@ const struct bt_packet *trimmer_new_packet(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+       BT_PACKET_PUT_REF_AND_RESET(writer_packet);
 end:
-       bt_object_put_ref(stream);
+       bt_stream_put_ref(stream);
        return writer_packet;
 }
 
@@ -247,7 +247,7 @@ const struct bt_event *trimmer_output_event(
                BT_LOGE_STR("Failed to find existing packet.");
                goto error;
        }
-       bt_object_get_ref(writer_packet);
+       bt_packet_get_ref(writer_packet);
 
        int_ret = bt_event_set_packet(writer_event, writer_packet);
        if (int_ret < 0) {
@@ -263,8 +263,8 @@ const struct bt_event *trimmer_output_event(
 error:
        BT_OBJECT_PUT_REF_AND_RESET(writer_event);
 end:
-       bt_object_put_ref(writer_packet);
-       bt_object_put_ref(packet);
-       bt_object_put_ref(event_class);
+       bt_packet_put_ref(writer_packet);
+       bt_packet_put_ref(packet);
+       bt_event_class_put_ref(event_class);
        return writer_event;
 }
index 29e9951b0f121c7f6ec8f22a6a310b79ce3582e2..0f9d248736edabf52846df3b7f42fdf675424142 100644 (file)
@@ -44,7 +44,7 @@ gboolean close_packets(gpointer key, gpointer value, gpointer user_data)
 {
        const struct bt_packet *writer_packet = value;
 
-       bt_object_put_ref(writer_packet);
+       bt_packet_put_ref(writer_packet);
        return TRUE;
 }
 
@@ -254,14 +254,14 @@ const struct bt_notification *evaluate_event_notification(
        goto end;
 
 error:
-       BT_OBJECT_PUT_REF_AND_RESET(new_notification);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(new_notification);
 end:
        bt_object_put_ref(event);
        bt_object_put_ref(writer_event);
-       bt_object_put_ref(clock_class);
-       bt_object_put_ref(trace);
-       bt_object_put_ref(stream);
-       bt_object_put_ref(stream_class);
+       bt_clock_class_put_ref(clock_class);
+       bt_trace_put_ref(trace);
+       bt_stream_put_ref(stream);
+       bt_stream_class_put_ref(stream_class);
        bt_object_put_ref(clock_value);
        *_event_in_range = in_range;
        return new_notification;
@@ -306,8 +306,8 @@ int ns_from_integer_field(const struct bt_field *integer, int64_t *ns)
 
        ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ns);
 end:
-       bt_object_put_ref(integer_class);
-       bt_object_put_ref(clock_class);
+       bt_field_class_put_ref(integer_class);
+       bt_clock_class_put_ref(clock_class);
        bt_object_put_ref(clock_value);
        return ret;
 }
@@ -366,10 +366,10 @@ int64_t get_raw_timestamp(const struct bt_packet *writer_packet,
 
        ns += ns_from_value(freq, cycles_offset);
 
-       bt_object_put_ref(writer_clock_class);
-       bt_object_put_ref(writer_trace);
-       bt_object_put_ref(writer_stream_class);
-       bt_object_put_ref(writer_stream);
+       bt_clock_class_put_ref(writer_clock_class);
+       bt_trace_put_ref(writer_trace);
+       bt_stream_class_put_ref(writer_stream_class);
+       bt_stream_put_ref(writer_stream);
 
        return timestamp - ns;
 }
@@ -492,8 +492,8 @@ end:
        }
 end_no_notif:
        *_packet_in_range = in_range;
-       bt_object_put_ref(packet);
-       bt_object_put_ref(writer_packet);
+       bt_packet_put_ref(packet);
+       bt_packet_put_ref(writer_packet);
        bt_object_put_ref(packet_context);
        bt_object_put_ref(timestamp_begin);
        bt_object_put_ref(timestamp_end);
@@ -545,7 +545,7 @@ enum bt_notification_iterator_status evaluate_notification(
        default:
                break;
        }
-       BT_OBJECT_PUT_REF_AND_RESET(*notification);
+       BT_NOTIFICATION_PUT_REF_AND_RESET(*notification);
        *notification = new_notification;
 
        if (finished) {
index 21dc871a9eba14c638703a26ea52aad6da09dd8f..a7bc66d572a2ede20fa4c81bfffe2d8cbe4d2c3b 100644 (file)
@@ -310,7 +310,7 @@ enum bt_component_status init_from_params(struct trimmer *trimmer,
                goto end;
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(value);
+       BT_VALUE_PUT_REF_AND_RESET(value);
         value = bt_value_map_get(params, "begin");
        if (value) {
                if (timestamp_from_param("begin", value,
@@ -321,7 +321,7 @@ enum bt_component_status init_from_params(struct trimmer *trimmer,
                }
        }
 
-       BT_OBJECT_PUT_REF_AND_RESET(value);
+       BT_VALUE_PUT_REF_AND_RESET(value);
         value = bt_value_map_get(params, "end");
        if (value) {
                if (timestamp_from_param("end", value,
@@ -333,7 +333,7 @@ enum bt_component_status init_from_params(struct trimmer *trimmer,
        }
 
 end:
-       bt_object_put_ref(value);
+       bt_value_put_ref(value);
 
        if (trimmer->begin.set && trimmer->end.set) {
                if (trimmer->begin.value > trimmer->end.value) {
index 11fae9329e12172c668838d112bb6ccbe3b36d8f..1eb1fa34182d95c539b06797c7e8da39c7f1e053 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/object.h>
 #include <babeltrace/plugin/plugin-const.h>
 #include <babeltrace/plugin/plugin-internal.h>
 #include <babeltrace/graph/component-class.h>
@@ -495,7 +494,7 @@ error:
        BT_OBJECT_PUT_REF_AND_RESET(plugin_set);
 
 end:
-       bt_object_put_ref(plugin);
+       bt_plugin_put_ref(plugin);
        Py_XDECREF(py_plugin_info);
        g_free(basename);
        return plugin_set;
index 46e3eec0be7dfaab5eb4fa6f03a46225ea43f096..beac97258a09d538aaf16532805d0b4ad112606c 100644 (file)
@@ -71,7 +71,7 @@ static enum bt_query_status flt_query_method(
        BT_ASSERT(iret == 0);
        iret = bt_value_array_append_element(res, val);
        BT_ASSERT(iret == 0);
-       bt_object_put_ref(val);
+       bt_value_put_ref(val);
        return BT_QUERY_STATUS_OK;
 }
 
index f121df0593785492b4b806852ad962693619b542..5a2f9a3e9622739c49e888d3b13173f3c4681b0c 100644 (file)
@@ -90,7 +90,7 @@ struct src_iter_user_data {
 };
 
 struct sink_user_data {
-       void *notif_iter;
+       struct bt_self_component_port_input_notification_iterator *notif_iter;
 };
 
 /*
@@ -279,8 +279,8 @@ void init_static_data(void)
                fprintf(stderr, ":: stream 2, packet 2: %p\n", src_stream2_packet2);
        }
 
-       bt_object_put_ref(trace);
-       bt_object_put_ref(trace_class);
+       bt_trace_put_ref(trace);
+       bt_trace_class_put_ref(trace_class);
 }
 
 static
@@ -290,14 +290,14 @@ void fini_static_data(void)
        g_array_free(test_events, TRUE);
 
        /* Metadata */
-       bt_object_put_ref(src_stream_class);
-       bt_object_put_ref(src_event_class);
-       bt_object_put_ref(src_stream1);
-       bt_object_put_ref(src_stream2);
-       bt_object_put_ref(src_stream1_packet1);
-       bt_object_put_ref(src_stream1_packet2);
-       bt_object_put_ref(src_stream2_packet1);
-       bt_object_put_ref(src_stream2_packet2);
+       bt_stream_class_put_ref(src_stream_class);
+       bt_event_class_put_ref(src_event_class);
+       bt_stream_put_ref(src_stream1);
+       bt_stream_put_ref(src_stream2);
+       bt_packet_put_ref(src_stream1_packet1);
+       bt_packet_put_ref(src_stream1_packet2);
+       bt_packet_put_ref(src_stream2_packet1);
+       bt_packet_put_ref(src_stream2_packet2);
 }
 
 static
@@ -575,7 +575,7 @@ enum bt_notification_iterator_status common_consume(
 
        for (i = 0; i < count; i++) {
                append_test_events_from_notification(notifications[i]);
-               bt_object_put_ref(notifications[i]);
+               bt_notification_put_ref(notifications[i]);
        }
 
 end:
@@ -604,7 +604,8 @@ enum bt_self_component_status sink_consume(
        switch (it_ret) {
        case BT_NOTIFICATION_ITERATOR_STATUS_END:
                ret = BT_SELF_COMPONENT_STATUS_END;
-               BT_OBJECT_PUT_REF_AND_RESET(user_data->notif_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+                       user_data->notif_iter);
                goto end;
        case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN:
                abort();
@@ -661,7 +662,8 @@ void sink_finalize(struct bt_self_component_sink *self_comp)
                                self_comp));
 
        if (user_data) {
-               bt_object_put_ref(user_data->notif_iter);
+               BT_SELF_COMPONENT_PORT_INPUT_NOTIFICATION_ITERATOR_PUT_REF_AND_RESET(
+                       user_data->notif_iter);
                g_free(user_data);
        }
 }
@@ -695,7 +697,7 @@ void create_source_sink(struct bt_graph *graph,
                ret = bt_graph_add_source_component(graph,
                        src_comp_class, "source", NULL, source);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(src_comp_class);
+               bt_component_class_source_put_ref(src_comp_class);
        }
 
        /* Create sink component */
@@ -715,7 +717,7 @@ void create_source_sink(struct bt_graph *graph,
                        sink_comp_class,
                        "sink", NULL, sink);
                BT_ASSERT(ret == 0);
-               bt_object_put_ref(sink_comp_class);
+               bt_component_class_sink_put_ref(sink_comp_class);
        }
 }
 
@@ -763,9 +765,9 @@ void do_std_test(enum test test, const char *name,
                        "the produced sequence of test events is the expected one");
        }
 
-       bt_object_put_ref(src_comp);
-       bt_object_put_ref(sink_comp);
-       BT_OBJECT_PUT_REF_AND_RESET(graph);
+       bt_component_source_put_ref(src_comp);
+       bt_component_sink_put_ref(sink_comp);
+       BT_GRAPH_PUT_REF_AND_RESET(graph);
 }
 
 static
@@ -852,9 +854,9 @@ void test_output_port_notification_iterator(void)
        ok(compare_test_events(expected_test_events),
                "the produced sequence of test events is the expected one");
 
-       bt_object_put_ref(src_comp);
-       BT_OBJECT_PUT_REF_AND_RESET(graph);
-       bt_object_put_ref(notif_iter);
+       bt_component_source_put_ref(src_comp);
+       BT_GRAPH_PUT_REF_AND_RESET(graph);
+       bt_port_output_notification_iterator_put_ref(notif_iter);
 }
 
 #define DEBUG_ENV_VAR  "TEST_BT_NOTIFICATION_ITERATOR_DEBUG"
index 9b9cd3a4a72649c471cad41b3042014144423545..e88535e592dce820bb01fedfb00578b3d27e1c0f 100644 (file)
@@ -33,9 +33,9 @@ void test_null(void)
        ok(bt_value_null, "bt_value_null is not NULL");
        ok(bt_value_is_null(bt_value_null),
                "bt_value_null is a null value object");
-       bt_object_get_ref(bt_value_null);
+       bt_value_get_ref(bt_value_null);
        pass("getting bt_value_null does not cause a crash");
-       bt_object_put_ref(bt_value_null);
+       bt_value_put_ref(bt_value_null);
        pass("putting bt_value_null does not cause a crash");
 }
 
@@ -58,7 +58,7 @@ void test_bool(void)
        value = bt_value_bool_get(obj);
        ok(value, "bt_value_bool_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        pass("putting an existing boolean value object does not cause a crash")
 
        value = BT_FALSE;
@@ -69,7 +69,7 @@ void test_bool(void)
        ok(value,
                "bt_value_bool_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
 }
 
 static
@@ -90,7 +90,7 @@ void test_integer(void)
        value = bt_value_integer_get(obj);
        ok(value == -98765, "bt_private_integer_bool_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        pass("putting an existing integer value object does not cause a crash")
 
        obj = bt_value_integer_create_init(321456987);
@@ -100,7 +100,7 @@ void test_integer(void)
        ok(value == 321456987,
                "bt_value_integer_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
 }
 
 static
@@ -122,7 +122,7 @@ void test_real(void)
        value = bt_value_real_get(obj);
        ok(value == -3.1416, "bt_value_real_set() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        pass("putting an existing real number value object does not cause a crash")
 
        obj = bt_value_real_create_init(33.1649758);
@@ -132,7 +132,7 @@ void test_real(void)
        ok(value == 33.1649758,
                "bt_value_real_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
 }
 
 static
@@ -154,7 +154,7 @@ void test_string(void)
        ok(value && !strcmp(value, "hello worldz"),
                "bt_value_string_get() works");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        pass("putting an existing string value object does not cause a crash")
 
        obj = bt_value_string_create_init("initial value");
@@ -164,7 +164,7 @@ void test_string(void)
        ok(value && !strcmp(value, "initial value"),
                "bt_value_string_create_init() sets the appropriate initial value");
 
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
 }
 
 static
@@ -186,13 +186,13 @@ void test_array(void)
 
        obj = bt_value_integer_create_init(345);
        ret = bt_value_array_append_element(array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        obj = bt_value_real_create_init(-17.45);
        ret |= bt_value_array_append_element(array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        obj = bt_value_bool_create_init(BT_TRUE);
        ret |= bt_value_array_append_element(array_obj, obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        ret |= bt_value_array_append_element(array_obj,
                bt_value_null);
        ok(!ret, "bt_value_array_append_element() succeeds");
@@ -225,7 +225,7 @@ void test_array(void)
        BT_ASSERT(obj);
        ok(!bt_value_array_set_element_by_index(array_obj, 2, obj),
                "bt_value_array_set_element_by_index() succeeds");
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        obj = bt_value_array_borrow_element_by_index(array_obj, 2);
        ok(obj && bt_value_is_integer(obj),
                "bt_value_array_set_element_by_index() inserts an value object with the appropriate type");
@@ -291,7 +291,7 @@ void test_array(void)
        ok(bt_value_map_is_empty(obj),
                "bt_value_array_append_empty_map_element() an empty map value object");
 
-       BT_OBJECT_PUT_REF_AND_RESET(array_obj);
+       BT_VALUE_PUT_REF_AND_RESET(array_obj);
        pass("putting an existing array value object does not cause a crash")
 }
 
@@ -487,13 +487,13 @@ void test_map(void)
 
        obj = bt_value_integer_create_init(19457);
        ret = bt_value_map_insert_entry(map_obj, "int", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        obj = bt_value_real_create_init(5.444);
        ret |= bt_value_map_insert_entry(map_obj, "real", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        obj = bt_value_bool_create();
        ret |= bt_value_map_insert_entry(map_obj, "bt_bool", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        ret |= bt_value_map_insert_entry(map_obj, "null",
                bt_value_null);
        ok(!ret, "bt_value_map_insert_entry() succeeds");
@@ -502,7 +502,7 @@ void test_map(void)
 
        obj = bt_value_bool_create_init(BT_TRUE);
        ret = bt_value_map_insert_entry(map_obj, "bt_bool", obj);
-       BT_OBJECT_PUT_REF_AND_RESET(obj);
+       BT_VALUE_PUT_REF_AND_RESET(obj);
        ok(!ret, "bt_value_map_insert_entry() accepts an existing key");
 
        obj = bt_value_map_borrow_entry_value(map_obj, "life");
@@ -589,7 +589,7 @@ void test_map(void)
                checklist.array2 && checklist.map2,
                "bt_value_map_foreach_entry() iterates over all the map value object's elements");
 
-       BT_OBJECT_PUT_REF_AND_RESET(map_obj);
+       BT_VALUE_PUT_REF_AND_RESET(map_obj);
        pass("putting an existing map value object does not cause a crash")
 }
 
@@ -633,9 +633,9 @@ void test_compare_bool(void)
                            bool3),
                "boolean value objects are equivalent (BT_FALSE and BT_FALSE)");
 
-       BT_OBJECT_PUT_REF_AND_RESET(bool1);
-       BT_OBJECT_PUT_REF_AND_RESET(bool2);
-       BT_OBJECT_PUT_REF_AND_RESET(bool3);
+       BT_VALUE_PUT_REF_AND_RESET(bool1);
+       BT_VALUE_PUT_REF_AND_RESET(bool2);
+       BT_VALUE_PUT_REF_AND_RESET(bool3);
 }
 
 static
@@ -659,9 +659,9 @@ void test_compare_integer(void)
                            int3),
                "integer value objects are equivalent (10 and 10)");
 
-       BT_OBJECT_PUT_REF_AND_RESET(int1);
-       BT_OBJECT_PUT_REF_AND_RESET(int2);
-       BT_OBJECT_PUT_REF_AND_RESET(int3);
+       BT_VALUE_PUT_REF_AND_RESET(int1);
+       BT_VALUE_PUT_REF_AND_RESET(int2);
+       BT_VALUE_PUT_REF_AND_RESET(int3);
 }
 
 static
@@ -686,9 +686,9 @@ void test_compare_real(void)
                            real3),
                "real number value objects are equivalent (17.38 and 17.38)");
 
-       BT_OBJECT_PUT_REF_AND_RESET(real1);
-       BT_OBJECT_PUT_REF_AND_RESET(real2);
-       BT_OBJECT_PUT_REF_AND_RESET(real3);
+       BT_VALUE_PUT_REF_AND_RESET(real1);
+       BT_VALUE_PUT_REF_AND_RESET(real2);
+       BT_VALUE_PUT_REF_AND_RESET(real3);
 }
 
 static
@@ -713,9 +713,9 @@ void test_compare_string(void)
                            string3),
                "string value objects are equivalent (\"hello\" and \"hello\")");
 
-       BT_OBJECT_PUT_REF_AND_RESET(string1);
-       BT_OBJECT_PUT_REF_AND_RESET(string2);
-       BT_OBJECT_PUT_REF_AND_RESET(string3);
+       BT_VALUE_PUT_REF_AND_RESET(string1);
+       BT_VALUE_PUT_REF_AND_RESET(string2);
+       BT_VALUE_PUT_REF_AND_RESET(string3);
 }
 
 static
@@ -764,9 +764,9 @@ void test_compare_array(void)
                            array3),
                "array value objects are equivalent ([23, 14.2, BT_FALSE] and [23, 14.2, BT_FALSE])");
 
-       BT_OBJECT_PUT_REF_AND_RESET(array1);
-       BT_OBJECT_PUT_REF_AND_RESET(array2);
-       BT_OBJECT_PUT_REF_AND_RESET(array3);
+       BT_VALUE_PUT_REF_AND_RESET(array1);
+       BT_VALUE_PUT_REF_AND_RESET(array2);
+       BT_VALUE_PUT_REF_AND_RESET(array3);
 }
 
 static
@@ -819,9 +819,9 @@ void test_compare_map(void)
                            map3),
                "map value objects are equivalent");
 
-       BT_OBJECT_PUT_REF_AND_RESET(map1);
-       BT_OBJECT_PUT_REF_AND_RESET(map2);
-       BT_OBJECT_PUT_REF_AND_RESET(map3);
+       BT_VALUE_PUT_REF_AND_RESET(map1);
+       BT_VALUE_PUT_REF_AND_RESET(map2);
+       BT_VALUE_PUT_REF_AND_RESET(map3);
 }
 
 static
@@ -920,13 +920,13 @@ void test_copy(void)
                            map_copy_obj),
                "source and destination value objects have the same content");
 
-       BT_OBJECT_PUT_REF_AND_RESET(map_copy_obj);
-       BT_OBJECT_PUT_REF_AND_RESET(bool_obj);
-       BT_OBJECT_PUT_REF_AND_RESET(integer_obj);
-       BT_OBJECT_PUT_REF_AND_RESET(real_obj);
-       BT_OBJECT_PUT_REF_AND_RESET(string_obj);
-       BT_OBJECT_PUT_REF_AND_RESET(array_obj);
-       BT_OBJECT_PUT_REF_AND_RESET(map_obj);
+       BT_VALUE_PUT_REF_AND_RESET(map_copy_obj);
+       BT_VALUE_PUT_REF_AND_RESET(bool_obj);
+       BT_VALUE_PUT_REF_AND_RESET(integer_obj);
+       BT_VALUE_PUT_REF_AND_RESET(real_obj);
+       BT_VALUE_PUT_REF_AND_RESET(string_obj);
+       BT_VALUE_PUT_REF_AND_RESET(array_obj);
+       BT_VALUE_PUT_REF_AND_RESET(map_obj);
 }
 
 static
@@ -997,10 +997,10 @@ void test_extend(void)
                                extended_map, "project"),
                "bt_value_map_extend() picks the appropriate element (project)");
 
-       BT_OBJECT_PUT_REF_AND_RESET(array);
-       BT_OBJECT_PUT_REF_AND_RESET(base_map);
-       BT_OBJECT_PUT_REF_AND_RESET(extension_map);
-       BT_OBJECT_PUT_REF_AND_RESET(extended_map);
+       BT_VALUE_PUT_REF_AND_RESET(array);
+       BT_VALUE_PUT_REF_AND_RESET(base_map);
+       BT_VALUE_PUT_REF_AND_RESET(extension_map);
+       BT_VALUE_PUT_REF_AND_RESET(extended_map);
 }
 
 int main(void)
index c360870146aa143b7ca9f559917a49717631d1a7..c2cef11735914212d005eddb9f7c07daf230afda 100644 (file)
@@ -27,7 +27,6 @@
 #include <babeltrace/ctf-writer/event-fields.h>
 #include <babeltrace/ctf-writer/stream-class.h>
 #include <babeltrace/ctf-writer/trace.h>
-#include <babeltrace/object.h>
 #include <babeltrace/ctf/events.h>
 #include <babeltrace/value.h>
 #include <glib.h>
@@ -193,7 +192,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ok(returned_type == int_64_type, "bt_ctf_field_type_enumeration_get_container_field_type returns the right type");
        ok(!bt_ctf_field_type_enumeration_create(enum_type),
                "bt_ctf_field_enumeration_type_create rejects non-integer container field types");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        bt_ctf_field_type_set_alignment(float_type, 32);
        ok(bt_ctf_field_type_get_alignment(float_type) == 32,
@@ -316,7 +315,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        returned_type = bt_ctf_event_class_get_context_field_type(simple_event_class);
        ok(returned_type == event_context_type,
                "bt_ctf_event_class_get_context_field_type returns the appropriate type");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        ok(!bt_ctf_stream_class_add_event_class(stream_class, simple_event_class),
                "Adding simple event class to stream class");
@@ -326,8 +325,8 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
         * of simple_event_class, so we retrieve the new ones to create
         * the appropriate fields.
         */
-       BT_OBJECT_PUT_REF_AND_RESET(event_context_type);
-       BT_OBJECT_PUT_REF_AND_RESET(event_payload_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(event_context_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(event_payload_type);
        event_payload_type = bt_ctf_event_class_get_payload_field_type(
                simple_event_class);
        BT_ASSERT(event_payload_type);
@@ -352,14 +351,14 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ret_event_class = bt_ctf_stream_class_get_event_class_by_index(stream_class, 0);
        ok(ret_event_class == simple_event_class,
                "bt_ctf_stream_class_get_event_class returns the correct event class");
-       bt_object_put_ref(ret_event_class);
+       bt_ctf_object_put_ref(ret_event_class);
        ok(!bt_ctf_stream_class_get_event_class_by_id(stream_class, 2),
                "bt_ctf_stream_class_get_event_class_by_id returns NULL when the requested ID doesn't exist");
        ret_event_class =
                bt_ctf_stream_class_get_event_class_by_id(stream_class, 13);
        ok(ret_event_class == simple_event_class,
                "bt_ctf_stream_class_get_event_class_by_id returns a correct event class");
-       bt_object_put_ref(ret_event_class);
+       bt_ctf_object_put_ref(ret_event_class);
 
        simple_event = bt_ctf_event_create(simple_event_class);
        ok(simple_event,
@@ -386,7 +385,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
                "Set signed enumeration container value");
        ret = bt_ctf_event_set_payload(simple_event, "enum_field", enum_field);
        BT_ASSERT(!ret);
-       BT_OBJECT_PUT_REF_AND_RESET(iter);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(iter);
 
        enum_field_unsigned = bt_ctf_field_create(ep_enum_field_unsigned_type);
        BT_ASSERT(enum_field_unsigned);
@@ -434,7 +433,7 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
                "packet_size");
        ok(packet_context_field,
                "Packet context contains the default packet_size field.");
-       bt_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(packet_context_field);
        packet_context_field = bt_ctf_field_structure_get_field_by_name(packet_context,
                "custom_packet_context_field");
        ok(bt_ctf_field_integer_unsigned_set_value(packet_context_field, 8) == 0,
@@ -446,32 +445,32 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
        ok(bt_ctf_stream_flush(stream) == 0,
                "Flush trace stream with one event");
 
-       bt_object_put_ref(simple_event_class);
-       bt_object_put_ref(simple_event);
-       bt_object_put_ref(uint_12_type);
-       bt_object_put_ref(int_64_type);
-       bt_object_put_ref(float_type);
-       bt_object_put_ref(enum_type);
-       bt_object_put_ref(enum_type_unsigned);
-       bt_object_put_ref(returned_type);
-       bt_object_put_ref(event_context_type);
-       bt_object_put_ref(integer_field);
-       bt_object_put_ref(float_field);
-       bt_object_put_ref(enum_field);
-       bt_object_put_ref(enum_field_unsigned);
-       bt_object_put_ref(enum_container_field);
-       bt_object_put_ref(enum_container_field_unsigned);
-       bt_object_put_ref(packet_context);
-       bt_object_put_ref(packet_context_field);
-       bt_object_put_ref(stream_event_context);
-       bt_object_put_ref(stream_event_context_field);
-       bt_object_put_ref(event_context);
-       bt_object_put_ref(event_context_field);
-       bt_object_put_ref(event_payload_type);
-       bt_object_put_ref(ep_integer_field_type);
-       bt_object_put_ref(ep_enum_field_type);
-       bt_object_put_ref(ep_enum_field_unsigned_type);
-       bt_object_put_ref(iter);
+       bt_ctf_object_put_ref(simple_event_class);
+       bt_ctf_object_put_ref(simple_event);
+       bt_ctf_object_put_ref(uint_12_type);
+       bt_ctf_object_put_ref(int_64_type);
+       bt_ctf_object_put_ref(float_type);
+       bt_ctf_object_put_ref(enum_type);
+       bt_ctf_object_put_ref(enum_type_unsigned);
+       bt_ctf_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(event_context_type);
+       bt_ctf_object_put_ref(integer_field);
+       bt_ctf_object_put_ref(float_field);
+       bt_ctf_object_put_ref(enum_field);
+       bt_ctf_object_put_ref(enum_field_unsigned);
+       bt_ctf_object_put_ref(enum_container_field);
+       bt_ctf_object_put_ref(enum_container_field_unsigned);
+       bt_ctf_object_put_ref(packet_context);
+       bt_ctf_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(stream_event_context);
+       bt_ctf_object_put_ref(stream_event_context_field);
+       bt_ctf_object_put_ref(event_context);
+       bt_ctf_object_put_ref(event_context_field);
+       bt_ctf_object_put_ref(event_payload_type);
+       bt_ctf_object_put_ref(ep_integer_field_type);
+       bt_ctf_object_put_ref(ep_enum_field_type);
+       bt_ctf_object_put_ref(ep_enum_field_unsigned_type);
+       bt_ctf_object_put_ref(iter);
 }
 
 static
@@ -544,7 +543,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                array_type);
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_array_get_element_field_type returns the correct type");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ok(bt_ctf_field_type_array_get_length(array_type) == ARRAY_TEST_LENGTH,
                "bt_ctf_field_type_array_get_length returns the correct length");
@@ -577,7 +576,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ret_field_type = bt_ctf_field_type_variant_get_tag_field_type(variant_type);
        ok(ret_field_type == enum_variant_type,
                "bt_ctf_field_type_variant_get_tag_field_type returns a correct tag type");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ret_string = bt_ctf_field_type_variant_get_tag_name(variant_type);
        ok(ret_string ? !strcmp(ret_string, "variant_selector") : 0,
@@ -586,14 +585,14 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                variant_type, "INT16_TYPE");
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_variant_get_field_type_by_name returns a correct field type");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ok(bt_ctf_field_type_variant_get_field_count(variant_type) == 3,
                "bt_ctf_field_type_variant_get_field_count returns the correct count");
 
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, NULL, &ret_field_type, 0) == 0,
                "bt_ctf_field_type_variant_get_field handles a NULL field name correctly");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, &ret_string, NULL, 0) == 0,
                "bt_ctf_field_type_variant_get_field handles a NULL field type correctly");
        ok(bt_ctf_field_type_variant_get_field_by_index(variant_type, &ret_string, &ret_field_type, 1) == 0,
@@ -602,7 +601,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_type_variant_get_field returns a correct field name");
        ok(ret_field_type == int_16_type,
                "bt_ctf_field_type_variant_get_field returns a correct field type");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        ok(!bt_ctf_field_type_structure_add_field(complex_structure_type,
                enum_variant_type, "variant_selector"),
@@ -679,13 +678,13 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ret_stream_class = bt_ctf_event_class_get_stream_class(event_class);
        ok(ret_stream_class == stream_class,
                "bt_ctf_event_class_get_stream_class returns the correct stream class");
-       bt_object_put_ref(ret_stream_class);
+       bt_ctf_object_put_ref(ret_stream_class);
 
        ok(bt_ctf_event_class_get_field_by_name(event_class, "truie") == NULL,
                "bt_ctf_event_class_get_field_by_name handles an invalid field name correctly");
        ret_field_type = bt_ctf_event_class_get_field_by_name(event_class,
                "complex_structure");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        event = bt_ctf_event_create(event_class);
        ok(event, "Instanciate a complex event");
@@ -693,7 +692,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ret_event_class = bt_ctf_event_get_class(event);
        ok(ret_event_class == event_class,
                "bt_ctf_event_get_class returns the correct event class");
-       bt_object_put_ref(ret_event_class);
+       bt_ctf_object_put_ref(ret_event_class);
 
        uint_35_field = bt_ctf_event_get_payload(event, "uint_35");
        ok(uint_35_field, "Use bt_ctf_event_get_payload to get a field instance ");
@@ -703,7 +702,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_integer_unsigned_get_value succeeds after setting a value");
        ok(ret_unsigned_int == 0x0DDF00D,
                "bt_ctf_field_integer_unsigned_get_value returns the correct value");
-       bt_object_put_ref(uint_35_field);
+       bt_ctf_object_put_ref(uint_35_field);
 
        int_16_field = bt_ctf_event_get_payload(event, "int_16");
        bt_ctf_field_integer_signed_set_value(int_16_field, -12345);
@@ -712,7 +711,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_field_integer_signed_get_value succeeds after setting a value");
        ok(ret_signed_int == -12345,
                "bt_ctf_field_integer_signed_get_value returns the correct value");
-       bt_object_put_ref(int_16_field);
+       bt_ctf_object_put_ref(int_16_field);
 
        complex_structure_field = bt_ctf_event_get_payload(event,
                "complex_structure");
@@ -720,8 +719,8 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        inner_structure_field = bt_ctf_field_structure_get_field_by_index(
                complex_structure_field, 3);
        ret_field_type = bt_ctf_field_get_type(inner_structure_field);
-       bt_object_put_ref(inner_structure_field);
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(inner_structure_field);
+       bt_ctf_object_put_ref(ret_field_type);
 
        inner_structure_field = bt_ctf_field_structure_get_field_by_name(
                complex_structure_field, "inner_structure");
@@ -744,7 +743,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        int_16_field = bt_ctf_field_variant_get_field(variant_field,
                enum_variant_field);
        bt_ctf_field_integer_signed_set_value(int_16_field, -200);
-       bt_object_put_ref(int_16_field);
+       bt_ctf_object_put_ref(int_16_field);
        bt_ctf_field_string_set_value(a_string_field,
                test_string_1);
        ok(!bt_ctf_field_string_append(a_string_field, test_string_2),
@@ -775,23 +774,23 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                int_16_field = bt_ctf_field_sequence_get_field(
                        a_sequence_field, i);
                bt_ctf_field_integer_signed_set_value(int_16_field, 4 - i);
-               bt_object_put_ref(int_16_field);
+               bt_ctf_object_put_ref(int_16_field);
        }
 
        for (i = 0; i < ARRAY_TEST_LENGTH; i++) {
                int_16_field = bt_ctf_field_array_get_field(
                        an_array_field, i);
                bt_ctf_field_integer_signed_set_value(int_16_field, i);
-               bt_object_put_ref(int_16_field);
+               bt_ctf_object_put_ref(int_16_field);
        }
 
        stream_event_ctx_field = bt_ctf_event_get_stream_event_context(event);
        BT_ASSERT(stream_event_ctx_field);
        stream_event_ctx_int_field = bt_ctf_field_structure_get_field_by_name(
                stream_event_ctx_field, "common_event_context");
-       BT_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_field);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_field);
        bt_ctf_field_integer_unsigned_set_value(stream_event_ctx_int_field, 17);
-       BT_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_int_field);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_int_field);
 
        bt_ctf_clock_set_time(clock, ++current_time);
        ok(bt_ctf_stream_append_event(stream, event) == 0,
@@ -809,30 +808,30 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        ok(bt_ctf_stream_flush(stream) == 0,
                "Flush a stream containing a complex event");
 
-       bt_object_put_ref(uint_35_field);
-       bt_object_put_ref(a_string_field);
-       bt_object_put_ref(inner_structure_field);
-       bt_object_put_ref(complex_structure_field);
-       bt_object_put_ref(a_sequence_field);
-       bt_object_put_ref(an_array_field);
-       bt_object_put_ref(enum_variant_field);
-       bt_object_put_ref(enum_container_field);
-       bt_object_put_ref(variant_field);
-       bt_object_put_ref(packet_context_field);
-       bt_object_put_ref(packet_context);
-       bt_object_put_ref(uint_35_type);
-       bt_object_put_ref(int_16_type);
-       bt_object_put_ref(string_type);
-       bt_object_put_ref(sequence_type);
-       bt_object_put_ref(array_type);
-       bt_object_put_ref(inner_structure_type);
-       bt_object_put_ref(complex_structure_type);
-       bt_object_put_ref(uint_3_type);
-       bt_object_put_ref(enum_variant_type);
-       bt_object_put_ref(variant_type);
-       bt_object_put_ref(ret_field_type);
-       bt_object_put_ref(event_class);
-       bt_object_put_ref(event);
+       bt_ctf_object_put_ref(uint_35_field);
+       bt_ctf_object_put_ref(a_string_field);
+       bt_ctf_object_put_ref(inner_structure_field);
+       bt_ctf_object_put_ref(complex_structure_field);
+       bt_ctf_object_put_ref(a_sequence_field);
+       bt_ctf_object_put_ref(an_array_field);
+       bt_ctf_object_put_ref(enum_variant_field);
+       bt_ctf_object_put_ref(enum_container_field);
+       bt_ctf_object_put_ref(variant_field);
+       bt_ctf_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(packet_context);
+       bt_ctf_object_put_ref(uint_35_type);
+       bt_ctf_object_put_ref(int_16_type);
+       bt_ctf_object_put_ref(string_type);
+       bt_ctf_object_put_ref(sequence_type);
+       bt_ctf_object_put_ref(array_type);
+       bt_ctf_object_put_ref(inner_structure_type);
+       bt_ctf_object_put_ref(complex_structure_type);
+       bt_ctf_object_put_ref(uint_3_type);
+       bt_ctf_object_put_ref(enum_variant_type);
+       bt_ctf_object_put_ref(variant_type);
+       bt_ctf_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event);
 }
 
 static
@@ -939,7 +938,7 @@ void type_field_tests()
                sequence_type);
        ok(returned_type == int_16_type,
                "bt_ctf_field_type_sequence_get_element_field_type returns the correct type");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        string_type = bt_ctf_field_type_string_create();
        ok(string_type, "Create a string type");
@@ -975,7 +974,7 @@ void type_field_tests()
        ok(bt_ctf_field_type_structure_get_field(structure_seq_type,
                NULL, &returned_type, 1) == 0,
                "bt_ctf_field_type_structure_get_field handles a NULL name correctly");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
        ok(bt_ctf_field_type_structure_get_field(structure_seq_type,
                &ret_string, NULL, 1) == 0,
                "bt_ctf_field_type_structure_get_field handles a NULL return type correctly");
@@ -986,13 +985,13 @@ void type_field_tests()
                "bt_ctf_field_type_structure_get_field returns a correct field name");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field returns a correct field type");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        returned_type = bt_ctf_field_type_structure_get_field_type_by_name(
                structure_seq_type, "a_sequence");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field_type_by_name returns the correct field type");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        composite_structure_type = bt_ctf_field_type_structure_create();
        ok(bt_ctf_field_type_structure_add_field(composite_structure_type,
@@ -1006,7 +1005,7 @@ void type_field_tests()
                structure_seq_type, "a_sequence");
        ok(returned_type == sequence_type,
                "bt_ctf_field_type_structure_get_field_type_by_name returns a correct type");
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(returned_type);
 
        int_16 = bt_ctf_field_create(int_16_type);
        ok(int_16, "Instanciate a signed 16-bit integer");
@@ -1045,18 +1044,18 @@ void type_field_tests()
        ok(enumeration_type,
                "Create an enumeration type with an unsigned 12-bit integer as container");
 
-       bt_object_put_ref(string);
-       bt_object_put_ref(uint_12);
-       bt_object_put_ref(int_16);
-       bt_object_put_ref(composite_structure_type);
-       bt_object_put_ref(structure_seq_type);
-       bt_object_put_ref(string_type);
-       bt_object_put_ref(sequence_type);
-       bt_object_put_ref(uint_8_type);
-       bt_object_put_ref(int_16_type);
-       bt_object_put_ref(uint_12_type);
-       bt_object_put_ref(enumeration_type);
-       bt_object_put_ref(returned_type);
+       bt_ctf_object_put_ref(string);
+       bt_ctf_object_put_ref(uint_12);
+       bt_ctf_object_put_ref(int_16);
+       bt_ctf_object_put_ref(composite_structure_type);
+       bt_ctf_object_put_ref(structure_seq_type);
+       bt_ctf_object_put_ref(string_type);
+       bt_ctf_object_put_ref(sequence_type);
+       bt_ctf_object_put_ref(uint_8_type);
+       bt_ctf_object_put_ref(int_16_type);
+       bt_ctf_object_put_ref(uint_12_type);
+       bt_ctf_object_put_ref(enumeration_type);
+       bt_ctf_object_put_ref(returned_type);
 }
 
 static
@@ -1114,9 +1113,9 @@ void packet_resize_test(struct bt_ctf_stream_class *stream_class,
        event = bt_ctf_event_create(event_class);
        ret_field = bt_ctf_event_get_payload(event, 0);
        ret_field_type = bt_ctf_field_get_type(ret_field);
-       bt_object_put_ref(ret_field_type);
-       bt_object_put_ref(ret_field);
-       bt_object_put_ref(event);
+       bt_ctf_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field);
+       bt_ctf_object_put_ref(event);
 
        for (i = 0; i < packet_resize_test_length; i++) {
                event = bt_ctf_event_create(event_class);
@@ -1129,24 +1128,24 @@ void packet_resize_test(struct bt_ctf_stream_class *stream_class,
                ret |= bt_ctf_field_integer_unsigned_set_value(integer, i);
                ret |= bt_ctf_event_set_payload(event, "field_1",
                        integer);
-               bt_object_put_ref(integer);
+               bt_ctf_object_put_ref(integer);
                ret |= bt_ctf_field_string_set_value(string, "This is a test");
                ret |= bt_ctf_event_set_payload(event, "a_string",
                        string);
-               bt_object_put_ref(string);
+               bt_ctf_object_put_ref(string);
 
                /* Populate stream event context */
                stream_event_context =
                        bt_ctf_event_get_stream_event_context(event);
                integer = bt_ctf_field_structure_get_field_by_name(stream_event_context,
                        "common_event_context");
-               BT_OBJECT_PUT_REF_AND_RESET(stream_event_context);
+               BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_context);
                ret |= bt_ctf_field_integer_unsigned_set_value(integer,
                        i % 42);
-               bt_object_put_ref(integer);
+               bt_ctf_object_put_ref(integer);
 
                ret |= bt_ctf_stream_append_event(stream, event);
-               bt_object_put_ref(event);
+               bt_ctf_object_put_ref(event);
 
                if (ret) {
                        break;
@@ -1179,15 +1178,15 @@ end:
        ret = bt_ctf_stream_get_discarded_events_count(stream, &ret_uint64);
        ok(ret == 0 && ret_uint64 == 1000,
                "bt_ctf_stream_get_discarded_events_count returns a correct number of discarded events after a flush");
-       bt_object_put_ref(integer_type);
-       bt_object_put_ref(string_type);
-       bt_object_put_ref(packet_context);
-       bt_object_put_ref(packet_context_field);
-       bt_object_put_ref(stream_event_context);
-       bt_object_put_ref(event_class);
-       bt_object_put_ref(ep_field_1_type);
-       bt_object_put_ref(ep_a_string_type);
-       bt_object_put_ref(ep_type);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(string_type);
+       bt_ctf_object_put_ref(packet_context);
+       bt_ctf_object_put_ref(packet_context_field);
+       bt_ctf_object_put_ref(stream_event_context);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(ep_field_1_type);
+       bt_ctf_object_put_ref(ep_a_string_type);
+       bt_ctf_object_put_ref(ep_type);
 }
 
 static
@@ -1233,10 +1232,10 @@ void test_empty_stream(struct bt_ctf_writer *writer)
 end:
        ok(ret == 0,
                "Created a stream class with default attributes and an empty stream");
-       bt_object_put_ref(trace);
-       bt_object_put_ref(ret_trace);
-       bt_object_put_ref(stream);
-       bt_object_put_ref(stream_class);
+       bt_ctf_object_put_ref(trace);
+       bt_ctf_object_put_ref(ret_trace);
+       bt_ctf_object_put_ref(stream);
+       bt_ctf_object_put_ref(stream_class);
 }
 
 static
@@ -1348,7 +1347,7 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                fail("Failed to set custom_trace_packet_header_field value");
                goto end;
        }
-       bt_object_put_ref(integer);
+       bt_ctf_object_put_ref(integer);
 
        event = bt_ctf_event_create(event_class);
        if (!event) {
@@ -1387,7 +1386,7 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                fail("Failed to set sequence length");
                goto end;
        }
-       bt_object_put_ref(integer);
+       bt_ctf_object_put_ref(integer);
 
        for (i = 0; i < 2; i++) {
                integer = bt_ctf_field_sequence_get_field(sequence, i);
@@ -1402,7 +1401,7 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                        goto end;
                }
 
-               bt_object_put_ref(integer);
+               bt_ctf_object_put_ref(integer);
                integer = NULL;
        }
 
@@ -1417,17 +1416,17 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer,
                fail("Failed to flush custom_event_header stream");
        }
 end:
-       bt_object_put_ref(stream);
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(event_class);
-       bt_object_put_ref(event);
-       bt_object_put_ref(integer);
-       bt_object_put_ref(sequence);
-       bt_object_put_ref(event_header);
-       bt_object_put_ref(packet_header);
-       bt_object_put_ref(sequence_type);
-       bt_object_put_ref(integer_type);
-       bt_object_put_ref(event_header_type);
+       bt_ctf_object_put_ref(stream);
+       bt_ctf_object_put_ref(stream_class);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event);
+       bt_ctf_object_put_ref(integer);
+       bt_ctf_object_put_ref(sequence);
+       bt_ctf_object_put_ref(event_header);
+       bt_ctf_object_put_ref(packet_header);
+       bt_ctf_object_put_ref(sequence_type);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(event_header_type);
 }
 
 static
@@ -1524,14 +1523,14 @@ void test_instanciate_event_before_stream(struct bt_ctf_writer *writer,
 end:
        ok(ret == 0,
                "Create an event before instanciating its associated stream");
-       bt_object_put_ref(stream);
-       bt_object_put_ref(ret_stream);
-       bt_object_put_ref(stream_class);
-       bt_object_put_ref(event_class);
-       bt_object_put_ref(event);
-       bt_object_put_ref(integer_type);
-       bt_object_put_ref(integer);
-       bt_object_put_ref(payload_field);
+       bt_ctf_object_put_ref(stream);
+       bt_ctf_object_put_ref(ret_stream);
+       bt_ctf_object_put_ref(stream_class);
+       bt_ctf_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(integer);
+       bt_ctf_object_put_ref(payload_field);
 }
 
 static
@@ -1544,7 +1543,7 @@ void append_existing_event_class(struct bt_ctf_stream_class *stream_class)
        BT_ASSERT(event_class);
        ok(bt_ctf_stream_class_add_event_class(stream_class, event_class) == 0,
                "two event classes with the same name may cohabit within the same stream class");
-       bt_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event_class);
 
        event_class = bt_ctf_event_class_create("different name, ok");
        BT_ASSERT(event_class);
@@ -1552,7 +1551,7 @@ void append_existing_event_class(struct bt_ctf_stream_class *stream_class)
        BT_ASSERT(ret == 0);
        ok(bt_ctf_stream_class_add_event_class(stream_class, event_class),
                "two event classes with the same ID cannot cohabit within the same stream class");
-       bt_object_put_ref(event_class);
+       bt_ctf_object_put_ref(event_class);
 }
 
 static
@@ -1572,7 +1571,7 @@ void test_clock_utils(void)
        ret = bt_ctf_clock_set_frequency(clock, 1534);
        BT_ASSERT(!ret);
 
-       BT_OBJECT_PUT_REF_AND_RESET(clock);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(clock);
 }
 
 int main(int argc, char **argv)
@@ -1809,7 +1808,7 @@ int main(int argc, char **argv)
        ret_clock = bt_ctf_stream_class_get_clock(stream_class);
        ok(ret_clock == clock,
                "bt_ctf_stream_class_get_clock returns a correct clock");
-       bt_object_put_ref(ret_clock);
+       bt_ctf_object_put_ref(ret_clock);
 
        /* Test the event fields and event types APIs */
        type_field_tests();
@@ -1838,7 +1837,7 @@ int main(int argc, char **argv)
        ok(bt_ctf_field_type_get_type_id(
                event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER,
                "Default event header \"id\" field is an integer");
-       bt_object_put_ref(event_header_field_type);
+       bt_ctf_object_put_ref(event_header_field_type);
        event_header_field_type =
                bt_ctf_field_type_structure_get_field_type_by_name(
                ret_field_type, "timestamp");
@@ -1847,8 +1846,8 @@ int main(int argc, char **argv)
        ok(bt_ctf_field_type_get_type_id(
                event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER,
                "Default event header \"timestamp\" field is an integer");
-       bt_object_put_ref(event_header_field_type);
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(event_header_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        /* Add a custom trace packet header field */
        packet_header_type = bt_ctf_trace_get_packet_header_field_type(trace);
@@ -1859,15 +1858,15 @@ int main(int argc, char **argv)
        ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
                packet_header_type, "magic");
        ok(ret_field_type, "Default packet header type contains a \"magic\" field");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
                packet_header_type, "uuid");
        ok(ret_field_type, "Default packet header type contains a \"uuid\" field");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name(
                packet_header_type, "stream_id");
        ok(ret_field_type, "Default packet header type contains a \"stream_id\" field");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
        packet_header_field_type = bt_ctf_field_type_integer_create(22);
        ok(!bt_ctf_field_type_structure_add_field(packet_header_type,
@@ -1922,7 +1921,7 @@ int main(int argc, char **argv)
                stream_class);
        ok(ret_field_type == stream_event_context_type,
                "bt_ctf_stream_class_get_event_context_type returns the correct field type.");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
 
 
        /* Instantiate a stream and append events */
@@ -1938,7 +1937,7 @@ int main(int argc, char **argv)
        stream = bt_ctf_trace_get_stream_by_index(trace, 0);
        ok(stream == stream1,
                "bt_ctf_trace_get_stream_by_index() succeeds and returns the correct value");
-       BT_OBJECT_PUT_REF_AND_RESET(stream);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream);
 
        /*
         * Creating a stream through a writer adds the given stream
@@ -1957,9 +1956,9 @@ int main(int argc, char **argv)
         * event context types were copied for the resolving
         * process
         */
-       BT_OBJECT_PUT_REF_AND_RESET(packet_header_type);
-       BT_OBJECT_PUT_REF_AND_RESET(packet_context_type);
-       BT_OBJECT_PUT_REF_AND_RESET(stream_event_context_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(packet_header_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(packet_context_type);
+       BT_CTF_OBJECT_PUT_REF_AND_RESET(stream_event_context_type);
        packet_header_type = bt_ctf_trace_get_packet_header_field_type(trace);
        BT_ASSERT(packet_header_type);
        packet_context_type =
@@ -2009,7 +2008,7 @@ int main(int argc, char **argv)
        ret_field_type = bt_ctf_field_get_type(packet_header);
        ok(ret_field_type == packet_header_type,
                "Stream returns a packet header of the appropriate type");
-       bt_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(ret_field_type);
        packet_header_field = bt_ctf_field_structure_get_field_by_name(packet_header,
                "custom_trace_packet_header_field");
        ok(packet_header_field,
@@ -2050,22 +2049,22 @@ int main(int argc, char **argv)
 
        bt_ctf_writer_flush_metadata(writer);
 
-       bt_object_put_ref(clock);
-       bt_object_put_ref(ret_stream_class);
-       bt_object_put_ref(writer);
-       bt_object_put_ref(stream1);
-       bt_object_put_ref(packet_context_type);
-       bt_object_put_ref(packet_context_field_type);
-       bt_object_put_ref(integer_type);
-       bt_object_put_ref(stream_event_context_type);
-       bt_object_put_ref(ret_field_type);
-       bt_object_put_ref(packet_header_type);
-       bt_object_put_ref(packet_header_field_type);
-       bt_object_put_ref(packet_header);
-       bt_object_put_ref(packet_header_field);
-       bt_object_put_ref(trace);
+       bt_ctf_object_put_ref(clock);
+       bt_ctf_object_put_ref(ret_stream_class);
+       bt_ctf_object_put_ref(writer);
+       bt_ctf_object_put_ref(stream1);
+       bt_ctf_object_put_ref(packet_context_type);
+       bt_ctf_object_put_ref(packet_context_field_type);
+       bt_ctf_object_put_ref(integer_type);
+       bt_ctf_object_put_ref(stream_event_context_type);
+       bt_ctf_object_put_ref(ret_field_type);
+       bt_ctf_object_put_ref(packet_header_type);
+       bt_ctf_object_put_ref(packet_header_field_type);
+       bt_ctf_object_put_ref(packet_header);
+       bt_ctf_object_put_ref(packet_header_field);
+       bt_ctf_object_put_ref(trace);
        free(metadata_string);
-       bt_object_put_ref(stream_class);
+       bt_ctf_object_put_ref(stream_class);
 
        validate_trace(argv[1], trace_path);
 
index 720dfb06e920218f56797acdefa099b32b0b6ce6..4f04fb48892f649d3ab6a17389410e11f2f7db9f 100644 (file)
@@ -731,8 +731,8 @@ void init_test(void)
 static
 void fini_test(void)
 {
-       bt_object_put_ref(src_comp_class);
-       bt_object_put_ref(sink_comp_class);
+       bt_component_class_source_put_ref(src_comp_class);
+       bt_component_class_sink_put_ref(sink_comp_class);
        g_array_free(events, TRUE);
 }
 
@@ -973,9 +973,9 @@ void test_sink_removes_port_in_consume_then_src_removes_disconnected_port(void)
        ok(graph_port_removed_src_pos < graph_port_removed_sink_pos,
                "event order is good (13)");
 
-       bt_object_put_ref(graph);
-       bt_object_put_ref(sink);
-       bt_object_put_ref(src);
+       bt_graph_put_ref(graph);
+       bt_component_sink_put_ref(sink);
+       bt_component_source_put_ref(src);
 }
 
 static
@@ -1139,9 +1139,9 @@ void test_sink_removes_port_in_consume(void)
        ok(graph_ports_disconnected_pos < graph_port_removed_sink_pos,
                "event order is good (11)");
 
-       bt_object_put_ref(sink);
-       bt_object_put_ref(src);
-       bt_object_put_ref(graph);
+       bt_component_sink_put_ref(sink);
+       bt_component_source_put_ref(src);
+       bt_graph_put_ref(graph);
 }
 
 static
@@ -1268,9 +1268,9 @@ void test_src_adds_port_in_port_connected(void)
        ok(graph_port_added_src_pos < graph_ports_connected_pos,
                "event order is good (6)");
 
-       bt_object_put_ref(src);
-       bt_object_put_ref(sink);
-       bt_object_put_ref(graph);
+       bt_component_source_put_ref(src);
+       bt_component_sink_put_ref(sink);
+       bt_graph_put_ref(graph);
 }
 
 static
@@ -1378,9 +1378,9 @@ void test_simple(void)
        ok(sink_accept_port_connection_pos < sink_port_connected_pos,
                "event order is good (4)");
 
-       bt_object_put_ref(sink);
-       bt_object_put_ref(graph);
-       bt_object_put_ref(src);
+       bt_component_sink_put_ref(sink);
+       bt_graph_put_ref(graph);
+       bt_component_source_put_ref(src);
 }
 
 static
@@ -1464,10 +1464,10 @@ void test_src_port_connected_error(void)
        ok(src_accept_port_connection_pos < src_port_connected_pos,
                "event order is good (1)");
 
-       bt_object_put_ref(graph);
-       bt_object_put_ref(sink);
-       bt_object_put_ref(src);
-       bt_object_put_ref(conn);
+       bt_graph_put_ref(graph);
+       bt_component_sink_put_ref(sink);
+       bt_component_source_put_ref(src);
+       bt_connection_put_ref(conn);
 }
 
 static
@@ -1574,10 +1574,10 @@ void test_sink_port_connected_error(void)
        ok(sink_port_connected_pos < src_port_disconnected_pos,
                "event order is good (3)");
 
-       bt_object_put_ref(conn);
-       bt_object_put_ref(graph);
-       bt_object_put_ref(sink);
-       bt_object_put_ref(src);
+       bt_connection_put_ref(conn);
+       bt_graph_put_ref(graph);
+       bt_component_sink_put_ref(sink);
+       bt_component_source_put_ref(src);
 }
 
 static
@@ -1588,7 +1588,7 @@ void test_empty_graph(void)
        prepare_test(TEST_EMPTY_GRAPH, "empty graph");
        graph = create_graph();
        ok(events->len == 0, "empty graph generates no events");
-       bt_object_put_ref(graph);
+       bt_graph_put_ref(graph);
 }
 
 int main(int argc, char **argv)
index a8ddcb50215bb10707b16bdc9b93ece06ab3e439..c8fc32d7be33a98c5a20cdef94e5712f7882872b 100644 (file)
@@ -100,7 +100,7 @@ static void test_minimal(const char *plugin_dir)
                "bt_plugin_get_filter_component_class_count() returns the expected value");
        ok(bt_plugin_get_sink_component_class_count(plugin) == 0,
                "bt_plugin_get_sink_component_class_count() returns the expected value");
-       bt_object_put_ref(plugin_set);
+       bt_plugin_set_put_ref(plugin_set);
        ok(check_env_var("BT_TEST_PLUGIN_EXIT_CALLED") == 1,
                "plugin's exit function is called when the plugin is destroyed");
 
@@ -189,23 +189,23 @@ static void test_sfs(const char *plugin_dir)
        ok(bt_value_compare(res_params, params),
                "bt_component_class_query() receives the expected parameters");
 
-       bt_object_get_ref(sink_comp_class);
+       bt_component_class_sink_get_ref(sink_comp_class);
        diag("> putting the plugin set object here");
-       BT_OBJECT_PUT_REF_AND_RESET(plugin_set);
+       BT_PLUGIN_SET_PUT_REF_AND_RESET(plugin_set);
        graph = bt_graph_create();
        BT_ASSERT(graph);
        graph_ret = bt_graph_add_sink_component(graph, sink_comp_class,
                "the-sink", NULL, &sink_component);
        ok(graph_ret == BT_GRAPH_STATUS_OK && sink_component,
                "bt_graph_add_sink_component() still works after the plugin object is destroyed");
-       BT_OBJECT_PUT_REF_AND_RESET(sink_component);
-       bt_object_put_ref(graph);
+       BT_COMPONENT_SINK_PUT_REF_AND_RESET(sink_component);
+       bt_graph_put_ref(graph);
 
        free(sfs_path);
-       bt_object_put_ref(sink_comp_class);
-       bt_object_put_ref(results);
-       bt_object_put_ref(params);
-       bt_object_put_ref(query_exec);
+       bt_component_class_sink_put_ref(sink_comp_class);
+       bt_value_put_ref(results);
+       bt_value_put_ref(params);
+       bt_query_executor_put_ref(query_exec);
 }
 
 static void test_create_all_from_dir(const char *plugin_dir)
@@ -226,7 +226,7 @@ static void test_create_all_from_dir(const char *plugin_dir)
                bt_plugin_set_get_plugin_count(plugin_set) == 4,
                "bt_plugin_create_all_from_dir() returns the expected number of plugin objects");
 
-       bt_object_put_ref(plugin_set);
+       bt_plugin_set_put_ref(plugin_set);
 }
 
 static void test_find(const char *plugin_dir)
@@ -251,7 +251,7 @@ static void test_find(const char *plugin_dir)
                "bt_plugin_find() succeeds with a plugin name it can find");
        ok(strcmp(bt_plugin_get_author(plugin), "Janine Sutto") == 0,
                "bt_plugin_find() finds the correct plugin for a given name");
-       BT_OBJECT_PUT_REF_AND_RESET(plugin);
+       BT_PLUGIN_PUT_REF_AND_RESET(plugin);
        free(plugin_path);
 }
 
index 9f9da406d66eec8b78c61be24ca19f28b07ff0c0..1c827892a7598b09e7d0c0c486caf2a6638a3a7c 100644 (file)
@@ -89,9 +89,9 @@ static struct bt_field_class *create_integer_struct(void)
        ret = bt_field_class_structure_append_member(structure,
                "payload_32", ui32);
        BT_ASSERT(ret == 0);
-       BT_OBJECT_PUT_REF_AND_RESET(ui8);
-       BT_OBJECT_PUT_REF_AND_RESET(ui16);
-       BT_OBJECT_PUT_REF_AND_RESET(ui32);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(ui8);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(ui16);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(ui32);
        return structure;
 }
 
@@ -146,7 +146,7 @@ static struct bt_event_class *create_simple_event(
        BT_ASSERT(payload);
        ret = bt_event_class_set_payload_field_class(event, payload);
        BT_ASSERT(ret == 0);
-       BT_OBJECT_PUT_REF_AND_RESET(payload);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(payload);
        return event;
 }
 
@@ -182,8 +182,8 @@ static struct bt_event_class *create_complex_event(
        BT_ASSERT(ret == 0);
        ret = bt_event_class_set_payload_field_class(event, outer);
        BT_ASSERT(ret == 0);
-       BT_OBJECT_PUT_REF_AND_RESET(inner);
-       BT_OBJECT_PUT_REF_AND_RESET(outer);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(inner);
+       BT_FIELD_CLASS_PUT_REF_AND_RESET(outer);
        return event;
 }
 
@@ -203,14 +203,14 @@ static void set_stream_class_field_classes(
        ret = bt_field_class_structure_append_member(packet_context_type,
                "packet_size", fc);
        BT_ASSERT(ret == 0);
-       bt_object_put_ref(fc);
+       bt_field_class_put_ref(fc);
        fc = bt_field_class_unsigned_integer_create();
        BT_ASSERT(fc);
        bt_field_class_integer_set_field_value_range(fc, 32);
        ret = bt_field_class_structure_append_member(packet_context_type,
                "content_size", fc);
        BT_ASSERT(ret == 0);
-       bt_object_put_ref(fc);
+       bt_field_class_put_ref(fc);
        event_header_type = bt_field_class_structure_create();
        BT_ASSERT(event_header_type);
        fc = bt_field_class_unsigned_integer_create();
@@ -219,15 +219,15 @@ static void set_stream_class_field_classes(
        ret = bt_field_class_structure_append_member(event_header_type,
                "id", fc);
        BT_ASSERT(ret == 0);
-       bt_object_put_ref(fc);
+       bt_field_class_put_ref(fc);
        ret = bt_stream_class_set_packet_context_field_class(
                stream_class, packet_context_type);
        BT_ASSERT(ret == 0);
        ret = bt_stream_class_set_event_header_field_class(
                stream_class, event_header_type);
        BT_ASSERT(ret == 0);
-       bt_object_put_ref(packet_context_type);
-       bt_object_put_ref(event_header_type);
+       bt_field_class_put_ref(packet_context_type);
+       bt_field_class_put_ref(event_header_type);
 }
 
 static void create_sc1(struct bt_trace_class *trace_class)
@@ -249,9 +249,9 @@ static void create_sc1(struct bt_trace_class *trace_class)
        ok(ret_stream == sc1, "Borrow parent stream SC1 from EC1");
        ret_stream = bt_event_class_borrow_stream_class(ec2);
        ok(ret_stream == sc1, "Borrow parent stream SC1 from EC2");
-       BT_OBJECT_PUT_REF_AND_RESET(ec1);
-       BT_OBJECT_PUT_REF_AND_RESET(ec2);
-       BT_OBJECT_PUT_REF_AND_RESET(sc1);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(ec1);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(ec2);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(sc1);
 }
 
 static void create_sc2(struct bt_trace_class *trace_class)
@@ -268,8 +268,8 @@ static void create_sc2(struct bt_trace_class *trace_class)
        ec3 = create_simple_event(sc2, "ec3");
        ret_stream = bt_event_class_borrow_stream_class(ec3);
        ok(ret_stream == sc2, "Borrow parent stream SC2 from EC3");
-       BT_OBJECT_PUT_REF_AND_RESET(ec3);
-       BT_OBJECT_PUT_REF_AND_RESET(sc2);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(ec3);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(sc2);
 }
 
 static void set_trace_packet_header(struct bt_trace_class *trace_class)
@@ -286,12 +286,12 @@ static void set_trace_packet_header(struct bt_trace_class *trace_class)
        ret = bt_field_class_structure_append_member(packet_header_type,
                "stream_id", fc);
        BT_ASSERT(ret == 0);
-       bt_object_put_ref(fc);
+       bt_field_class_put_ref(fc);
        ret = bt_trace_class_set_packet_header_field_class(trace_class,
                packet_header_type);
        BT_ASSERT(ret == 0);
 
-       bt_object_put_ref(packet_header_type);
+       bt_field_class_put_ref(packet_header_type);
 }
 
 static struct bt_trace_class *create_tc1(void)
@@ -362,7 +362,7 @@ static void test_example_scenario(void)
        /* User A acquires a reference to SC2 from TC1. */
        user_a.sc = bt_trace_class_borrow_stream_class_by_index(
                        user_a.tc, 1);
-       bt_object_get_ref(user_a.sc);
+       bt_stream_class_get_ref(user_a.sc);
        ok(user_a.sc, "User A acquires SC2 from TC1");
        ok(bt_object_get_ref_count((void *) weak_tc1) == 2,
                        "TC1 reference count is 2");
@@ -372,7 +372,7 @@ static void test_example_scenario(void)
        /* User A acquires a reference to EC3 from SC2. */
        user_a.ec = bt_stream_class_borrow_event_class_by_index(
                        user_a.sc, 0);
-       bt_object_get_ref(user_a.ec);
+       bt_event_class_get_ref(user_a.ec);
        ok(user_a.ec, "User A acquires EC3 from SC2");
        ok(bt_object_get_ref_count((void *) weak_tc1) == 2,
                        "TC1 reference count is 2");
@@ -383,7 +383,7 @@ static void test_example_scenario(void)
 
        /* User A releases its reference to SC2. */
        diag("User A releases SC2");
-       BT_OBJECT_PUT_REF_AND_RESET(user_a.sc);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(user_a.sc);
        /*
         * We keep the pointer to SC2 around to validate its reference
         * count.
@@ -397,7 +397,7 @@ static void test_example_scenario(void)
 
        /* User A releases its reference to TC1. */
        diag("User A releases TC1");
-       BT_OBJECT_PUT_REF_AND_RESET(user_a.tc);
+       BT_TRACE_CLASS_PUT_REF_AND_RESET(user_a.tc);
        /*
         * We keep the pointer to TC1 around to validate its reference
         * count.
@@ -412,7 +412,7 @@ static void test_example_scenario(void)
        /* User B acquires a reference to SC1. */
        diag("User B acquires a reference to SC1");
        user_b.sc = weak_sc1;
-       bt_object_get_ref(user_b.sc);
+       bt_stream_class_get_ref(user_b.sc);
        ok(bt_object_get_ref_count((void *) weak_tc1) == 2,
                        "TC1 reference count is 2");
        ok(bt_object_get_ref_count((void *) weak_sc1) == 1,
@@ -422,7 +422,7 @@ static void test_example_scenario(void)
        diag("User C acquires a reference to EC1");
        user_c.ec = bt_stream_class_borrow_event_class_by_index(
                        user_b.sc, 0);
-       bt_object_get_ref(user_c.ec);
+       bt_event_class_get_ref(user_c.ec);
        ok(bt_object_get_ref_count((void *) weak_ec1) == 1,
                        "EC1 reference count is 1");
        ok(bt_object_get_ref_count((void *) weak_sc1) == 2,
@@ -430,7 +430,7 @@ static void test_example_scenario(void)
 
        /* User A releases its reference on EC3. */
        diag("User A releases its reference on EC3");
-       BT_OBJECT_PUT_REF_AND_RESET(user_a.ec);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(user_a.ec);
        ok(bt_object_get_ref_count((void *) weak_ec3) == 0,
                        "EC3 reference count is 1");
        ok(bt_object_get_ref_count((void *) weak_sc2) == 0,
@@ -440,7 +440,7 @@ static void test_example_scenario(void)
 
        /* User B releases its reference on SC1. */
        diag("User B releases its reference on SC1");
-       BT_OBJECT_PUT_REF_AND_RESET(user_b.sc);
+       BT_STREAM_CLASS_PUT_REF_AND_RESET(user_b.sc);
        ok(bt_object_get_ref_count((void *) weak_sc1) == 1,
                        "SC1 reference count is 1");
 
@@ -462,7 +462,7 @@ static void test_example_scenario(void)
                        "EC3 reference count is 0");
 
        /* Reclaim last reference held by User C. */
-       BT_OBJECT_PUT_REF_AND_RESET(user_c.ec);
+       BT_EVENT_CLASS_PUT_REF_AND_RESET(user_c.ec);
 }
 
 static void create_writer_user_full(struct writer_user *user)
This page took 0.179953 seconds and 4 git commands to generate.