mirror of
https://github.com/php/php-src.git
synced 2024-12-13 20:05:26 +08:00
Revert "Add helper function for updating bucket contents"
Reverting this for now, because it would require further changes thanks to the zend signals tsrms-but-only-sometimes awesomeness.
This commit is contained in:
parent
4e7e301dda
commit
f331ed1414
@ -141,21 +141,6 @@ ZEND_API ulong zend_hash_func(const char *arKey, uint nKeyLength)
|
||||
|
||||
static const Bucket *uninitialized_bucket = NULL;
|
||||
|
||||
static inline void zend_hash_bucket_update(
|
||||
const HashTable *ht, Bucket *p, void *pData, uint nDataSize, void **pDest ZEND_FILE_LINE_DC
|
||||
) {
|
||||
ZEND_ASSERT(p->pData != pData);
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
UPDATE_DATA(ht, p, pData, nDataSize);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
if (pDest) {
|
||||
*pDest = p->pData;
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void i_zend_hash_bucket_delete(HashTable *ht, Bucket *p)
|
||||
{
|
||||
#ifdef ZEND_SIGNALS
|
||||
@ -269,14 +254,21 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, const char *arKey, uint nKe
|
||||
p = ht->arBuckets[nIndex];
|
||||
while (p != NULL) {
|
||||
if (p->arKey == arKey ||
|
||||
((p->h == h) && (p->nKeyLength == nKeyLength)
|
||||
&& !memcmp(p->arKey, arKey, nKeyLength))
|
||||
) {
|
||||
if (flag & HASH_ADD) {
|
||||
return FAILURE;
|
||||
}
|
||||
zend_hash_bucket_update(ht, p, pData, nDataSize, pDest ZEND_FILE_LINE_RELAY_CC);
|
||||
return SUCCESS;
|
||||
((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
|
||||
if (flag & HASH_ADD) {
|
||||
return FAILURE;
|
||||
}
|
||||
ZEND_ASSERT(p->pData != pData);
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
UPDATE_DATA(ht, p, pData, nDataSize);
|
||||
if (pDest) {
|
||||
*pDest = p->pData;
|
||||
}
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return SUCCESS;
|
||||
}
|
||||
p = p->pNext;
|
||||
}
|
||||
@ -325,14 +317,21 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, const char *arKey, ui
|
||||
p = ht->arBuckets[nIndex];
|
||||
while (p != NULL) {
|
||||
if (p->arKey == arKey ||
|
||||
((p->h == h) && (p->nKeyLength == nKeyLength)
|
||||
&& !memcmp(p->arKey, arKey, nKeyLength))
|
||||
) {
|
||||
if (flag & HASH_ADD) {
|
||||
return FAILURE;
|
||||
}
|
||||
zend_hash_bucket_update(ht, p, pData, nDataSize, pDest ZEND_FILE_LINE_RELAY_CC);
|
||||
return SUCCESS;
|
||||
((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
|
||||
if (flag & HASH_ADD) {
|
||||
return FAILURE;
|
||||
}
|
||||
ZEND_ASSERT(p->pData != pData);
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
UPDATE_DATA(ht, p, pData, nDataSize);
|
||||
if (pDest) {
|
||||
*pDest = p->pData;
|
||||
}
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return SUCCESS;
|
||||
}
|
||||
p = p->pNext;
|
||||
}
|
||||
@ -397,7 +396,16 @@ ZEND_API int _zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
|
||||
if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) {
|
||||
return FAILURE;
|
||||
}
|
||||
zend_hash_bucket_update(ht, p, pData, nDataSize, pDest ZEND_FILE_LINE_RELAY_CC);
|
||||
ZEND_ASSERT(p->pData != pData);
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
if (ht->pDestructor) {
|
||||
ht->pDestructor(p->pData);
|
||||
}
|
||||
UPDATE_DATA(ht, p, pData, nDataSize);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
if (pDest) {
|
||||
*pDest = p->pData;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
p = p->pNext;
|
||||
|
Loading…
Reference in New Issue
Block a user