lib: make empty array/map appending/inserting functions return new object
This makes the bt_value_array_append_empty_array_element(),
bt_value_array_append_empty_map_element(),
bt_value_map_insert_empty_array_entry(), and
bt_value_map_insert_empty_map_entry() accept a new optional output
parameter to return the created empty value object.
The goal of appending/inserting an empty array/map value object is
typically to fill it afterwards, so it makes this less painful, for
example:
bt_value *inner_arr_obj;
status = bt_value_array_append_empty_array_element(outer_array_obj,
&inner_arr_obj);
assert(status == 0);
status = bt_value_array_append_bool_element(inner_arr_obj, true);
assert(status == 0);
status = bt_value_array_append_string_element(inner_arr_obj, "id");
assert(status == 0);
You can pass `NULL` as this new parameter.
The returned reference is borrowed.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2cd3359f357a3eb1da52c0e1426ef7804a4b13aa
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1948
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
This page took 0.026111 seconds and 4 git commands to generate.