Browse Source

BUCKET_KEY readability and PHP_6 build fix

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@200 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.2
Xuefer 15 years ago
parent
commit
d519ff2c5a
  1. 2
      disassembler.c
  2. 2
      processor/hashtable.m4
  3. 2
      processor/head.m4
  4. 2
      processor/processor.m4
  5. 6
      utils.c
  6. 4
      xcache.c
  7. 9
      xcache.h

2
disassembler.c

@ -50,7 +50,7 @@ static void xc_dasm(zval *dst, zend_op_array *op_array TSRMLS_DC) /* {{{ */
} while (keysize > bufsize);
buf = erealloc(buf, bufsize);
}
memcpy(buf, BUCKET_KEY(b), keysize);
memcpy(buf, BUCKET_KEY_S(b), keysize);
buf[keysize - 2] = buf[keysize - 1] = ""[0];
keysize = b->nKeyLength;
#ifdef IS_UNICODE

2
processor/hashtable.m4

@ -44,7 +44,7 @@ define(`DEF_HASH_TABLE_FUNC', `
} while (keysize > bufsize);
buf = erealloc(buf, bufsize);
}
memcpy(buf, BUCKET_KEY(b), keysize);
memcpy(buf, BUCKET_KEY_S(b), keysize);
buf[keysize - 2] = buf[keysize - 1] = ""[0];
keysize = b->nKeyLength;
#ifdef IS_UNICODE

2
processor/head.m4

@ -251,7 +251,7 @@ static int xc_hash_static_member_check(xc_processor_t *processor, Bucket *b TSRM
const zend_class_entry *src = processor->active_class_entry_src;
if (src->parent) {
zval **srczv;
if (zend_hash_quick_find(CE_STATIC_MEMBERS(src), b->arKey, b->nKeyLength, b->h, (void **) &srczv) == SUCCESS) {
if (zend_u_hash_quick_find(CE_STATIC_MEMBERS(src), BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h, (void **) &srczv) == SUCCESS) {
zval **zv = (zval **) b->pData;
if (*srczv == *zv) {
return ZEND_HASH_APPLY_REMOVE;

2
processor/processor.m4

@ -56,7 +56,9 @@ dnl }}}
dnl {{{ zend_brk_cont_element
DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `
#ifdef ZEND_ENGINE_2_2
#ifndef IS_UNICODE
DISPATCH(int, start)
#endif
#endif
DISPATCH(int, cont)
DISPATCH(int, brk)

6
utils.c

@ -410,7 +410,7 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
while (b != NULL) {
zend_constant *c = (zend_constant*) b->pData;
xc_install_constant(sandbox->filename, c,
BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY(b)), b->nKeyLength TSRMLS_CC);
BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC);
b = b->pListNext;
}
#endif
@ -420,7 +420,7 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
while (b != NULL) {
zend_function *func = (zend_function*) b->pData;
xc_install_function(sandbox->filename, func,
BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY(b)), b->nKeyLength TSRMLS_CC);
BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC);
b = b->pListNext;
}
@ -428,7 +428,7 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
/* install class */
while (b != NULL) {
xc_install_class(sandbox->filename, (xc_cest_t*)b->pData,
BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY(b)), b->nKeyLength TSRMLS_CC);
BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength TSRMLS_CC);
b = b->pListNext;
}

4
xcache.c

@ -950,10 +950,10 @@ static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /
memcpy(&data->name, b->pData, sizeof(datatype)); \
UNISW(NOTHING, data->type = b->key.type;) \
if (UNISW(1, b->key.type == IS_STRING)) { \
ZSTR_S(data->key) = BUCKET_KEY(b); \
ZSTR_S(data->key) = BUCKET_KEY_S(b); \
} \
else { \
ZSTR_U(data->key) = BUCKET_UKEY(b); \
ZSTR_U(data->key) = BUCKET_KEY_U(b); \
} \
data->key_size = b->nKeyLength; \
} \

9
xcache.h

@ -47,9 +47,9 @@
? UBYTES(b->nKeyLength) \
: b->nKeyLength \
))
#define BUCKET_KEY(b) (UNISW((b)->arKey, (b)->key.arKey.s))
#define BUCKET_UKEY(b) (UNISW((b)->arKey, (b)->key.arKey.u))
#define BUCKET_KEY_TYPE(b) (UNISW(0, (b)->key.type))
#define BUCKET_KEY_S(b) (UNISW((b)->arKey, (b)->key.arKey.s))
#define BUCKET_KEY_U(b) (UNISW((b)->arKey, (b)->key.arKey.u))
#define BUCKET_KEY_TYPE(b) (UNISW(IS_STRING, (b)->key.type))
#ifdef IS_UNICODE
# define BUCKET_HEAD_SIZE(b) XtOffsetOf(Bucket, key.arKey)
#else
@ -94,6 +94,9 @@ typedef char *zstr;
# define zend_u_hash_find(ht, type, arKey, nKeyLength, pData) \
zend_hash_find(ht, arKey, nKeyLength, pData)
# define zend_u_hash_quick_find(ht, type, arKey, nKeyLength, h, pData) \
zend_hash_quick_find(ht, arKey, nKeyLength, h, pData)
# define add_u_assoc_zval_ex(arg, type, key, key_len, value) \
add_assoc_zval_ex(arg, key, key_len, value)

Loading…
Cancel
Save