lib: graph API: return borrowed references when adding to an object
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 12 Jan 2020 15:45:31 +0000 (10:45 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 20 Jan 2020 20:15:24 +0000 (15:15 -0500)
commit246d5223941beafb4deca726b6a5ea8b61928e54
tree2e70429bcf83bd607e1a2d735006eb1522f3d820
parent92c09281bbdf888b36746ef3af7d7a2a7f92ff68
lib: graph API: return borrowed references when adding to an object

Before this patch, the following functions return a new reference when
their last parameter is not `NULL`:

* bt_graph_add_filter_component()
* bt_graph_add_filter_component_with_initialize_method_data()
* bt_graph_add_simple_sink_component()
* bt_graph_add_sink_component()
* bt_graph_add_sink_component_with_initialize_method_data()
* bt_graph_add_source_component()
* bt_graph_add_source_component_with_initialize_method_data()
* bt_graph_connect_ports()
* bt_self_component_filter_add_input_port()
* bt_self_component_filter_add_output_port()
* bt_self_component_sink_add_input_port()
* bt_self_component_source_add_output_port()

I'm changing this so that they return a borrowed reference instead. This
is more in line with other non-creating functions which always return
borrowed references.

It's okay to borrow here because the object to which you add an object
becomes its owner anyway.

Most sites are updated by removing the *_put_ref() call as the reference
is now borrowed.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I71a5e18760504d8f8610162e3f6d7bd8d87474f9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2762
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/bindings/python/bt2/bt2/component.py
src/bindings/python/bt2/bt2/graph.py
src/cli/babeltrace2.c
src/lib/graph/component-filter.c
src/lib/graph/component-sink.c
src/lib/graph/component-source.c
src/lib/graph/graph.c
tests/lib/plugin.c
tests/lib/test_graph_topo.c
tests/lib/test_remove_destruction_listener_in_destruction_listener.c
tests/lib/test_simple_sink.c
This page took 0.025465 seconds and 4 git commands to generate.