This is the first step to make the whole API const-correct.
bt_object_get_ref() and bt_object_put_ref() are not considered to
logically modify the object: they change the reference count, but the
object's readable properties remain unchanged. Considering this, it is
simpler to have a single version of each of them accepting a const
object so as to be able to get and put const objects (eventually).
bt_object_put_ref() can have the effect of destroying/freeing the
object, just like Linux's kfree() does while accepting a `const void *`
parameter.
It is safe to cast away `const` in this library because the user only
passes opaque handles to functions (`struct bt_X *` types) pointing to
non-const objects defined by the library itself in writable memory
(usually through g_new0()).
In C++11, the equivalent of having a `const struct bt_X *` object on
which you can increment and decrement the reference count would be
having an `std::shared_ptr<const bt_X>` object: the wrapper is mutable,
but the contained object is const.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
struct bt_config_component *comp = g_ptr_array_index(comps, i);
if (strcmp(name, comp->instance_name->str) == 0) {
- found_comp = bt_object_get_ref(comp);
+ found_comp = comp;
+ bt_object_get_ref(found_comp);
goto end;
}
}
cfg->command_needs_plugins = needs_plugins;
if (initial_plugin_paths) {
- cfg->plugin_paths = bt_object_get_ref(initial_plugin_paths);
+ cfg->plugin_paths = initial_plugin_paths;
+ bt_object_get_ref(cfg->plugin_paths);
} else {
cfg->plugin_paths = bt_private_value_array_create();
if (!cfg->plugin_paths) {
struct implicit_component_args implicit_debug_info_args = { 0 };
struct implicit_component_args implicit_muxer_args = { 0 };
struct implicit_component_args implicit_trimmer_args = { 0 };
- struct bt_private_value *plugin_paths =
- bt_object_get_ref(initial_plugin_paths);
+ struct bt_private_value *plugin_paths;
char error_buf[256] = { 0 };
size_t i;
struct bt_common_lttng_live_url_parts lttng_live_url_parts = { 0 };
char *output = NULL;
+ plugin_paths = initial_plugin_paths;
+ bt_object_get_ref(plugin_paths);
+
*retcode = 0;
if (argc <= 1) {
struct bt_config_component *bt_config_get_component(GPtrArray *array,
size_t index)
{
- return bt_object_get_ref(g_ptr_array_index(array, index));
+ struct bt_config_component *comp = g_ptr_array_index(array, index);
+
+ bt_object_get_ref(comp);
+ return comp;
}
int bt_config_append_plugin_paths(struct bt_private_value *plugin_paths,
static
void init_static_data(void)
{
- loaded_plugins = g_ptr_array_new_with_free_func(bt_object_put_ref);
+ loaded_plugins = g_ptr_array_new_with_free_func(
+ (GDestroyNotify) bt_object_put_ref);
}
static
}
}
- return bt_object_get_ref(plugin);
+ bt_object_get_ref(plugin);
+ return plugin;
}
typedef void *(*plugin_borrow_comp_cls_func_t)(struct bt_plugin *,
goto end;
}
- comp_class = bt_object_get_ref(
- plugin_borrow_comp_cls_func(plugin, comp_class_name));
+ comp_class = plugin_borrow_comp_cls_func(plugin, comp_class_name);
+ bt_object_get_ref(comp_class);
BT_OBJECT_PUT_REF_AND_RESET(plugin);
end:
/* Add to global array. */
BT_LOGD("Adding plugin to loaded plugins: plugin-path=\"%s\"",
bt_plugin_get_name(plugin));
- g_ptr_array_add(loaded_plugins, bt_object_get_ref(plugin));
+ bt_object_get_ref(plugin);
+ g_ptr_array_add(loaded_plugins, plugin);
}
}
}
ctx->cfg = cfg;
ctx->connect_ports = false;
ctx->src_components = g_hash_table_new_full(g_direct_hash,
- g_direct_equal, NULL, bt_object_put_ref);
+ g_direct_equal, NULL, (GDestroyNotify) bt_object_put_ref);
if (!ctx->src_components) {
goto error;
}
ctx->flt_components = g_hash_table_new_full(g_direct_hash,
- g_direct_equal, NULL, bt_object_put_ref);
+ g_direct_equal, NULL, (GDestroyNotify) bt_object_put_ref);
if (!ctx->flt_components) {
goto error;
}
ctx->sink_components = g_hash_table_new_full(g_direct_hash,
- g_direct_equal, NULL, bt_object_put_ref);
+ g_direct_equal, NULL, (GDestroyNotify) bt_object_put_ref);
if (!ctx->sink_components) {
goto error;
}
struct bt_object *);
static inline
-void bt_object_get_no_null_check(struct bt_object *obj);
+void bt_object_get_no_null_check(const void *obj);
static inline
-void bt_object_put_no_null_check(struct bt_object *obj);
+void bt_object_put_no_null_check(const void *obj);
/*
* Babeltrace object base.
};
static inline
-unsigned long long bt_object_get_ref_count(struct bt_object *obj)
+unsigned long long bt_object_get_ref_count(const struct bt_object *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
+
BT_ASSERT(obj);
BT_ASSERT(obj->is_shared);
return obj->ref_count;
}
static inline
-struct bt_object *bt_object_borrow_parent(struct bt_object *obj)
+struct bt_object *bt_object_borrow_parent(const struct bt_object *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
+
BT_ASSERT(obj);
BT_ASSERT(obj->is_shared);
return obj->parent;
}
static inline
-struct bt_object *bt_object_get_parent(struct bt_object *obj)
+struct bt_object *bt_object_get_parent(const struct bt_object *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
struct bt_object *parent = bt_object_borrow_parent(obj);
if (parent) {
}
static inline
-void bt_object_inc_ref_count(struct bt_object *obj)
+void bt_object_inc_ref_count(const struct bt_object *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
+
BT_ASSERT(obj);
BT_ASSERT(obj->is_shared);
obj->ref_count++;
}
static inline
-void bt_object_get_no_null_check_no_parent_check(struct bt_object *obj)
+void bt_object_get_no_null_check_no_parent_check(const struct bt_object *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
+
BT_ASSERT(obj);
BT_ASSERT(obj->is_shared);
}
static inline
-void bt_object_get_no_null_check(struct bt_object *obj)
+void bt_object_get_no_null_check(const void *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
+
BT_ASSERT(obj);
BT_ASSERT(obj->is_shared);
}
static inline
-void bt_object_put_no_null_check(struct bt_object *obj)
+void bt_object_put_no_null_check(const void *c_obj)
{
+ struct bt_object *obj = (void *) c_obj;
+
BT_ASSERT(obj);
BT_ASSERT(obj->is_shared);
BT_ASSERT(obj->ref_count > 0);
@sa bt_object_put_ref(): Decrements the reference count of a Babeltrace object.
*/
-void *bt_object_get_ref(void *obj);
+void bt_object_get_ref(const void *obj);
/**
@brief Decrements the reference count of the Babeltrace object
variable to another.
@sa bt_object_get_ref(): Increments the reference count of a Babeltrace object.
*/
-void bt_object_put_ref(void *obj);
+void bt_object_put_ref(const void *obj);
/**
@}
}
/* Add new component class */
- g_ptr_array_add(comp_classes, bt_object_get_ref(comp_class));
+ bt_object_get_ref(comp_class);
+ g_ptr_array_add(comp_classes, comp_class);
/* Special case for a shared object plugin */
if (plugin->type == BT_PLUGIN_TYPE_SO) {
{
BT_ASSERT(plugin_set);
BT_ASSERT(plugin);
- g_ptr_array_add(plugin_set->plugins, bt_object_get_ref(plugin));
+ bt_object_get_ref(plugin);
+ g_ptr_array_add(plugin_set->plugins, plugin);
BT_LIB_LOGV("Added plugin to plugin set: "
"plugin-set-addr=%p, %![plugin-]+l",
plugin_set, plugin);
colander_comp_cls, colander_input_port_connected);
end:
- return bt_object_get_ref(
- bt_private_component_class_sink_as_component_class_sink(
- colander_comp_cls));
+ bt_object_get_ref(colander_comp_cls);
+ return (void *) colander_comp_cls;
}
__attribute__((destructor)) static
/*
* Notify the graph's creator that a new port was added.
*/
- graph = bt_object_get_ref(bt_component_borrow_graph(component));
+ bt_object_get_ref(bt_component_borrow_graph(component));
+ graph = bt_component_borrow_graph(component);
if (graph) {
bt_graph_notify_port_added(graph, new_port);
BT_OBJECT_PUT_REF_AND_RESET(graph);
bt_object_init_shared_with_parent(&component->base,
destroy_component);
- component->class = bt_object_get_ref(component_class);
+ component->class = component_class;
+ bt_object_get_no_null_check(component->class);
component->destroy = component_destroy_funcs[type];
component->name = g_string_new(name);
if (!component->name) {
/*
* We keep a reference to the stream until we know it's ended.
*/
- stream_state->stream = bt_object_get_ref(stream);
+ stream_state->stream = stream;
+ bt_object_get_no_null_check(stream_state->stream);
BT_LIB_LOGV("Created stream state: %![stream-]+s, "
"stream-state-addr=%p",
stream, stream_state);
goto end;
}
stream_state->expected_notif_seq_num++;
- stream_state->cur_packet = bt_object_get_ref(packet);
+ stream_state->cur_packet = packet;
+ bt_object_get_no_null_check(stream_state->cur_packet);
goto end;
case BT_NOTIFICATION_TYPE_PACKET_END:
if (!stream_state->cur_packet) {
goto error;
}
- iterator->graph = bt_object_get_ref(graph);
+ iterator->graph = graph;
+ bt_object_get_no_null_check(iterator->graph);
colander_data.notifs = (void *) iterator->base.notifs->pdata;
colander_data.count_addr = &iterator->count;
bt_notification_init(¬ification->parent,
BT_NOTIFICATION_TYPE_STREAM_END,
bt_notification_stream_end_destroy, NULL);
- notification->stream = bt_object_get_ref(stream);
+ notification->stream = stream;
+ bt_object_get_no_null_check(notification->stream);
BT_LIB_LOGD("Created stream end notification object: "
"%![notif-]+n, %![stream-]+s, %![sc-]+S", notification,
stream, stream_class);
bt_notification_init(¬ification->parent,
BT_NOTIFICATION_TYPE_STREAM_BEGIN,
bt_notification_stream_begin_destroy, NULL);
- notification->stream = bt_object_get_ref(stream);
+ notification->stream = stream;
+ bt_object_get_no_null_check(notification->stream);
BT_LIB_LOGD("Created stream beginning notification object: "
"%![notif-]+n, %![stream-]+s, %![sc-]+S", notification,
stream, stream_class);
#include <babeltrace/assert-pre-internal.h>
#include <babeltrace/object-internal.h>
-void *bt_object_get_ref(void *ptr)
+void bt_object_get_ref(const void *ptr)
{
- struct bt_object *obj = ptr;
+ struct bt_object *obj = (void *) ptr;
if (unlikely(!obj)) {
goto end;
bt_object_get_no_null_check(obj);
end:
- return ptr;
+ return;
}
-void bt_object_put_ref(void *ptr)
+void bt_object_put_ref(const void *ptr)
{
- struct bt_object *obj = ptr;
+ struct bt_object *obj = (void *) ptr;
if (unlikely(!obj)) {
return;
}
spec = plugin->spec_data;
- spec->shared_lib_handle = bt_object_get_ref(shared_lib_handle);
+ spec->shared_lib_handle = shared_lib_handle;
+ bt_object_get_no_null_check(spec->shared_lib_handle);
goto end;
error:
BT_ASSERT(plugin->type == BT_PLUGIN_TYPE_SO);
bt_list_add(&comp_class->node, &component_class_list);
- comp_class->so_handle = bt_object_get_ref(spec->shared_lib_handle);
+ comp_class->so_handle = spec->shared_lib_handle;
+ bt_object_get_no_null_check(comp_class->so_handle);
/* Add our custom destroy listener */
bt_component_class_add_destroy_listener(comp_class,
plugin_name) == 0) {
BT_LOGD("Plugin found in directory: name=\"%s\", path=\"%s\"",
plugin_name, dir->str);
- plugin = bt_object_get_ref(candidate_plugin);
+ plugin = candidate_plugin;
+ bt_object_get_no_null_check(plugin);
goto end;
}
}
plugin_name) == 0) {
BT_LOGD("Plugin found in built-in plugins: "
"name=\"%s\"", plugin_name);
- plugin = bt_object_get_ref(candidate_plugin);
+ plugin = candidate_plugin;
+ bt_object_get_no_null_check(plugin);
goto end;
}
}
}
bt_object_init_unique(&ret->base);
- ret->clock_class = bt_object_get_ref(clock_class);
+ ret->clock_class = clock_class;
+ bt_object_get_no_null_check(clock_class);
bt_clock_class_freeze(clock_class);
BT_LIB_LOGD("Created clock value object: %!+k", ret);
}
if (likely(!clock_value->clock_class)) {
- clock_value->clock_class = bt_object_get_ref(clock_class);
+ clock_value->clock_class = clock_class;
+ bt_object_get_no_null_check(clock_class);
}
goto end;
bt_field_class_make_part_of_trace(field_class);
bt_object_put_ref(event_class->specific_context_fc);
- event_class->specific_context_fc = bt_object_get_ref(field_class);
+ event_class->specific_context_fc = field_class;
+ bt_object_get_no_null_check(event_class->specific_context_fc);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set event class's specific context field classe: %!+E",
event_class);
bt_field_class_make_part_of_trace(field_class);
bt_object_put_ref(event_class->payload_fc);
- event_class->payload_fc = bt_object_get_ref(field_class);
+ event_class->payload_fc = field_class;
+ bt_object_get_no_null_check(event_class->payload_fc);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set event class's payload field classe: %!+E", event_class);
named_fc = &g_array_index(container_fc->named_fcs,
struct bt_named_field_class, container_fc->named_fcs->len - 1);
named_fc->name = name_str;
- named_fc->fc = bt_object_get_ref(fc);
+ named_fc->fc = fc;
+ bt_object_get_no_null_check(fc);
g_hash_table_insert(container_fc->name_to_index, named_fc->name->str,
GUINT_TO_POINTER(container_fc->named_fcs->len - 1));
bt_field_class_freeze(fc);
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
BT_ASSERT_PRE_FC_IS_ENUM(selector_fc, "Selector field class");
BT_ASSERT_PRE_FC_HOT(fc, "Variant field class");
- var_fc->selector_fc = bt_object_get_ref(selector_fc);
+ var_fc->selector_fc = (void *) selector_fc;
+ bt_object_get_no_null_check(selector_fc);
bt_field_class_freeze((void *) selector_fc);
return 0;
}
{
BT_ASSERT(element_fc);
init_field_class((void *) fc, type, release_func);
- fc->element_fc = bt_object_get_ref(element_fc);
+ fc->element_fc = element_fc;
+ bt_object_get_no_null_check(element_fc);
bt_field_class_freeze(element_fc);
}
"Field class");
BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(length_fc, "Length field class");
BT_ASSERT_PRE_FC_HOT(fc, "Dynamic array field class");
- array_fc->length_fc = bt_object_get_ref(length_fc);
+ array_fc->length_fc = (void *) length_fc;
+ bt_object_get_no_null_check(length_fc);
bt_field_class_freeze(length_fc);
return 0;
}
BT_ASSERT(fc);
bt_object_init_unique(&field->base);
field->methods = methods;
- field->class = bt_object_get_ref(fc);
+ field->class = fc;
+ bt_object_get_no_null_check(fc);
}
static
bt_object_init_shared(&packet->base,
(bt_object_release_func) bt_packet_recycle);
- packet->stream = bt_object_get_ref(stream);
+ packet->stream = stream;
+ bt_object_get_no_null_check(stream);
trace = bt_stream_class_borrow_trace_inline(stream->class);
BT_ASSERT(trace);
bt_field_class_make_part_of_trace(field_class);
bt_object_put_ref(stream_class->packet_context_fc);
- stream_class->packet_context_fc = bt_object_get_ref(field_class);
+ stream_class->packet_context_fc = field_class;
+ bt_object_get_no_null_check(stream_class->packet_context_fc);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set stream class's packet context field classe: %!+S",
stream_class);
bt_field_class_make_part_of_trace(field_class);
bt_object_put_ref(stream_class->event_header_fc);
- stream_class->event_header_fc = bt_object_get_ref(field_class);
+ stream_class->event_header_fc = field_class;
+ bt_object_get_no_null_check(stream_class->event_header_fc);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set stream class's event header field classe: %!+S",
stream_class);
bt_field_class_make_part_of_trace(field_class);
bt_object_put_ref(stream_class->event_common_context_fc);
- stream_class->event_common_context_fc = bt_object_get_ref(field_class);
+ stream_class->event_common_context_fc = field_class;
+ bt_object_get_no_null_check(stream_class->event_common_context_fc);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set stream class's event common context field classe: %!+S",
stream_class);
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
bt_object_put_ref(stream_class->default_clock_class);
- stream_class->default_clock_class = bt_object_get_ref(clock_class);
+ stream_class->default_clock_class = clock_class;
+ bt_object_get_no_null_check(stream_class->default_clock_class);
bt_clock_class_freeze(clock_class);
BT_LIB_LOGV("Set stream class's default clock class: %!+S",
stream_class);
bt_field_class_make_part_of_trace(field_class);
bt_object_put_ref(trace->packet_header_fc);
- trace->packet_header_fc = bt_object_get_ref(field_class);
+ trace->packet_header_fc = field_class;
+ bt_object_get_no_null_check(trace->packet_header_fc);
bt_field_class_freeze(field_class);
BT_LIB_LOGV("Set trace's packet header field classe: %!+t", trace);
}
if (!stream_class->default_clock_class) {
- stream_class->default_clock_class = bt_object_get_ref(clock_class);
+ stream_class->default_clock_class = clock_class;
+ bt_object_get_ref(stream_class->default_clock_class);
}
end:
dst_fc->is_signed = src_fc->is_signed;
dst_fc->disp_base = src_fc->disp_base;
dst_fc->encoding = src_fc->encoding;
- dst_fc->mapped_clock_class = bt_object_get_ref(src_fc->mapped_clock_class);
+ dst_fc->mapped_clock_class = src_fc->mapped_clock_class;
+ bt_object_get_ref(dst_fc->mapped_clock_class);
dst_fc->storing_index = src_fc->storing_index;
}
(*integer_decl)->is_signed = (signedness > 0);
(*integer_decl)->disp_base = base;
(*integer_decl)->encoding = encoding;
- (*integer_decl)->mapped_clock_class = bt_object_get_ref(mapped_clock_class);
+ (*integer_decl)->mapped_clock_class = mapped_clock_class;
+ bt_object_get_ref((*integer_decl)->mapped_clock_class);
return 0;
error:
"default");
BT_ASSERT(ret == 0);
g_ptr_array_add(ctx->ctf_tc->clock_classes,
- bt_object_get_ref(clock_class_to_map_to));
+ clock_class_to_map_to);
+ bt_object_get_ref(clock_class_to_map_to);
break;
case 1:
/*
* Only one clock class exists in the trace at this point: use
* this one.
*/
- clock_class_to_map_to =
- bt_object_get_ref(ctx->ctf_tc->clock_classes->pdata[0]);
+ clock_class_to_map_to = ctx->ctf_tc->clock_classes->pdata[0];
+ bt_object_get_ref(clock_class_to_map_to);
break;
default:
/*
}
BT_ASSERT(clock_class_to_map_to);
- int_fc->mapped_clock_class = bt_object_get_ref(clock_class_to_map_to);
+ int_fc->mapped_clock_class = clock_class_to_map_to;
+ bt_object_get_ref(int_fc->mapped_clock_class);
end:
bt_object_put_ref(clock_class_to_map_to);
bt_private_clock_class_as_clock_class(clock)));
bt_private_clock_class_set_offset(clock, offset_seconds, offset_cycles);
apply_clock_class_offset(ctx, clock);
- g_ptr_array_add(ctx->ctf_tc->clock_classes, bt_object_get_ref(clock));
+ g_ptr_array_add(ctx->ctf_tc->clock_classes, clock);
+ bt_object_get_ref(clock);
end:
BT_OBJECT_PUT_REF_AND_RESET(clock);
BT_ASSERT(ctx);
BT_ASSERT(ctx->trace);
- return bt_object_get_ref(ctx->trace);
+ bt_object_get_ref(ctx->trace);
+ return ctx->trace;
}
BT_HIDDEN
"stream-class-addr=%p, stream-class-id=%" PRId64,
notit, notit->meta.sc,
notit->meta.sc->id);
- stream = bt_object_get_ref(notit->medium.medops.borrow_stream(
+ stream = notit->medium.medops.borrow_stream(
notit->meta.sc->ir_sc, notit->cur_data_stream_id,
- notit->medium.data));
+ notit->medium.data);
+ bt_object_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 error;
}
- ds_file->stream = bt_object_get_ref(stream);
+ ds_file->stream = stream;
+ bt_object_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");
ds_file_group->stream_id = stream_instance_id;
BT_ASSERT(stream_class);
- ds_file_group->stream_class = bt_object_get_ref(stream_class);
+ ds_file_group->stream_class = stream_class;
+ bt_object_get_ref(ds_file_group->stream_class);
ds_file_group->ctf_fs_trace = ctf_fs_trace;
goto end;
goto end;
}
- muxer_upstream_notif_iter->notif_iter = bt_object_get_ref(self_notif_iter);
+ muxer_upstream_notif_iter->notif_iter = self_notif_iter;
+ bt_object_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.");
"TC1 reference count is 1");
/* User A acquires a reference to SC2 from TC1. */
- user_a.sc = bt_object_get_ref(
- bt_private_trace_borrow_stream_class_by_index(
- user_a.tc, 1));
+ user_a.sc = bt_private_trace_borrow_stream_class_by_index(
+ user_a.tc, 1);
+ bt_object_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");
"SC2 reference count is 1");
/* User A acquires a reference to EC3 from SC2. */
- user_a.ec = bt_object_get_ref(
- bt_private_stream_class_borrow_event_class_by_index(
- user_a.sc, 0));
+ user_a.ec = bt_private_stream_class_borrow_event_class_by_index(
+ user_a.sc, 0);
+ bt_object_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 B acquires a reference to SC1. */
diag("User B acquires a reference to SC1");
- user_b.sc = bt_object_get_ref(weak_sc1);
+ user_b.sc = weak_sc1;
+ bt_object_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,
/* User C acquires a reference to EC1. */
diag("User C acquires a reference to EC1");
- user_c.ec = bt_object_get_ref(
- bt_private_stream_class_borrow_event_class_by_index(
- user_b.sc, 0));
+ user_c.ec = bt_private_stream_class_borrow_event_class_by_index(
+ user_b.sc, 0);
+ bt_object_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,