zend_hash_do_resize(ht); \
}
-static int zend_hash_do_resize(HashTable *ht);
+static void zend_hash_do_resize(HashTable *ht);
ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength)
{
(p)->pData = &(p)->pDataPtr; \
} else { \
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent);\
- if (!(p)->pData) { \
- pefree_rel(p, (ht)->persistent); \
- return FAILURE; \
- } \
memcpy((p)->pData, pData, nDataSize); \
(p)->pDataPtr=NULL; \
}
if (IS_INTERNED(arKey)) {
p = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
- if (!p) {
- return FAILURE;
- }
p->arKey = arKey;
} else {
p = (Bucket *) pemalloc(sizeof(Bucket) + nKeyLength, ht->persistent);
- if (!p) {
- return FAILURE;
- }
p->arKey = (const char*)(p + 1);
memcpy((char*)p->arKey, arKey, nKeyLength);
}
if (IS_INTERNED(arKey)) {
p = (Bucket *) pemalloc(sizeof(Bucket), ht->persistent);
- if (!p) {
- return FAILURE;
- }
p->arKey = arKey;
} else {
p = (Bucket *) pemalloc(sizeof(Bucket) + nKeyLength, ht->persistent);
- if (!p) {
- return FAILURE;
- }
p->arKey = (const char*)(p + 1);
memcpy((char*)p->arKey, arKey, nKeyLength);
}
p = p->pNext;
}
p = (Bucket *) pemalloc_rel(sizeof(Bucket), ht->persistent);
- if (!p) {
- return FAILURE;
- }
p->arKey = NULL;
p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */
p->h = h;
}
-static int zend_hash_do_resize(HashTable *ht)
+static void zend_hash_do_resize(HashTable *ht)
{
Bucket **t;
#ifdef ZEND_SIGNALS
IS_CONSISTENT(ht);
if ((ht->nTableSize << 1) > 0) { /* Let's double the table size */
- t = (Bucket **) perealloc_recoverable(ht->arBuckets, (ht->nTableSize << 1) * sizeof(Bucket *), ht->persistent);
- if (t) {
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets = t;
- ht->nTableSize = (ht->nTableSize << 1);
- ht->nTableMask = ht->nTableSize - 1;
- zend_hash_rehash(ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- return FAILURE;
+ t = (Bucket **) perealloc(ht->arBuckets, (ht->nTableSize << 1) * sizeof(Bucket *), ht->persistent);
+ HANDLE_BLOCK_INTERRUPTIONS();
+ ht->arBuckets = t;
+ ht->nTableSize = (ht->nTableSize << 1);
+ ht->nTableMask = ht->nTableSize - 1;
+ zend_hash_rehash(ht);
+ HANDLE_UNBLOCK_INTERRUPTIONS();
}
- return SUCCESS;
}
ZEND_API int zend_hash_rehash(HashTable *ht)
return SUCCESS;
}
arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent);
- if (!arTmp) {
- return FAILURE;
- }
p = ht->pListHead;
i = 0;
while (p) {