Changeset 103
- Timestamp:
- 2006-08-27T07:09:02+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
processor/head.m4 (modified) (5 diffs)
-
processor/processor.m4 (modified) (16 diffs)
-
processor/string.m4 (modified) (5 diffs)
-
utils.c (modified) (9 diffs)
-
utils.h (modified) (1 diff)
-
xcache.c (modified) (2 diffs)
-
xcache.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/head.m4
r94 r103 47 47 typedef zval *zval_ptr; 48 48 typedef zend_uchar zval_data_type; 49 #ifdef IS_UNICODE 50 typedef UChar zstr_uchar; 51 #endif 52 typedef char zstr_char; 49 53 50 54 #define MAX_DUP_STR_LEN 256 … … 82 86 #endif 83 87 /* }}} */ 88 /* {{{ xc_zstrlen_char */ 89 static inline int xc_zstrlen_char(zstr s) 90 { 91 return strlen(ZSTR_S(s)); 92 } 93 /* }}} */ 94 #ifdef IS_UNICODE 95 /* {{{ xc_zstrlen_uchar */ 96 static inline int xc_zstrlen_uchar(zstr s) 97 { 98 int i; 99 UChar *p = ZSTR_U(s); 100 for (i = 0; *p; i ++, p++) { 101 /* empty */ 102 } 103 return i; 104 } 105 /* }}} */ 106 /* {{{ xc_zstrlen */ 107 static inline int xc_zstrlen(int type, zstr s) 108 { 109 return type == IS_UNICODE ? xc_zstrlen_uchar(s) : xc_zstrlen_char(s); 110 } 111 /* }}} */ 112 #else 113 /* {{{ xc_zstrlen */ 114 #define xc_zstrlen(dummy, s) xc_zstrlen_char(s) 115 /* }}} */ 116 #endif 84 117 /* {{{ xc_calc_string_n */ 85 118 REDEF(`KIND', `calc') 86 static inline void xc_calc_string_n(processor_t *processor, zend_uchar type, char *str, long size IFASSERT(`, int relayline')) {119 static inline void xc_calc_string_n(processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) { 87 120 pushdef(`__LINE__', `relayline') 88 121 int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 122 long dummy = 1; 89 123 90 124 if (realsize > MAX_DUP_STR_LEN) { 91 125 ALLOC(, char, realsize) 92 126 } 93 else if (zend_u_hash_add(&processor->strings, type, str, size, (void *)&str, sizeof(char*), NULL) == SUCCESS) {127 else if (zend_u_hash_add(&processor->strings, type, str, size, (void *) &dummy, sizeof(dummy), NULL) == SUCCESS) { 94 128 /* new string */ 95 129 ALLOC(, char, realsize) … … 97 131 IFASSERT(` 98 132 else { 99 dnl fprintf(stderr, "dupstr %s\n", str);133 dnl fprintf(stderr, "dupstr %s\n", ZSTR_S(str)); 100 134 } 101 135 ') … … 105 139 /* {{{ xc_store_string_n */ 106 140 REDEF(`KIND', `store') 107 static inline char *xc_store_string_n(processor_t *processor, zend_uchar type, char *str, long size IFASSERT(`, int relayline')) {141 static inline zstr xc_store_string_n(processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) { 108 142 pushdef(`__LINE__', `relayline') 109 143 int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 110 char *s;144 zstr ret, *pret; 111 145 112 146 if (realsize > MAX_DUP_STR_LEN) { 113 ALLOC(s, char, realsize) 114 memcpy(s, str, realsize); 115 } 116 else if (zend_u_hash_find(&processor->strings, type, str, size, (void*)&s) != SUCCESS) { 117 /* new string */ 118 ALLOC(s, char, realsize) 119 memcpy(s, str, realsize); 120 zend_u_hash_add(&processor->strings, type, str, size, (void*)&s, sizeof(char*), NULL); 121 } 122 else { 123 s = *(char**)s; 124 } 125 return s; 147 ALLOC(ZSTR_V(ret), char, realsize) 148 memcpy(ZSTR_V(ret), ZSTR_V(str), realsize); 149 return ret; 150 } 151 152 if (zend_u_hash_find(&processor->strings, type, str, size, (void **) &pret) == SUCCESS) { 153 return *pret; 154 } 155 156 /* new string */ 157 ALLOC(ZSTR_V(ret), char, realsize) 158 memcpy(ZSTR_V(ret), ZSTR_V(str), realsize); 159 zend_u_hash_add(&processor->strings, type, str, size, (void *) &ret, sizeof(zstr), NULL); 160 return ret; 161 126 162 popdef(`__LINE__') 127 163 } … … 185 221 } 186 222 else { 223 dnl FIXME: handle common.function_name here 187 224 #define SET_IF_SAME_NAME(member) \ 188 225 do { \ 189 if (!strcasecmp(zf->common.function_name, #member)) { \226 if (!strcasecmp(ZSTR_S(zf->common.function_name), #member)) { \ 190 227 ce->member = zf; \ 191 228 } \ -
trunk/processor/processor.m4
r99 r103 19 19 DEF_STRUCT_P_FUNC(`zend_compiled_variable', , ` 20 20 DISPATCH(int, name_len) 21 PROC_ USTRING_L(, name, name_len)21 PROC_ZSTRING_L(, name, name_len) 22 22 DISPATCH(ulong, hash_value) 23 23 ') … … 115 115 case IS_UNICODE: 116 116 proc_unicode: 117 DISPATCH(int32_t, value.u str.len)118 PROC_ USTRING_L(1, value.ustr.val, value.ustr.len)117 DISPATCH(int32_t, value.uni.len) 118 PROC_ZSTRING_L(1, value.uni.val, value.uni.len) 119 119 break; 120 120 #endif … … 200 200 DEF_STRUCT_P_FUNC(`zend_arg_info', , ` 201 201 DISPATCH(zend_uint, name_len) 202 PROC_ USTRING_L(, name, name_len)202 PROC_ZSTRING_L(, name, name_len) 203 203 DISPATCH(zend_uint, class_name_len) 204 PROC_ USTRING_L(, class_name, class_name_len)204 PROC_ZSTRING_L(, class_name, class_name_len) 205 205 DISPATCH(zend_bool, array_type_hint) 206 206 DISPATCH(zend_bool, allow_null) … … 216 216 DISPATCH(int, flags) 217 217 DISPATCH(uint, name_len) 218 PROC_ STRING_L(name, name_len)218 PROC_ZSTRING_L(, name, name_len) 219 219 zstr name; 220 220 DISPATCH(int, module_number) … … 248 248 DISPATCH(zend_uint, flags) 249 249 DISPATCH(int, name_length) 250 PROC_ USTRING_L(, name, name_length)250 PROC_ZSTRING_L(, name, name_length) 251 251 DISPATCH(ulong, h) 252 252 #ifdef ZEND_ENGINE_2_1 253 253 DISPATCH(int, doc_comment_len) 254 PROC_ USTRING_L(,doc_comment, doc_comment_len)254 PROC_STRING_L(doc_comment, doc_comment_len) 255 255 #endif 256 256 dnl isnt in php6 yet … … 268 268 DISPATCH(char, type) 269 269 DISPATCH(zend_uint, name_length) 270 PROC_ USTRING_L(, name, name_length)270 PROC_ZSTRING_L(, name, name_length) 271 271 IFRESTORE(` 272 272 #ifndef ZEND_ENGINE_2 … … 344 344 #ifdef ZEND_ENGINE_2_1 345 345 DISPATCH(zend_uint, doc_comment_len) 346 PROC_ USTRING_L(,doc_comment, doc_comment_len)346 PROC_STRING_L(doc_comment, doc_comment_len) 347 347 #endif 348 348 /* # NOT DONE */ … … 370 370 #endif 371 371 COPY(__call) 372 #ifdef IS_UNICODE373 SETNULL(u_twin)374 #endif375 372 /* # NOT DONE */ 376 373 COPY(module) … … 498 495 /* Common elements */ 499 496 DISPATCH(zend_uchar, type) 500 PROC_ USTRING(, function_name)497 PROC_ZSTRING(, function_name) 501 498 #ifdef ZEND_ENGINE_2 502 499 IFRESTORE(` … … 517 514 && zend_u_hash_find(&(processor->active_class_entry_dst->parent->function_table), 518 515 UG(unicode) ? IS_UNICODE : IS_STRING, 519 src->function_name, strlen(src->function_name) + 1,516 src->function_name, xc_zstrlen(UG(unicode), src->function_name) + 1, 520 517 (void **) &parent) == SUCCESS) { 521 518 /* see do_inherit_method_check() */ … … 574 571 /* END of common elements */ 575 572 #ifdef IS_UNICODE 576 SETNULL(u_twin)573 dnl SETNULL(u_twin) 577 574 #endif 578 575 … … 632 629 DISPATCH(zend_uint, line_end) 633 630 DISPATCH(int, doc_comment_len) 634 PROC_ USTRING_L(,doc_comment, doc_comment_len)631 PROC_STRING_L(doc_comment, doc_comment_len) 635 632 #endif 636 633 … … 651 648 #endif 652 649 IFRESTORE(`COPY(key)', ` 653 PROC_ USTRING_N(type, key, key_size)650 PROC_ZSTRING_N(type, key, key_size) 654 651 ') 655 652 STRUCT(zend_constant, constant) … … 663 660 #endif 664 661 IFRESTORE(`COPY(key)', ` 665 PROC_ USTRING_N(type, key, key_size)662 PROC_ZSTRING_N(type, key, key_size) 666 663 ') 667 664 STRUCT(zend_function, func) … … 674 671 #endif 675 672 IFRESTORE(`COPY(key)', ` 676 PROC_ USTRING_N(type, key, key_size)673 PROC_ZSTRING_N(type, key, key_size) 677 674 ') 678 675 #ifdef ZEND_ENGINE_2 … … 765 762 DISPATCH(int, name.str.len) 766 763 #endif 767 IFRESTORE(`COPY(name.str.val)', `PROC_USTRING_L(name_type, name.str.val, name.str.len)') 764 IFRESTORE(`COPY(name.str.val)', ` 765 #ifdef IS_UNICODE 766 PROC_ZSTRING_L(name_type, name.uni.val, name.uni.len) 767 #else 768 PROC_STRING_L(name.str.val, name.str.len) 769 #endif 770 ') 768 771 ') 769 772 DONE(name) -
trunk/processor/string.m4
r100 r103 3 3 define(`PROC_STRING_N_EX', ` 4 4 pushdef(`STRTYPE', `ifelse(`$5',,`char',`$5')') 5 pushdef(`ISTYPE', ifelse(STRTYPE,`char',IS_STRING,IS_UNICODE)) 6 if ($2 == NULL) { 5 pushdef(`PTRTYPE', ifelse( 6 STRTYPE, `char', `char', 7 STRTYPE, `zstr_char', `char', 8 `', `', `UChar')) 9 pushdef(`ISTYPE', ifelse(STRTYPE,`zstr_uchar',IS_UNICODE,IS_STRING)) 10 pushdef(`UNI_STRLEN', ifelse( 11 STRTYPE, `zstr_uchar', `xc_zstrlen_uchar', 12 STRTYPE, `zstr_char', `xc_zstrlen_char', 13 `', `', `strlen')) 14 pushdef(`SRCSTR', ifelse(STRTYPE,`char',`ZSTR($2)',`$2')) 15 pushdef(`SRCPTR', ifelse( 16 STRTYPE, `zstr_uchar', `ZSTR_U($2)', 17 STRTYPE, `zstr_char', `ZSTR_S($2)', 18 `', `', `$2')) 19 pushdef(`DSTPTR', ifelse( 20 STRTYPE, `zstr_uchar', `ZSTR_U($1)', 21 STRTYPE, `zstr_char', `ZSTR_S($1)', 22 `', `', `$1')) 23 if (SRCPTR == NULL) { 7 24 IFNOTMEMCPY(`IFCOPY(` 8 $1= NULL;25 DSTPTR = NULL; 9 26 ')') 10 27 IFDASM(` … … 14 31 else { 15 32 IFDPRINT(`INDENT() 16 ifelse(STRTYPE, ` UChar', `33 ifelse(STRTYPE, `zstr_uchar', ` 17 34 #ifdef IS_UNICODE 18 35 do { … … 32 49 #endif 33 50 ', ` 34 fprintf(stderr, "string:%s:\t\"%s\" len=%d\n", "$1", $2, $3 - 1);51 fprintf(stderr, "string:%s:\t\"%s\" len=%d\n", "$1", SRCPTR, $3 - 1); 35 52 ') 36 53 ') 37 IFCALC(`xc_calc_string_n(processor, ISTYPE, (void *) $2, `$3'IFASSERT(`, __LINE__'));')38 IFSTORE(` $1 = (STRTYPE *) xc_store_string_n(processor, ISTYPE, (char *) $2, `$3' IFASSERT(`, __LINE__'));')54 IFCALC(`xc_calc_string_n(processor, ISTYPE, SRCSTR, $3 IFASSERT(`, __LINE__'));') 55 IFSTORE(`DSTPTR = ifelse(PTRTYPE,`char',`ZSTR_S',`ZSTR_U')(xc_store_string_n(processor, ISTYPE, SRCSTR, $3 IFASSERT(`, __LINE__')));') 39 56 IFRESTORE(` 40 ALLOC( `$1', `STRTYPE', `($3)')41 memcpy( $1, $2, sizeof(STRTYPE) * ($3));57 ALLOC(DSTPTR, `STRTYPE', `($3)') 58 memcpy(DSTPTR, SRCPTR, sizeof(STRTYPE) * ($3)); 42 59 ') 43 FIXPOINTER_EX(` STRTYPE', `$1')60 FIXPOINTER_EX(`PTRTYPE', DSTPTR) 44 61 IFDASM(` 45 ifelse(STRTYPE, UChar, `62 ifelse(STRTYPE,zstr_uchar, ` 46 63 add_assoc_unicodel_ex(dst, ZEND_STRS("$4"), $2, $3-1, 1); 47 64 ', ` dnl else … … 49 66 ') 50 67 } 68 popdef(`DSTPTR') 69 popdef(`SRCPTR') 70 popdef(`SRCSTR') 71 popdef(`UNI_STRLEN') 51 72 popdef(`STRTYPE') 52 73 popdef(`ISTYPE') … … 59 80 define(`PROC_STRING', `DBG(`$0($*)') DONE(`$1')`'PROC_STRING_N_EX(`dst->$1', `src->$1', `strlen(src->$1) + 1', `$1', `char')') 60 81 61 dnl {{{ PROC_ USTRING_N(1:type, 2:name, 3:size, 4:size_type)62 define(`PROC_ USTRING_N', `82 dnl {{{ PROC_ZSTRING_N(1:type, 2:name, 3:size, 4:size_type) 83 define(`PROC_ZSTRING_N', ` 63 84 DBG(`$0($*)') 64 85 #ifdef IS_UNICODE 65 86 pushdef(`NSIZE', ifelse( 66 `$4', `strlen', ` strlen(src->$2) + 1',87 `$4', `strlen', `UNI_STRLEN (src->$2) + 1', 67 88 `$4', `len', `src->$3 + 1', 68 89 `', `', `src->$3', 69 90 )) 70 91 DONE(`$2') 71 ifelse(`$1', `1', `PROC_STRING_N_EX(`dst->$2', `src->$2', NSIZE, `$2', `UChar')92 ifelse(`$1', `1', `PROC_STRING_N_EX(`dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_uchar') 72 93 ', ` 73 if (ifelse(`$1', `', `UG(unicode)', `src->$1 ')) {74 PROC_STRING_N_EX(`dst->$2', `src->$2', NSIZE, `$2', `UChar')94 if (ifelse(`$1', `', `UG(unicode)', `src->$1 == IS_UNICODE')) { 95 PROC_STRING_N_EX(`dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_uchar') 75 96 } 76 97 else { 77 PROC_STRING_N_EX(`dst->$2', `src->$2', NSIZE, `$2', `char')98 PROC_STRING_N_EX(`dst->$2', `src->$2', defn(`NSIZE'), `$2', `zstr_char') 78 99 } 79 100 ') 80 101 #else 81 102 DONE(`$2') 82 PROC_STRING_N_EX(`dst->$2', `src->$2', NSIZE, `$2', ` char')103 PROC_STRING_N_EX(`dst->$2', `src->$2', NSIZE, `$2', `zstr_char') 83 104 #endif 84 105 popdef(`NSIZE') 85 106 ') 86 107 // }}} 87 define(`PROC_ USTRING_L', `DBG(`$0($*)') PROC_USTRING_N(`$1', `$2', `$3', `len')')88 define(`PROC_ USTRING', `DBG(`$0($*)') PROC_USTRING_N(`$1', `$2', , `strlen')')108 define(`PROC_ZSTRING_L', `DBG(`$0($*)') PROC_ZSTRING_N(`$1', `$2', `$3', `len')') 109 define(`PROC_ZSTRING', `DBG(`$0($*)') PROC_ZSTRING_N(`$1', `$2', , `strlen')') -
trunk/utils.c
r95 r103 266 266 267 267 #ifdef HAVE_XCACHE_CONSTANT 268 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, void *key, uint len TSRMLS_DC) /* {{{ */268 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */ 269 269 { 270 270 if (zend_u_hash_add(EG(zend_constants), type, key, len, … … 275 275 CG(compiled_filename) = filename; 276 276 CG(zend_lineno) = 0; 277 #ifdef IS_UNICODE 278 zend_error(E_NOTICE, "Constant %R already defined", type, key); 279 #else 277 280 zend_error(E_NOTICE, "Constant %s already defined", key); 278 free(constant->name); 281 #endif 282 free(ZSTR_V(constant->name)); 279 283 if (!(constant->flags & CONST_PERSISTENT)) { 280 284 zval_dtor(&constant->value); … … 284 288 /* }}} */ 285 289 #endif 286 void xc_install_function(char *filename, zend_function *func, zend_uchar type, void *key, uint len TSRMLS_DC) /* {{{ */ 287 { 290 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */ 291 { 292 zend_bool istmpkey; 293 288 294 if (func->type == ZEND_USER_FUNCTION) { 289 if (*(char *) key == '\0') { 295 #ifdef IS_UNICODE 296 istmpkey = (type == IS_STRING && ZSTR_S(key)[0] == 0) || ZSTR_U(key)[0] == 0; 297 #else 298 istmpkey = ZSTR_S(key)[0] == 0; 299 #endif 300 if (istmpkey) { 290 301 zend_u_hash_update(CG(function_table), type, key, len, 291 302 func, sizeof(zend_op_array), … … 300 311 CG(compiled_filename) = filename; 301 312 CG(zend_lineno) = ZESW(func->op_array.opcodes[0].lineno, func->op_array.line_start); 313 #ifdef IS_UNICODE 314 zend_error(E_ERROR, "Cannot redeclare %R()", type, key); 315 #else 302 316 zend_error(E_ERROR, "Cannot redeclare %s()", key); 303 } 304 } 305 } 306 /* }}} */ 307 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, void *key, uint len TSRMLS_DC) /* {{{ */ 308 { 317 #endif 318 } 319 } 320 } 321 /* }}} */ 322 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, zstr key, uint len TSRMLS_DC) /* {{{ */ 323 { 324 zend_bool istmpkey; 309 325 zend_class_entry *cep = CestToCePtr(*cest); 310 326 ZESW(void *stored_ce_ptr, NOTHING); 311 327 312 if (*(char *) key == '\0') { 328 #ifdef IS_UNICODE 329 istmpkey = (type == IS_STRING && ZSTR_S(key)[0] == 0) || ZSTR_U(key)[0] == 0; 330 #else 331 istmpkey = ZSTR_S(key)[0] == 0; 332 #endif 333 if (istmpkey) { 313 334 zend_u_hash_update(CG(class_table), type, key, len, 314 335 cest, sizeof(xc_cest_t), … … 323 344 CG(compiled_filename) = filename; 324 345 CG(zend_lineno) = ZESW(0, cep->line_start); 325 zend_error(E_ERROR, "Cannot redeclare class %s", (char *) cep->name); 346 #ifdef IS_UNICODE 347 zend_error(E_ERROR, "Cannot redeclare class %R", type, cep->name); 348 #else 349 zend_error(E_ERROR, "Cannot redeclare class %s", cep->name); 350 #endif 326 351 } 327 352 ZESW(return (xc_cest_t *) stored_ce_ptr, NOTHING); … … 338 363 static void xc_constant_copy_ctor(zend_constant *c) /* {{{ */ 339 364 { 340 c->name = zend_strndup(c->name, c->name_len - 1); 365 #ifdef IS_UNICODE 366 if (UG(unicode)) { 367 ZSTR_U(c->name) = zend_ustrndup(ZSTR_U(c->name), c->name_len - 1); 368 } 369 else 370 #endif 371 { 372 ZSTR_S(c->name) = zend_strndup(ZSTR_S(c->name), c->name_len - 1); 373 } 341 374 if (!(c->flags & CONST_PERSISTENT)) { 342 375 zval_copy_ctor(&c->value); … … 401 434 zend_constant *c = (zend_constant*) b->pData; 402 435 xc_install_constant(sandbox->filename, c, 403 BUCKET_KEY_TYPE(b), BUCKET_KEY(b), b->nKeyLength TSRMLS_CC);436 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY(b)), b->nKeyLength TSRMLS_CC); 404 437 b = b->pListNext; 405 438 } … … 411 444 zend_function *func = (zend_function*) b->pData; 412 445 xc_install_function(sandbox->filename, func, 413 BUCKET_KEY_TYPE(b), BUCKET_KEY(b), b->nKeyLength TSRMLS_CC);446 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY(b)), b->nKeyLength TSRMLS_CC); 414 447 b = b->pListNext; 415 448 } … … 419 452 while (b != NULL) { 420 453 xc_install_class(sandbox->filename, (xc_cest_t*)b->pData, 421 BUCKET_KEY_TYPE(b), BUCKET_KEY(b), b->nKeyLength TSRMLS_CC);454 BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY(b)), b->nKeyLength TSRMLS_CC); 422 455 b = b->pListNext; 423 456 } -
trunk/utils.h
r95 r103 27 27 /* installer */ 28 28 #ifdef HAVE_XCACHE_CONSTANT 29 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, void *key, uint len TSRMLS_DC);29 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len TSRMLS_DC); 30 30 #endif 31 void xc_install_function(char *filename, zend_function *func, zend_uchar type, void *key, uint len TSRMLS_DC);32 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, void *key, uint len TSRMLS_DC);31 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len TSRMLS_DC); 32 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, zstr key, uint len TSRMLS_DC); 33 33 34 34 /* sandbox */ -
trunk/xcache.c
r96 r103 503 503 static inline xc_hash_value_t xc_entry_hash_var(xc_entry_t *xce) /* {{{ */ 504 504 { 505 return UNISW(NOTHING, UG(unicode) ? HASH_USTR_L(xce->name_type, (char *)xce->name.ustr.val, xce->name.ustr.len) :)505 return UNISW(NOTHING, UG(unicode) ? HASH_USTR_L(xce->name_type, xce->name.uni.val, xce->name.uni.len) :) 506 506 HASH_STR_L(xce->name.str.val, xce->name.str.len); 507 507 } … … 761 761 memcpy(&data->name, b->pData, sizeof(datatype)); \ 762 762 UNISW(NOTHING, data->type = b->key.type;) \ 763 data->key = BUCKET_KEY(b); \ 763 if (UNISW(1, b->key.type == IS_STRING)) { \ 764 ZSTR_S(data->key) = BUCKET_KEY(b); \ 765 } \ 766 else { \ 767 ZSTR_U(data->key) = BUCKET_UKEY(b); \ 768 } \ 764 769 data->key_size = b->nKeyLength; \ 765 770 } \ -
trunk/xcache.h
r95 r103 52 52 : b->nKeyLength \ 53 53 )) 54 #define BUCKET_KEY(b) (UNISW((b)->arKey, (b)->key.u.string))55 #define BUCKET_UKEY(b) (UNISW((b)->arKey, (b)->key. u.unicode))54 #define BUCKET_KEY(b) (UNISW((b)->arKey, (b)->key.arKey.s)) 55 #define BUCKET_UKEY(b) (UNISW((b)->arKey, (b)->key.arKey.u)) 56 56 #define BUCKET_KEY_TYPE(b) (UNISW(0, (b)->key.type)) 57 57 #ifdef IS_UNICODE … … 64 64 #ifndef IS_UNICODE 65 65 typedef char *zstr; 66 # define ZSTR_S(s) (s) 67 # define ZSTR_U(s) (s) 68 # define ZSTR_V(s) (s) 69 #else 70 # define ZSTR_S(s) ((s)->s) 71 # define ZSTR_U(s) ((s)->u) 72 # define ZSTR_V(s) ((s)->v) 66 # define ZSTR_S(s) (s) 67 # define ZSTR_U(s) (s) 68 # define ZSTR_V(s) (s) 69 # define ZSTR_PS(s) (s) 70 # define ZSTR_PU(s) (s) 71 # define ZSTR_PV(s) (s) 72 #else 73 # define ZSTR_S(zs) ((zs).s) 74 # define ZSTR_U(zs) ((zs).u) 75 # define ZSTR_V(zs) ((zs).v) 76 # define ZSTR_PS(pzs) ((pzs)->s) 77 # define ZSTR_PU(pzs) ((pzs)->u) 78 # define ZSTR_PV(pzs) ((pzs)->v) 79 #endif 80 81 #ifndef ZSTR 82 # define ZSTR(s) (s) 83 #endif 84 85 #ifndef Z_UNIVAL 86 # define Z_UNIVAL(zval) (zval).value.str.val 87 # define Z_UNILEN(zval) (zval).value.str.len 73 88 #endif 74 89 … … 149 164 zend_uchar type; 150 165 #endif 151 char *key;166 zstr key; 152 167 zend_uint key_size; 153 168 xc_cest_t cest; … … 160 175 zend_uchar type; 161 176 #endif 162 char *key;177 zstr key; 163 178 zend_uint key_size; 164 179 zend_constant constant; … … 171 186 zend_uchar type; 172 187 #endif 173 char *key;188 zstr key; 174 189 zend_uint key_size; 175 190 zend_function func;
Note: See TracChangeset
for help on using the changeset viewer.

