From 3003e642fbfed48455142c6009992d0d75b2ba8b Mon Sep 17 00:00:00 2001 From: Xuefer Date: Wed, 8 Jul 2009 04:39:33 +0000 Subject: [PATCH] reverted r643 as it's a false assertion. try another way to get ride of some const warning git-svn-id: svn://svn.lighttpd.net/xcache/trunk@645 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- processor/head.m4 | 4 ++-- processor/processor.m4 | 4 ++-- processor/string.m4 | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/processor/head.m4 b/processor/head.m4 index 00e17ec..112756e 100644 --- a/processor/head.m4 +++ b/processor/head.m4 @@ -130,7 +130,7 @@ static inline int xc_zstrlen(int type, zstr s) #endif /* {{{ xc_calc_string_n */ REDEF(`KIND', `calc') -static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) { +static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const zstr str, long size IFASSERT(`, int relayline')) { pushdef(`__LINE__', `relayline') int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); long dummy = 1; @@ -152,7 +152,7 @@ static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, /* }}} */ /* {{{ xc_store_string_n */ REDEF(`KIND', `store') -static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) { +static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const zstr str, long size IFASSERT(`, int relayline')) { pushdef(`__LINE__', `relayline') int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); zstr ret, *pret; diff --git a/processor/processor.m4 b/processor/processor.m4 index 1aa29a8..e286fe3 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -219,9 +219,9 @@ dnl {{{ zend_arg_info #ifdef ZEND_ENGINE_2 DEF_STRUCT_P_FUNC(`zend_arg_info', , ` DISPATCH(zend_uint, name_len) - COPY(name) + PROC_ZSTRING_L(, name, name_len) DISPATCH(zend_uint, class_name_len) - COPY(class_name) + PROC_ZSTRING_L(, class_name, class_name_len) DISPATCH(zend_bool, array_type_hint) DISPATCH(zend_bool, allow_null) DISPATCH(zend_bool, pass_by_reference) diff --git a/processor/string.m4 b/processor/string.m4 index 73b5f81..d777b79 100644 --- a/processor/string.m4 +++ b/processor/string.m4 @@ -20,6 +20,9 @@ define(`PROC_STRING_N_EX', ` STRTYPE, `zstr_uchar', `ZSTR_U($1)', STRTYPE, `zstr_char', `ZSTR_S($1)', `', `', `$1')) + pushdef(`U', ifelse( + PTRTYPE, `char', `', + PTRTYPE, `UChar', `u')) if (SRCPTR == NULL) { IFNOTMEMCPY(`IFCOPY(` DSTPTR = NULL; @@ -55,11 +58,10 @@ define(`PROC_STRING_N_EX', ` fprintf(stderr, "\" len=%d\n", $3 - 1); ') ') - IFCALC(`xc_calc_string_n(processor, ISTYPE, SRCSTR, $3 IFASSERT(`, __LINE__'));') - IFSTORE(`DSTPTR = ifelse(PTRTYPE,`char',`ZSTR_S',`ZSTR_U')(xc_store_string_n(processor, ISTYPE, SRCSTR, $3 IFASSERT(`, __LINE__')));') + IFCALC(`xc_calc_string_n(processor, ISTYPE, ZSTR(SRCSTR), $3 IFASSERT(`, __LINE__'));') + IFSTORE(`DSTPTR = ifelse(PTRTYPE,`char',`ZSTR_S',`ZSTR_U')(xc_store_string_n(processor, ISTYPE, ZSTR(SRCSTR), $3 IFASSERT(`, __LINE__')));') IFRESTORE(` - ALLOC(DSTPTR, `STRTYPE', `($3)') - memcpy(DSTPTR, SRCPTR, sizeof(STRTYPE) * ($3)); + DSTPTR = e`'U`'strndup(SRCPTR, ($3) - 1); ') FIXPOINTER_EX(`PTRTYPE', DSTPTR) IFDASM(` @@ -74,6 +76,7 @@ define(`PROC_STRING_N_EX', ` ') ') } + popdef(`U') popdef(`DSTPTR') popdef(`SRCPTR') popdef(`SRCSTR')