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)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 13 Jan 2020 15:26:55 +0000 (10:26 -0500)
commita91462c9af36b77653794c73ce6fbed0c8ba0b2d
tree4737badd08e07743239ad8ce8f1db069ec60dfdc
parent8e1fe2a41cf0739d379a0836095a227413e73e76
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.02587 seconds and 4 git commands to generate.