1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 17:52:16 +01:00

Some extensions don't associate any data with hash entries,

except the key.  Prior to this change, a separate chunk of memory
was allocated in that case to store exactly zero bytes (plus
memory manager overhead).  We treat that case similar to the
pointer case, but don't copy any data at all (because the pointer
is usually the NULL pointer).
This commit is contained in:
Sascha Schumann
2001-05-11 19:32:01 +00:00
parent 2c4e1e84ce
commit 3efa08aaa8

View File

@@ -153,6 +153,11 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength)
} \
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
(p)->pData = &(p)->pDataPtr; \
} else if (nDataSize == 0) { \
if (!(p)->pDataPtr) { \
pefree((p)->pData, (ht)->persistent); \
} \
(p)->pData = &(p)->pDataPtr; \
} else { \
if ((p)->pDataPtr) { \
(p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
@@ -165,6 +170,8 @@ ZEND_API ulong hashpjw(char *arKey, uint nKeyLength)
if (nDataSize == sizeof(void*)) { \
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
(p)->pData = &(p)->pDataPtr; \
} else if (nDataSize == 0) { \
(p)->pData = &(p)->pDataPtr; \
} else { \
(p)->pData = (void *) pemalloc(nDataSize, (ht)->persistent); \
if (!(p)->pData) { \