- 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 || !key || !element_obj) {
- BT_LOGW("Invalid parameter: map value, key, or element value is NULL: "
- "map-value-addr=%p, key-addr=%p, element-value-addr=%p",
- map_obj, key, element_obj);
- ret = BT_VALUE_STATUS_INVAL;
- goto end;
- }
-
- if (!bt_value_is_map(map_obj)) {
- BT_LOGW("Invalid parameter: value is not a map value: addr=%p, "
- "type=%d", map_obj, map_obj->type);
- ret = BT_VALUE_STATUS_INVAL;
- goto end;
- }
-
- if (map_obj->is_frozen) {
- BT_LOGW("Invalid parameter: value is frozen: addr=%p",
- map_obj);
- 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);
+ 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);