X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fnative_bt_value.i;fp=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fnative_bt_value.i;h=f31a6d44325b399e604ba4331c5860d40780af71;hb=4212232cdba456554343e71b2449066e597d0f5b;hp=e9eea0435b613873088c35e306f27fa1e65bd955;hpb=595cc8e03aa046738fc6b5124f53f76f21e5688c;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/native_bt_value.i b/src/bindings/python/bt2/bt2/native_bt_value.i index e9eea043..f31a6d44 100644 --- a/src/bindings/python/bt2/bt2/native_bt_value.i +++ b/src/bindings/python/bt2/bt2/native_bt_value.i @@ -26,49 +26,7 @@ %include %{ -struct bt_value_map_get_keys_data { - struct bt_value *keys; -}; - -static int bt_value_map_get_keys_cb(const char *key, const struct bt_value *object, void *data) -{ - bt_value_array_append_element_status status; - struct bt_value_map_get_keys_data *priv_data = data; - - status = bt_value_array_append_string_element(priv_data->keys, key); - if (status != __BT_FUNC_STATUS_OK) { - return BT_FALSE; - } - - return BT_TRUE; -} - -static struct bt_value *bt_value_map_get_keys(const struct bt_value *map_obj) -{ - bt_value_map_foreach_entry_const_status status; - struct bt_value_map_get_keys_data data; - - data.keys = bt_value_array_create(); - if (!data.keys) { - return NULL; - } - - status = bt_value_map_foreach_entry_const(map_obj, bt_value_map_get_keys_cb, - &data); - if (status != __BT_FUNC_STATUS_OK) { - goto error; - } - - goto end; - -error: - if (data.keys) { - BT_VALUE_PUT_REF_AND_RESET(data.keys); - } - -end: - return data.keys; -} +#include "native_bt_value.i.h" %} struct bt_value *bt_value_map_get_keys(const struct bt_value *map_obj);