ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag)
{
uint nIndex;
- Bucket *p;
+ Bucket *p, *t = NULL; /* initialize just to shut gcc up with -Wall */
IS_CONSISTENT(ht);
if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->arBuckets[nIndex] == p) {
+ if (p == ht->arBuckets[nIndex]) {
ht->arBuckets[nIndex] = p->pNext;
+ } else {
+ t->pNext = p->pNext;
}
if (p->pListLast != NULL) {
p->pListLast->pListNext = p->pListNext;
ht->nNumOfElements--;
return SUCCESS;
}
+ t = p;
p = p->pNext;
}
return FAILURE;