Changeset 846 in svn


Ignore:
Timestamp:
2012-03-26T09:41:19Z (3 years ago)
Author:
Xuefer
Message:

kill most const warning

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r844 r846  
    179179#define C_RELAYLINE , __LINE__
    180180')
    181 static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr const str, long size IFASSERT(`, int relayline')) {
     181static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) {
    182182    pushdef(`__LINE__', `relayline')
    183183    int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
     
    201201/* {{{ xc_store_string_n */
    202202REDEF(`KIND', `store')
    203 static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr const str, long size IFASSERT(`, int relayline')) {
     203static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) {
    204204    pushdef(`__LINE__', `relayline')
    205205    int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
  • trunk/processor/processor.m4

    r844 r846  
    411411    COPYNULL(traits)
    412412    COPYZERO(num_traits)
     413    STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases)
     414    STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences)
    413415#   endif
    414416#else
     
    426428    PROCESS(zend_uint, num_interfaces)
    427429#endif
    428     STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases)
    429     STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences)
    430430
    431431#   ifdef ZEND_ENGINE_2_4
  • trunk/utils.c

    r829 r846  
    482482
    483483#ifdef HAVE_XCACHE_CONSTANT
    484 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
     484void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
    485485{
    486486    if (zend_u_hash_add(EG(zend_constants), type, key, len,
     
    502502/* }}} */
    503503#endif
    504 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
     504void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
    505505{
    506506    zend_bool istmpkey;
     
    532532}
    533533/* }}} */
    534 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
     534ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
    535535{
    536536    zend_bool istmpkey;
     
    630630#endif
    631631#ifdef ZEND_ENGINE_2_1
    632 static zend_bool xc_auto_global_callback(char *name, uint name_len TSRMLS_DC) /* {{{ */
     632static zend_bool xc_auto_global_callback(ZEND_24(const) char *name, uint name_len TSRMLS_DC) /* {{{ */
    633633{
    634634    return 0;
     
    710710/* }}} */
    711711#endif
    712 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */
     712xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(const) char *filename TSRMLS_DC) /* {{{ */
    713713{
    714714    HashTable *h;
  • trunk/utils.h

    r671 r846  
    6969/* installer */
    7070#ifdef HAVE_XCACHE_CONSTANT
    71 void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC);
     71void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
    7272#endif
    73 void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC);
    74 ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC);
     73void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
     74ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
    7575
    7676#if defined(E_STRICT) || defined(E_DEPRECATED)
     
    8181typedef struct {
    8282    int alloc;
    83     char *filename;
     83    ZEND_24(const) char *filename;
    8484
    8585    HashTable orig_included_files;
     
    122122
    123123void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce));
    124 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC);
     124xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(const) char *filename TSRMLS_DC);
    125125void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC);
    126126
  • trunk/xcache.c

    r840 r846  
    3838#include "utils.h"
    3939
    40 #define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > pentry->ctime + (pentry)->ttl)
     40#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (pentry)->ttl)
    4141#define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0)
    42 #define LOCK(x) xc_lock(x->lck)
    43 #define UNLOCK(x) xc_unlock(x->lck)
     42#define LOCK(x) xc_lock((x)->lck)
     43#define UNLOCK(x) xc_unlock((x)->lck)
    4444
    4545#define ENTER_LOCK_EX(x) \
    46     xc_lock(x->lck); \
     46    xc_lock((x)->lck); \
    4747    zend_try { \
    4848        do
     
    5252        catched = 1; \
    5353    } zend_end_try(); \
    54     xc_unlock(x->lck)
     54    xc_unlock((x)->lck)
    5555
    5656#define ENTER_LOCK(x) do { \
     
    859859    /* fall back to current directory */
    860860    if (zend_is_executing(TSRMLS_C)) {
    861         char *path = zend_get_executed_filename(TSRMLS_C);
    862         if (path && path[0] != '[') {
    863             int len = strlen(path);
    864             while ((--len >= 0) && !IS_SLASH(path[len])) {
     861        const char *executed_filename = zend_get_executed_filename(TSRMLS_C);
     862        if (executed_filename && executed_filename[0] != '[') {
     863            int len = strlen(executed_filename);
     864            while ((--len >= 0) && !IS_SLASH(executed_filename[len])) {
    865865                /* skipped */
    866866            }
    867867            if (len > 0 && len + strlen(filename) + 1 < MAXPATHLEN - 1) {
    868                 strcpy(filepath, path);
     868                strcpy(filepath, executed_filename);
    869869                strcpy(filepath + len + 1, filename);
    870870                if (VCWD_STAT(filepath, pbuf) == 0) {
     
    886886
    887887#define HASH(i) (i)
    888 #define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func(t, s, (l + 1) * sizeof(UChar)))
    889 #define HASH_STR_S(s, l) HASH(zend_inline_hash_func(s, l))
    890 #define HASH_STR_L(s, l) HASH_STR_S(s, l + 1)
    891 #define HASH_STR(s) HASH_STR_L(s, strlen(s) + 1)
     888#define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func((t), (s), ((l) + 1) * sizeof(UChar)))
     889#define HASH_STR_S(s, l) HASH(zend_inline_hash_func((s), (l)))
     890#define HASH_STR_L(s, l) HASH_STR_S((s), (l) + 1)
     891#define HASH_STR(s) HASH_STR_L((s), strlen((s)) + 1)
    892892#define HASH_NUM(n) HASH(n)
    893893static inline xc_hash_value_t xc_hash_fold(xc_hash_value_t hvalue, const xc_hash_t *hasher) /* {{{ fold hash bits as needed */
     
    962962/* }}} */
    963963
    964 static int xc_entry_init_key_php(xc_entry_t *xce, char *filename TSRMLS_DC) /* {{{ */
     964static int xc_entry_init_key_php(xc_entry_t *xce, const char *filename TSRMLS_DC) /* {{{ */
    965965{
    966966    char opened_path_buffer[MAXPATHLEN];
    967     struct stat buf, *pbuf;
    968     xc_hash_value_t hv;
    969967    int cacheid;
    970     xc_entry_data_php_t *php;
    971     char *ptr;
    972     time_t delta;
    973968
    974969    if (!filename || !SG(request_info).path_translated) {
     
    980975    }
    981976
    982     php = xce->data.php;
    983 
    984977    if (XG(stat)) {
     978        struct stat buf, *pbuf;
     979
    985980        if (strcmp(SG(request_info).path_translated, filename) == 0) {
    986981            /* sapi has already done this stat() for us */
     
    1002997        /* relative path */
    1003998        if (*filename == '.' && (IS_SLASH(filename[1]) || filename[1] == '.')) {
    1004             ptr = filename + 1;
     999            const char *ptr = filename + 1;
    10051000            if (*ptr == '.') {
    10061001                while (*(++ptr) == '.');
     
    10251020
    10261021stat_done:
    1027         delta = XG(request_time) - pbuf->st_mtime;
    1028         if (abs(delta) < 2 && !xc_test) {
    1029             return FAILURE;
     1022        {
     1023            time_t delta = XG(request_time) - pbuf->st_mtime;
     1024            if (abs(delta) < 2 && !xc_test) {
     1025                return FAILURE;
     1026            }
    10301027        }
    10311028
     
    10351032        xce->inode        = pbuf->st_ino;
    10361033#endif
    1037         php->sourcesize  = pbuf->st_size;
     1034        xce->data.php->sourcesize = pbuf->st_size;
    10381035    }
    10391036    else { /* XG(inode) */
     
    10431040        xce->inode        = 0;
    10441041#endif
    1045         php->sourcesize  = 0;
     1042        xce->data.php->sourcesize = 0;
    10461043    }
    10471044
     
    10591056
    10601057    UNISW(NOTHING, xce->name_type = IS_STRING;)
    1061     xce->name.str.val = filename;
     1058    xce->name.str.val = (char *) filename;
    10621059    xce->name.str.len = strlen(filename);
    10631060
    1064     if (xc_php_hcache.size > 1) {
    1065         hv = xc_entry_hash_php_basename(xce TSRMLS_CC);
    1066         cacheid = xc_hash_fold(hv, &xc_php_hcache);
    1067     }
    1068     else {
    1069         cacheid = 0;
    1070     }
     1061    cacheid = xc_php_hcache.size > 1 ? xc_hash_fold(xc_entry_hash_php_basename(xce TSRMLS_CC), &xc_php_hcache) : 0;
    10711062    xce->cache = xc_php_caches[cacheid];
    1072 
    1073     hv = xc_entry_hash_php(xce TSRMLS_CC);
    1074     xce->hvalue = xc_hash_fold(hv, &xc_php_hentry);
    1075 
     1063    xce->hvalue = xc_hash_fold(xc_entry_hash_php(xce TSRMLS_CC), &xc_php_hentry);
    10761064    xce->type = XC_TYPE_PHP;
    1077 
    10781065    xce->filepath  = NULL;
    10791066    xce->dirpath   = NULL;
     
    10881075static inline xc_hash_value_t xc_php_hash_md5(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
    10891076{
    1090     return HASH_STR_S(&php->md5, sizeof(php->md5));
     1077    return HASH_STR_S(php->md5.digest, sizeof(php->md5));
    10911078}
    10921079/* }}} */
     
    10971084    int             n;
    10981085    php_stream     *stream;
    1099     xc_hash_value_t hv;
    11001086    ulong           old_rsid = EG(regular_list).nNextFreeElement;
    11011087
     
    11201106    }
    11211107
    1122     hv = xc_php_hash_md5(php TSRMLS_CC);
    11231108    php->cache  = xce->cache;
    1124     php->hvalue = (hv & php->cache->hphp->mask);
     1109    php->hvalue = (xc_php_hash_md5(php TSRMLS_CC) & php->cache->hphp->mask);
    11251110#ifdef XCACHE_DEBUG
    11261111    {
     
    11341119}
    11351120/* }}} */
    1136 static void xc_entry_init_key_php_entry(xc_entry_t *xce, char *filepath TSRMLS_DC) /* {{{*/
     1121static void xc_entry_init_key_php_entry(xc_entry_t *xce, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/
    11371122{
    11381123    xce->filepath     = filepath;
     
    15181503    /* }}} */
    15191504    /* {{{ prepare */
    1520     zend_restore_compiled_filename(h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
     1505    zend_restore_compiled_filename(h->opened_path ? h->opened_path : (char *) h->filename TSRMLS_CC);
    15211506    php->op_array      = op_array;
    15221507
     
    18901875     */
    18911876    if (xce->inode) {
    1892         char *filename = h->opened_path ? h->opened_path : h->filename;
     1877        const char *filename = h->opened_path ? h->opened_path : h->filename;
    18931878        if (xce->name.str.val != filename) {
    1894             xce->name.str.val = filename;
     1879            xce->name.str.val = (char *) filename;
    18951880            xce->name.str.len = strlen(filename);
    18961881        }
     
    19791964    xc_entry_t xce;
    19801965    xc_entry_data_php_t php;
    1981     char *filename;
     1966    const char *filename;
    19821967
    19831968    assert(xc_initized);
  • trunk/xcache.h

    r840 r846  
    4141#else
    4242#   define ZESW(v1, v2) v2
     43#endif
     44#ifdef ZEND_ENGINE_2_4
     45#   define ZEND_24(x) x
     46#else
     47#   define ZEND_24(x)
    4348#endif
    4449
     
    150155typedef char *zstr;
    151156typedef const char *const_zstr;
     157#ifdef ZEND_ENGINE_2_4
     158typedef const char *const24_zstr;
     159typedef const char *const24_str;
     160#else
     161typedef char *const24_zstr;
     162typedef char *const24_str;
     163#endif
     164
    152165#   define ZSTR_S(s)     (s)
    153166#   define ZSTR_U(s)     (s)
     
    292305typedef struct {
    293306#ifdef IS_UNICODE
    294     zend_uchar type;
    295 #endif
    296     zstr      key;
    297     zend_uint key_size;
    298     ulong     h;
    299     zend_uint methodinfo_cnt;
     307    zend_uchar   type;
     308#endif
     309    const24_zstr key;
     310    zend_uint    key_size;
     311    ulong        h;
     312    zend_uint  methodinfo_cnt;
    300313    xc_op_array_info_t *methodinfos;
    301     xc_cest_t cest;
     314    xc_cest_t    cest;
    302315#ifndef ZEND_COMPILE_DELAYED_BINDING
    303     int       oplineno;
     316    int          oplineno;
    304317#endif
    305318} xc_classinfo_t;
     
    309322typedef struct {
    310323#ifdef IS_UNICODE
    311     zend_uchar type;
    312 #endif
    313     zstr      key;
    314     zend_uint key_size;
    315     ulong     h;
     324    zend_uchar    type;
     325#endif
     326    const24_zstr  key;
     327    zend_uint     key_size;
     328    ulong         h;
    316329    zend_constant constant;
    317330} xc_constinfo_t;
     
    321334typedef struct {
    322335#ifdef IS_UNICODE
    323     zend_uchar type;
    324 #endif
    325     zstr      key;
    326     zend_uint key_size;
    327     ulong     h;
     336    zend_uchar     type;
     337#endif
     338    const24_zstr   key;
     339    zend_uint      key_size;
     340    ulong          h;
    328341    xc_op_array_info_t op_array_info;
    329342    zend_function func;
     
    334347typedef struct {
    335348#ifdef IS_UNICODE
    336     zend_uchar type;
    337 #endif
    338     zstr      key;
    339     zend_uint  key_len;
    340     ulong      h;
     349    zend_uchar   type;
     350#endif
     351    const24_zstr key;
     352    zend_uint    key_len;
     353    ulong        h;
    341354} xc_autoglobal_t;
    342355/* }}} */
     
    438451    /* php only */
    439452    int    filepath_len;
    440     char *filepath;
     453    ZEND_24(const) char *filepath;
    441454    int    dirpath_len;
    442455    char  *dirpath;
Note: See TracChangeset for help on using the changeset viewer.