}
end:
- bt_object_put_ref(connected_components);
+ bt_value_put_ref(connected_components);
return ret;
}
}
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);
BT_OBJECT_PUT_REF_AND_RESET(cfg);
end:
- bt_object_put_ref(initial_plugin_paths);
+ bt_value_put_ref(initial_plugin_paths);
return cfg;
}
}
end:
- BT_OBJECT_PUT_REF_AND_RESET(value);
+ BT_VALUE_PUT_REF_AND_RESET(value);
return ret;
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(state.params);
+ BT_VALUE_PUT_REF_AND_RESET(state.params);
end:
if (state.scanner) {
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:
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:
return names;
error:
- BT_OBJECT_PUT_REF_AND_RESET(names);
+ BT_VALUE_PUT_REF_AND_RESET(names);
if (scanner) {
g_scanner_destroy(scanner);
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(fields);
+ BT_VALUE_PUT_REF_AND_RESET(fields);
end:
if (scanner) {
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",
poptFreeContext(pc);
}
- bt_object_put_ref(params);
+ bt_value_put_ref(params);
free(arg);
return cfg;
}
}
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) {
status = bt_value_map_extend(cur_cfg_comp->params,
params, ¶ms_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);
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();
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;
}
g_string_free(args->params_arg, TRUE);
}
- bt_object_put_ref(args->extra_params);
+ bt_value_put_ref(args->extra_params);
}
static
* 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) {
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;
}
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;
}
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);
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(<tng_live_url_parts);
return cfg;
}
goto end;
}
} else {
- bt_object_get_ref(initial_plugin_paths);
+ bt_value_get_ref(initial_plugin_paths);
}
if (argc <= 1) {
}
end:
- bt_object_put_ref(initial_plugin_paths);
+ bt_value_put_ref(initial_plugin_paths);
return config;
}
#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>
#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>
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
end:
destroy_the_query_executor();
- bt_object_put_ref(result);
+ bt_value_put_ref(result);
return ret;
}
}
}
- bt_object_get_ref(plugin);
+ bt_plugin_get_ref(plugin);
return plugin;
}
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) {
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);
}
}
}
add_to_loaded_plugins(plugin_set);
- bt_object_put_ref(plugin_set);
+ bt_plugin_set_put_ref(plugin_set);
}
end:
return ret;
}
add_to_loaded_plugins(plugin_set);
- bt_object_put_ref(plugin_set);
+ bt_plugin_set_put_ref(plugin_set);
end:
return ret;
}
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;
}
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;
}
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);
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);
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;
}
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;
}
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;
babeltraceinclude_HEADERS = \
babeltrace/babeltrace.h \
babeltrace/logging.h \
- babeltrace/object.h \
babeltrace/property.h \
babeltrace/types.h \
babeltrace/value-const.h \
* <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
/* Core API */
#include <babeltrace/logging.h>
-#include <babeltrace/object.h>
#include <babeltrace/property.h>
#include <babeltrace/types.h>
#include <babeltrace/value-const.h>
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
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
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
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
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
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
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
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
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
+++ /dev/null
-#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 */
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
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
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
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
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
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
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
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
}
}
+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 */
+++ /dev/null
-#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 */
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
#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>
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
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
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
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
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
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
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;
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
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
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
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
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
libbabeltrace_la_SOURCES = \
babeltrace.c \
value.c \
- object.c \
lib-logging.c \
logging.c \
object-pool.c
#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
#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) \
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);
+}
#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>
#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)
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);
+}
#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>
#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)
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);
+}
#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>
#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)
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);
+}
#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>
}
}
}
+
+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);
+}
#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>
#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>
{
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);
+}
#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>
#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>
*/
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);
+}
#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>
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);
+}
#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>
#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>
#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>
#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)
#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)
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);
+}
#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>
#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
#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)
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);
+}
#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)
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);
+}
#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>
#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,
+++ /dev/null
-/*
- * 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);
-}
#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>
#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>
#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>
#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>
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);
+}
#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>
#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>
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);
+}
#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>
#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>
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);
+}
#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
#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>
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);
+}
#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>
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);
+}
#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>
#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>
"%![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);
+}
#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>
#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>
/* 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);
+}
#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>
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);
+}
#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>
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);
+}
#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>
{
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);
+}
#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>
#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))
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);
+}
#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>
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;
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;
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;
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,
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(
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);
}
}
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);
}
}
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(
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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:
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);
}
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;
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;
}
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);
}
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);
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);
(*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:
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:
/*
* 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:
/*
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;
}
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;
}
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;
}
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 "
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;
}
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;
}
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;
}
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;
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;
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;
}
}
- BT_OBJECT_PUT_REF_AND_RESET(notit->packet);
+ BT_PACKET_PUT_REF_AND_RESET(notit->packet);
*notification = notif;
}
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);
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
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;
}
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,
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. */
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;
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;
}
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;
}
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));
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;
}
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;
}
}
ret = writer_new_packet(writer_component, packet);
- bt_object_put_ref(packet);
+ bt_packet_put_ref(packet);
break;
}
case BT_NOTIFICATION_TYPE_PACKET_END:
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:
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:
goto end;
}
ret = writer_stream_end(writer_component, stream);
- bt_object_put_ref(stream);
+ bt_stream_put_ref(stream);
break;
}
default:
*found = true;
}
end:
- bt_object_put_ref(value);
+ bt_value_put_ref(value);
return ret;
}
}
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");
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) {
* 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;
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);
/*
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;
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);
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);
}
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;
}
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) {
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(result);
+ BT_VALUE_PUT_REF_AND_RESET(result);
result = NULL;
if (status >= 0) {
}
end:
- bt_object_put_ref(range_map);
+ bt_value_put_ref(range_map);
return ret;
}
goto end;
}
end:
- bt_object_put_ref(file_paths);
+ bt_value_put_ref(file_paths);
return ret;
}
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;
}
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;
}
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;
}
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;
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(result);
+ BT_VALUE_PUT_REF_AND_RESET(result);
result = NULL;
if (status >= 0) {
print_state(stream),
stream->last_returned_inactivity_timestamp,
stream->current_inactivity_timestamp);
- bt_object_put_ref(port);
+ bt_port_put_ref(port);
}
BT_HIDDEN
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;
}
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;
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);
*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;
}
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;
}
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;
}
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) {
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;
goto end;
}
end:
- bt_object_put_ref(self_port);
+ bt_port_put_ref(self_port);
return status;
}
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;
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) {
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;
}
if (url) {
g_string_free(url, TRUE);
}
- BT_OBJECT_PUT_REF_AND_RESET(map);
+ BT_VALUE_PUT_REF_AND_RESET(map);
return ret;
}
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(results);
+ BT_VALUE_PUT_REF_AND_RESET(results);
end:
return results;
}
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) {
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;
/* 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;
}
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;
}
}
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);
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;
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;
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;
/*
* 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;
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:
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);
* 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;
}
}
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;
}
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);
}
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);
}
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;
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;
}
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;
}
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);
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
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;
}
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;
}
error:
ret = -1;
end:
- bt_object_put_ref(field_class);
+ bt_field_class_put_ref(field_class);
bt_object_put_ref(field);
return ret;
}
error:
ret = -1;
end:
- bt_object_put_ref(field_class);
+ bt_field_class_put_ref(field_class);
bt_object_put_ref(field);
return ret;
}
error:
ret = -1;
end:
- bt_object_put_ref(field_class);
+ bt_field_class_put_ref(field_class);
bt_object_put_ref(field);
return ret;
}
error:
ret = -1;
end:
- bt_object_put_ref(field_class);
+ bt_field_class_put_ref(field_class);
bt_object_put_ref(field);
return ret;
}
error:
ret = -1;
end:
- bt_object_put_ref(field_class);
+ bt_field_class_put_ref(field_class);
bt_object_put_ref(field);
return ret;
}
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);
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;
}
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,
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) {
debug_info);
end:
- bt_object_put_ref(field);
+ bt_value_put_ref(field);
return debug_info;
}
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;
}
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);
}
error:
- bt_object_put_ref(writer_stream);
- bt_object_put_ref(stream);
+ bt_stream_put_ref(writer_stream);
+ bt_stream_put_ref(stream);
}
static
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. */
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;
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+ BT_PACKET_PUT_REF_AND_RESET(writer_packet);
end:
return writer_packet;
}
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,
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;
}
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);
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;
}
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;
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);
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;
}
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) {
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;
}
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;
}
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;
}
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,
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;
}
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;
}
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;
}
* 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) {
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(writer_stream);
+ BT_STREAM_PUT_REF_AND_RESET(writer_stream);
end:
return writer_stream;
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")) {
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;
}
}
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);
}
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;
}
/* 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;
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;
}
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;
}
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,
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) {
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;
}
}
end_put_class:
- bt_object_put_ref(event_class);
+ bt_event_class_put_ref(event_class);
end:
return;
}
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);
}
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);
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:
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:
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:
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;
}
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);
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);
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;
}
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;
}
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;
}
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;
}
ret = -1;
end:
- bt_object_put_ref(fc);
+ bt_field_class_put_ref(fc);
return ret;
}
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);
}
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(notif);
+ BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
end:
return notif;
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(notif);
+ BT_NOTIFICATION_PUT_REF_AND_RESET(notif);
end:
return notif;
}
}
- 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);
}
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);
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;
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;
}
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;
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);
}
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);
}
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;
counter->count.other++;
}
- bt_object_put_ref(notif);
+ bt_notification_put_ref(notif);
}
ret = BT_SELF_COMPONENT_STATUS_OK;
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);
}
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;
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;
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);
}
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.");
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(params);
+ BT_VALUE_PUT_REF_AND_RESET(params);
end:
return params;
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;
}
* 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:
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()
}
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,
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(writer_packet);
+ BT_PACKET_PUT_REF_AND_RESET(writer_packet);
end:
return writer_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);
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);
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;
}
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) {
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;
}
{
const struct bt_packet *writer_packet = value;
- bt_object_put_ref(writer_packet);
+ bt_packet_put_ref(writer_packet);
return TRUE;
}
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;
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;
}
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;
}
}
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);
default:
break;
}
- BT_OBJECT_PUT_REF_AND_RESET(*notification);
+ BT_NOTIFICATION_PUT_REF_AND_RESET(*notification);
*notification = new_notification;
if (finished) {
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,
}
}
- 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,
}
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) {
#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>
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;
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;
}
};
struct sink_user_data {
- void *notif_iter;
+ struct bt_self_component_port_input_notification_iterator *notif_iter;
};
/*
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
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
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:
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();
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);
}
}
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 */
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);
}
}
"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
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"
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");
}
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;
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
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);
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
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);
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
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");
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
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");
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");
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")
}
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");
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");
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")
}
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
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
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
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
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
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
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
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)
#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>
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,
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");
* 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);
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,
"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);
"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,
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
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");
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,
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,
"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"),
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");
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 ");
"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);
"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");
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");
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),
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,
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
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");
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");
"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,
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");
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
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);
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;
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
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
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) {
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);
goto end;
}
- bt_object_put_ref(integer);
+ bt_ctf_object_put_ref(integer);
integer = NULL;
}
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
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
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);
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
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)
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();
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");
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);
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,
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 */
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
* 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 =
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,
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);
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);
}
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
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
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
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
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
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
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)
"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");
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)
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)
"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);
}
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;
}
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;
}
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;
}
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();
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)
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)
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)
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)
/* 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");
/* 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");
/* 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.
/* 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.
/* 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,
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,
/* 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,
/* 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");
"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)