mie: attribute: map: implement REPLACE flag in put()

This commit is contained in:
2026-01-18 21:16:28 +00:00
parent 092c9969cf
commit 429ec770b5

View File

@@ -149,6 +149,7 @@ enum mie_status mie_attribute_map_put(
struct attribute_map_entry *entry = get_entry(&map->m_entries, name_hash);
struct attribute_map_item *item = NULL;
struct attribute_map_bucket *bucket = NULL;
enum mie_status status = MIE_SUCCESS;
if (!entry) {
item = create_item(name, name_hash, value);
@@ -162,6 +163,17 @@ enum mie_status mie_attribute_map_put(
if (entry->e_type == ATTRMAP_ENTRY_ITEM) {
item = (struct attribute_map_item *)entry;
if (!strcmp(item->i_name, name)) {
status = MIE_ERR_NAME_EXISTS;
if (flags & MIE_ATTRMAP_F_REPLACE) {
item->i_value = value;
status = MIE_SUCCESS;
}
return status;
}
bucket = convert_item_to_bucket(map, item);
} else {
bucket = (struct attribute_map_bucket *)entry;