MCPcopy Index your code
hub / github.com/MapServer/MapServer / msRemoveHashTable

Function msRemoveHashTable

maphash.c:170–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170int msRemoveHashTable(hashTableObj *table, const char *key)
171{
172 struct hashObj *tp;
173 struct hashObj *prev_tp=NULL;
174 int status = MS_FAILURE;
175
176 if (!table || !key) {
177 msSetError(MS_HASHERR, "No hash table", "msRemoveHashTable");
178 return MS_FAILURE;
179 }
180
181 tp=table->items[hash(key)];
182 if (!tp) {
183 msSetError(MS_HASHERR, "No such hash entry", "msRemoveHashTable");
184 return MS_FAILURE;
185 }
186
187 prev_tp = NULL;
188 while (tp != NULL) {
189 if (strcasecmp(key, tp->key) == 0) {
190 status = MS_SUCCESS;
191 if (prev_tp) {
192 prev_tp->next = tp->next;
193 free(tp);
194 break;
195 }
196 else {
197 table->items[hash(key)] = tp->next;
198 free(tp);
199 break;
200 }
201 }
202 prev_tp = tp;
203 tp = tp->next;
204 }
205
206 if (status == MS_SUCCESS)
207 table->numitems--;
208
209 return status;
210}
211
212const char *msFirstKeyFromHashTable( hashTableObj *table )
213{

Callers 6

msTileResetMetatileLevelFunction · 0.85
msTileSetExtentFunction · 0.85
msSetConfigOptionFunction · 0.85
mapObj_removeMetaDataFunction · 0.85
layerObj_removeMetaDataFunction · 0.85
hashTableObj_removeFunction · 0.85

Calls 3

msSetErrorFunction · 0.85
hashFunction · 0.85
strcasecmpFunction · 0.85

Tested by

no test coverage detected