summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend_hash.c29
-rw-r--r--Zend/zend_hash.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index d9a7272426..48f2712d0a 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -938,6 +938,35 @@ ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
}
+ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h)
+{
+ uint nIndex;
+ Bucket *p;
+
+ if (nKeyLength==0) {
+ return zend_hash_index_exists(ht, h);
+ }
+
+ IS_CONSISTENT(ht);
+
+ HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht, idx));
+
+ nIndex = h & ht->nTableMask;
+
+ p = ht->arBuckets[nIndex];
+ while (p != NULL) {
+ if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
+ if (!memcmp(p->arKey, arKey, nKeyLength)) {
+ return 1;
+ }
+ }
+ p = p->pNext;
+ }
+ return 0;
+
+}
+
+
ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData)
{
uint nIndex;
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index dc7961e4a7..29f5d21c09 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -159,6 +159,7 @@ ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData);
/* Misc */
ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength);
+ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h);
ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h);
ZEND_API ulong zend_hash_next_free_element(HashTable *ht);