- GQuark quark;
- enum bt_value_status ret = BT_VALUE_STATUS_OK;
- struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj);
-
- if (!map_obj || !bt_value_is_map(map_obj) || !key || !element_obj) {
- ret = BT_VALUE_STATUS_INVAL;
- goto end;
- }
-
- if (map_obj->is_frozen) {
- ret = BT_VALUE_STATUS_FROZEN;
- goto end;
- }
-
- quark = g_quark_from_string(key);
- g_hash_table_insert(typed_map_obj->ght,
- GUINT_TO_POINTER(quark), element_obj);
- bt_get(element_obj);
-
-end:
- return ret;
+ BT_ASSERT_PRE_NON_NULL(map_obj, "Map value object");
+ BT_ASSERT_PRE_NON_NULL(key, "Key");
+ BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object");
+ BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
+ BT_ASSERT_PRE_VALUE_HOT(map_obj, "Map value object");
+ g_hash_table_insert(BT_VALUE_TO_MAP(map_obj)->ght,
+ GUINT_TO_POINTER(g_quark_from_string(key)), element_obj);
+ bt_object_get_ref(element_obj);
+ BT_LOGV("Inserted value into map value: map-value-addr=%p, "
+ "key=\"%s\", element-value-addr=%p",
+ map_obj, key, element_obj);
+ return BT_VALUE_STATUS_OK;