MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / Map_Remove

Function Map_Remove

src/datatypes/map.c:116–135  ·  view source on GitHub ↗

removes key from map

Source from the content-addressed store, hash-verified

114
115// removes key from map
116void Map_Remove
117(
118 SIValue map,
119 SIValue key
120) {
121 ASSERT(SI_TYPE(map) & T_MAP);
122 ASSERT(SI_TYPE(key) & T_STRING);
123
124 Map m = map.map;
125
126 // search for key in map
127 int idx = Map_KeyIdx(map, key);
128
129 // key missing from map
130 if(idx == -1) return;
131
132 // override removed key with last pair
133 Pair_Free(m[idx]);
134 array_del_fast(m, idx);
135}
136
137// retrieves value under key, map[key]
138// sets 'value' to NULL if key isn't in map

Callers 4

Map_AddFunction · 0.85
test_empty_mapFunction · 0.85
test_map_addFunction · 0.85
test_map_removeFunction · 0.85

Calls 2

Map_KeyIdxFunction · 0.85
Pair_FreeFunction · 0.85

Tested by 3

test_empty_mapFunction · 0.68
test_map_addFunction · 0.68
test_map_removeFunction · 0.68