summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_hash.c')
-rw-r--r--Zend/zend_hash.c45
1 files changed, 9 insertions, 36 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 96c3f3d7b5..ae7d8402f4 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -96,7 +96,7 @@ static void _zend_is_inconsistent(const HashTable *ht, const char *file, int lin
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)
{
@@ -128,10 +128,6 @@ 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; \
}
@@ -245,15 +241,9 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe
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);
}
@@ -322,15 +312,9 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui
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);
}
@@ -410,9 +394,6 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
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;
@@ -437,7 +418,7 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
}
-static int zend_hash_do_resize(HashTable *ht)
+static void zend_hash_do_resize(HashTable *ht)
{
Bucket **t;
#ifdef ZEND_SIGNALS
@@ -447,19 +428,14 @@ static int zend_hash_do_resize(HashTable *ht)
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)
@@ -1449,9 +1425,6 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
return SUCCESS;
}
arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *), ht->persistent);
- if (!arTmp) {
- return FAILURE;
- }
p = ht->pListHead;
i = 0;
while (p) {