Ignore:
Timestamp:
2006-08-27T07:09:02+02:00 (8 years ago)
Author:
moo
Message:

PHP_6: builds again with php6. update UChar/void ptr to zstr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r94 r103  
    4747typedef zval *zval_ptr; 
    4848typedef zend_uchar zval_data_type; 
     49#ifdef IS_UNICODE 
     50typedef UChar zstr_uchar; 
     51#endif 
     52typedef char  zstr_char; 
    4953 
    5054#define MAX_DUP_STR_LEN 256 
     
    8286#endif 
    8387/* }}} */ 
     88/* {{{ xc_zstrlen_char */ 
     89static inline int xc_zstrlen_char(zstr s) 
     90{ 
     91    return strlen(ZSTR_S(s)); 
     92} 
     93/* }}} */ 
     94#ifdef IS_UNICODE 
     95/* {{{ xc_zstrlen_uchar */ 
     96static 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 */ 
     107static 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 
    84117/* {{{ xc_calc_string_n */ 
    85118REDEF(`KIND', `calc') 
    86 static inline void xc_calc_string_n(processor_t *processor, zend_uchar type, char *str, long size IFASSERT(`, int relayline')) { 
     119static inline void xc_calc_string_n(processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) { 
    87120    pushdef(`__LINE__', `relayline') 
    88121    int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 
     122    long dummy = 1; 
    89123 
    90124    if (realsize > MAX_DUP_STR_LEN) { 
    91125        ALLOC(, char, realsize) 
    92126    } 
    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) { 
    94128        /* new string */ 
    95129        ALLOC(, char, realsize) 
     
    97131    IFASSERT(` 
    98132        else { 
    99             dnl fprintf(stderr, "dupstr %s\n", str); 
     133            dnl fprintf(stderr, "dupstr %s\n", ZSTR_S(str)); 
    100134        } 
    101135    ') 
     
    105139/* {{{ xc_store_string_n */ 
    106140REDEF(`KIND', `store') 
    107 static inline char *xc_store_string_n(processor_t *processor, zend_uchar type, char *str, long size IFASSERT(`, int relayline')) { 
     141static inline zstr xc_store_string_n(processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) { 
    108142    pushdef(`__LINE__', `relayline') 
    109143    int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); 
    110     char *s; 
     144    zstr ret, *pret; 
    111145 
    112146    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 
    126162    popdef(`__LINE__') 
    127163} 
     
    185221    } 
    186222    else { 
     223dnl FIXME: handle common.function_name here 
    187224#define SET_IF_SAME_NAME(member) \ 
    188225        do { \ 
    189             if(!strcasecmp(zf->common.function_name, #member)) { \ 
     226            if (!strcasecmp(ZSTR_S(zf->common.function_name), #member)) { \ 
    190227                ce->member = zf; \ 
    191228            } \ 
Note: See TracChangeset for help on using the changeset viewer.