2 * SPDX-License-Identifier: MIT
4 * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com>
7 struct bt_value_map_get_keys_data
{
11 static bt_value_map_foreach_entry_const_func_status
bt_value_map_get_keys_cb(
12 const char *key
, const struct bt_value
*object
, void *data
)
15 struct bt_value_map_get_keys_data
*priv_data
= data
;
17 status
= bt_value_array_append_string_element(priv_data
->keys
, key
);
18 BT_ASSERT(status
== __BT_FUNC_STATUS_OK
||
19 status
== __BT_FUNC_STATUS_MEMORY_ERROR
);
23 static struct bt_value
*bt_value_map_get_keys(const struct bt_value
*map_obj
)
25 bt_value_map_foreach_entry_const_status status
;
26 struct bt_value_map_get_keys_data data
;
28 data
.keys
= bt_value_array_create();
33 status
= bt_value_map_foreach_entry_const(map_obj
, bt_value_map_get_keys_cb
,
35 if (status
!= __BT_FUNC_STATUS_OK
) {
43 BT_VALUE_PUT_REF_AND_RESET(data
.keys
);