Changeset 103 for trunk/processor/head.m4
- Timestamp:
- 2006-08-27T07:09:02+02:00 (7 years ago)
- File:
-
- 1 edited
-
trunk/processor/head.m4 (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 } \
Note: See TracChangeset
for help on using the changeset viewer.

