Browse Source

PHP_5_4: HashTable bucket changes

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@823 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 10 years ago
parent
commit
9e42d11716
  1. 10
      processor/hashtable.m4
  2. 7
      xcache.h

10
processor/hashtable.m4

@ -103,7 +103,15 @@ define(`DEF_HASH_TABLE_FUNC', `
IFCALCCOPY(`bucketsize = BUCKET_SIZE(b);')
ALLOC(pnew, char, bucketsize, , Bucket)
IFCOPY(`memcpy(pnew, b, bucketsize);')
IFCOPY(`
#ifdef ZEND_ENGINE_2_4
memcpy(pnew, b, BUCKET_HEAD_SIZE(Bucket));
pnew->arKey = (const char *) (pnew + 1);
memcpy(pnew->arKey, b->arKey, BUCKET_KEY_SIZE(b));
#else
memcpy(pnew, b, bucketsize);
#endif
')
IFCOPY(`
n = b->h & src->nTableMask;
/* pnew into hash node chain */

7
xcache.h

@ -139,7 +139,12 @@ typedef znode znode_op;
#else
# define BUCKET_HEAD_SIZE(b) XtOffsetOf(Bucket, arKey)
#endif
#define BUCKET_SIZE(b) (BUCKET_HEAD_SIZE(b) + BUCKET_KEY_SIZE(b))
#ifdef ZEND_ENGINE_2_4
# define BUCKET_SIZE(b) (sizeof(Bucket) + BUCKET_KEY_SIZE(b))
#else
# define BUCKET_SIZE(b) (BUCKET_HEAD_SIZE(b) + BUCKET_KEY_SIZE(b))
#endif
#ifndef IS_UNICODE
typedef char *zstr;

Loading…
Cancel
Save