Browse Source

kill warnings

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@860 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 10 years ago
parent
commit
e5d9c15063
  1. 2
      processor/head.m4
  2. 21
      processor/main.m4
  3. 8
      processor/process.m4
  4. 10
      processor/string.m4
  5. 12
      utils.c
  6. 10
      utils.h
  7. 13
      xcache.c
  8. 21
      xcache.h

2
processor/head.m4

@ -353,7 +353,7 @@ static int xc_check_names(const char *file, int line, const char *functionName,
Bucket *b;
for (i = 0; i < assert_names_count; ++i) {
if (!zend_hash_exists(done_names, assert_names[i], strlen(assert_names[i]) + 1)) {
if (!zend_u_hash_exists(done_names, IS_STRING, assert_names[i], strlen(assert_names[i]) + 1)) {
fprintf(stderr
, "missing field at %s `#'%d %s`' : %s\n"
, file, line, functionName

21
processor/main.m4

@ -24,11 +24,11 @@ define(`SRC', `src->$1')
dnl ============
define(`INDENT', `xc_dprint_indent(indent);')
dnl }}}
dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:forcetype=$2)
dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2)
define(`ALLOC', `
pushdef(`COUNT', `ifelse(`$3', `', `1', `$3')')
pushdef(`SIZE', `sizeof($2)ifelse(`$3', `', `', ` * $3')')
pushdef(`FORCETYPE', `ifelse(`$5', , `$2', `$5')')
pushdef(`REALTYPE', `ifelse(`$5', , `$2', `$5')')
/* allocate */
IFCALC(`
IFASSERT(`
@ -55,7 +55,7 @@ define(`ALLOC', `
ifdef(`DEBUG_SIZE', ` {
void *oldp = processor->p;
')
$1 = (FORCETYPE *) (processor->p = (char *) ALIGN(processor->p));
$1 = (REALTYPE *) (processor->p = (char *) ALIGN(processor->p));
ifelse(`$4', `', `
IFASSERT(`memsetptr($1, (void *) (unsigned long) __LINE__, SIZE);')
', `
@ -71,18 +71,19 @@ define(`ALLOC', `
')
IFRESTORE(`ifelse(`$4', `', `
ifelse(
FORCETYPE*COUNT, `zval*1', `ALLOC_ZVAL($1);',
FORCETYPE*COUNT, `HashTable*1', `ALLOC_HASHTABLE($1);',
`', `', `$1 = (FORCETYPE *) emalloc(SIZE);')
REALTYPE*COUNT, `zval*1', `ALLOC_ZVAL($1);',
REALTYPE*COUNT, `HashTable*1', `ALLOC_HASHTABLE($1);',
`', `', `$1 = (REALTYPE *) emalloc(SIZE);')
IFASSERT(`memsetptr($1, (void *) __LINE__, SIZE);')
', `
$1 = (FORCETYPE *) ecalloc(COUNT, sizeof($2));
$1 = (REALTYPE *) ecalloc(COUNT, sizeof($2));
')
')
popdef(`REALTYPE')
popdef(`COUNT')
popdef(`SIZE')
')
dnl CALLOC(1:dst, 2:type [, 3:count=1, 4:forcetype=$2 ])
dnl CALLOC(1:dst, 2:type [, 3:count=1, 4:realtype=$2 ])
define(`CALLOC', `ALLOC(`$1', `$2', `$3', `1', `$4')')
dnl }}}
dnl {{{ PROC_CLASS_ENTRY_P(1:elm)
@ -95,7 +96,7 @@ define(`PROC_CLASS_ENTRY_P_EX', `
#ifdef IS_UNICODE
IFDASM(`add_assoc_unicodel_ex(dst, ZEND_STRS("$3"), ZSTR_U($2->name), $2->name_length, 1);')
#else
IFDASM(`add_assoc_stringl_ex(dst, ZEND_STRS("$3"), $2->name, $2->name_length, 1);')
IFDASM(`add_assoc_stringl_ex(dst, ZEND_STRS("$3"), (char *) $2->name, $2->name_length, 1);')
#endif
}
else {
@ -211,7 +212,7 @@ define(`DONE_SIZE', `IFASSERT(`dnl
define(`DONE', `
define(`ELEMENTS_DONE', defn(`ELEMENTS_DONE')`,"$1"')
IFASSERT(`dnl
if (zend_hash_exists(&done_names, "$1", sizeof("$1"))) {
if (zend_u_hash_exists(&done_names, IS_STRING, "$1", sizeof("$1"))) {
fprintf(stderr
, "duplicate field at %s `#'%d FUNC_NAME`' : %s\n"
, __FILE__, __LINE__

8
processor/process.m4

@ -14,7 +14,9 @@ define(`PROCESS_SCALAR', `dnl {{{ (1:elm, 2:format=%d, 3:type=)
')
dnl }}}
define(`PROCESS_xc_ztstring', `dnl {{{ (1:elm)
pushdef(`REALPTRTYPE', `zend_class_entry')
PROC_STRING(`$1')
popdef(`REALPTRTYPE')
')
dnl }}}
define(`PROCESS_zval_data_type', `dnl {{{ (1:elm)
@ -73,7 +75,7 @@ define(`PROCESS', `dnl PROCESS(1:type, 2:elm)
, `', `', `m4_errprint(`AUTOCHECK ERROR: Unknown type "$1"')define(`EXIT_PENDING', 1)'
)
')
define(`PROCESS_ARRAY', `dnl {{{ (1:count, 2:type, 3:elm, [4:force_type])
define(`PROCESS_ARRAY', `dnl {{{ (1:count, 2:type, 3:elm, [4:real_type])
if (src->$3) {
int LOOPCOUNTER;
IFDASM(`
@ -86,7 +88,7 @@ define(`PROCESS_ARRAY', `dnl {{{ (1:count, 2:type, 3:elm, [4:force_type])
`', `', `LOOPCOUNTER < SRC(`$1')');
++LOOPCOUNTER) {
pushdef(`dst', `arr')
pushdef(`SRC', defn(`SRC') `[LOOPCOUNTER]')
pushdef(`SRC', `ifelse(`$4', `', `', `', `', `($2)')' defn(`SRC') `[LOOPCOUNTER]')
popdef(`add_assoc_bool_ex', `add_next_index_bool($1, $3)')
popdef(`add_assoc_string_ex', `add_next_index_string($1, $3)')
popdef(`add_assoc_long_ex', `add_next_index_long($1, $3)')
@ -124,7 +126,7 @@ define(`PROCESS_ARRAY', `dnl {{{ (1:count, 2:type, 3:elm, [4:force_type])
++LOOPCOUNTER) {
DISABLECHECK(`
pushdef(`DST', defn(`DST') `[LOOPCOUNTER]')
pushdef(`SRC', ((const char **) defn(`SRC'))`[LOOPCOUNTER]')
pushdef(`SRC', `ifelse(`$4', `', `', `', `', `($2)')' defn(`SRC') `[LOOPCOUNTER]')
PROCESS(`$2', `$3')
popdef(`SRC')
popdef(`DST')

10
processor/string.m4

@ -59,19 +59,19 @@ define(`PROC_STRING_N_EX', `
')
')
IFCALC(`xc_calc_string_n(processor, ISTYPE, SRCSTR, $3 C_RELAYLINE);')
IFSTORE(`DSTPTR = ifelse(PTRTYPE,`char',`ZSTR_S',`ZSTR_U')(xc_store_string_n(processor, ISTYPE, SRCSTR, $3 C_RELAYLINE));')
IFSTORE(`DSTPTR = ifdef(`REALPTRTYPE', `(REALPTRTYPE() *)') ifelse(PTRTYPE,`char',`ZSTR_S',`ZSTR_U')(xc_store_string_n(processor, ISTYPE, SRCSTR, $3 C_RELAYLINE));')
IFRESTORE(`
DSTPTR = STRDUP() (SRCPTR, ($3) - 1);
DSTPTR = ifdef(`REALPTRTYPE', `(REALPTRTYPE() *)') STRDUP() (SRCPTR, ($3) - 1);
')
FIXPOINTER_EX(`PTRTYPE', DSTPTR)
FIXPOINTER_EX(ifdef(`REALPTRTYPE', `REALPTRTYPE()', `PTRTYPE'), DSTPTR)
IFDASM(`
ifelse(STRTYPE,zstr_uchar, `
add_assoc_unicodel_ex(dst, ZEND_STRS("$4"), ZSTR_U($2), $3-1, 1);
', ` dnl else
ifelse(STRTYPE,zstr_char, `
add_assoc_stringl_ex(dst, ZEND_STRS("$4"), ZSTR_S($2), $3-1, 1);
add_assoc_stringl_ex(dst, ZEND_STRS("$4"), (char *) ZSTR_S($2), $3-1, 1);
', `
add_assoc_stringl_ex(dst, ZEND_STRS("$4"), $2, $3-1, 1);
add_assoc_stringl_ex(dst, ZEND_STRS("$4"), (char *) $2, $3-1, 1);
')
')
')

12
utils.c

@ -481,7 +481,7 @@ static int xc_do_early_binding(zend_op_array *op_array, HashTable *class_table,
#endif
#ifdef HAVE_XCACHE_CONSTANT
void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
void xc_install_constant(ZEND_24(NOTHING, const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
{
if (zend_u_hash_add(EG(zend_constants), type, key, len,
constant, sizeof(zend_constant),
@ -501,7 +501,7 @@ void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant,
}
/* }}} */
#endif
void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
void xc_install_function(ZEND_24(NOTHING, const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
{
zend_bool istmpkey;
@ -531,7 +531,7 @@ void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zen
}
}
/* }}} */
ZESW(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) /* {{{ */
ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(NOTHING, const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */
{
zend_bool istmpkey;
zend_class_entry *cep = CestToCePtr(*cest);
@ -629,7 +629,7 @@ static void xc_sandbox_error_cb(int type, const char *error_filename, const uint
/* }}} */
#endif
#ifdef ZEND_ENGINE_2_1
static zend_bool xc_auto_global_callback(ZEND_24(const) char *name, uint name_len TSRMLS_DC) /* {{{ */
static zend_bool xc_auto_global_callback(ZEND_24(NOTHING, const) char *name, uint name_len TSRMLS_DC) /* {{{ */
{
return 0;
}
@ -709,7 +709,7 @@ void xc_copy_internal_zend_constants(HashTable *target, HashTable *source) /* {{
}
/* }}} */
#endif
xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(const) char *filename TSRMLS_DC) /* {{{ */
xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(NOTHING, const) char *filename TSRMLS_DC) /* {{{ */
{
HashTable *h;
@ -904,7 +904,7 @@ void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_D
if (install != XC_NoInstall) {
CG(in_compilation) = 1;
CG(compiled_filename) = ZEND_24((char *)) sandbox->filename;
CG(compiled_filename) = ZEND_24(NOTHING, (char *)) sandbox->filename;
CG(zend_lineno) = 0;
xc_sandbox_install(sandbox, install TSRMLS_CC);
CG(in_compilation) = 0;

10
utils.h

@ -68,10 +68,10 @@ int xc_foreach_early_binding_class(zend_op_array *op_array, void (*callback)(zen
/* installer */
#ifdef HAVE_XCACHE_CONSTANT
void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
void xc_install_constant(ZEND_24(NOTHING, const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
#endif
void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
ZESW(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);
void xc_install_function(ZEND_24(NOTHING, const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(NOTHING, const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
#if defined(E_STRICT) || defined(E_DEPRECATED)
#define XCACHE_ERROR_CACHING
@ -80,7 +80,7 @@ ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(const) char *filename, xc_cest_
/* sandbox */
typedef struct {
int alloc;
ZEND_24(const) char *filename;
ZEND_24(NOTHING, const) char *filename;
HashTable orig_included_files;
HashTable *tmp_included_files;
@ -121,7 +121,7 @@ typedef enum _xc_install_action_t {
} xc_install_action_t;
void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce));
xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(const) char *filename TSRMLS_DC);
xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(NOTHING, const) char *filename TSRMLS_DC);
void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC);
typedef zend_bool (*xc_if_func_t)(void *data);

13
xcache.c

@ -1133,9 +1133,9 @@ static int xc_entry_init_key_php_md5(xc_cache_t *cache, xc_compiler_t *compiler
return SUCCESS;
}
/* }}} */
static void xc_entry_init_key_php_entry(xc_entry_php_t *entry_php, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/
static void xc_entry_init_key_php_entry(xc_entry_php_t *entry_php, const char *filepath TSRMLS_DC) /* {{{*/
{
entry_php->filepath = filepath;
entry_php->filepath = ZEND_24((char *), NOTHING) filepath;
entry_php->filepath_len = strlen(entry_php->filepath);
entry_php->dirpath = estrndup(entry_php->filepath, entry_php->filepath_len);
entry_php->dirpath_len = zend_dirname(entry_php->dirpath, entry_php->filepath_len);
@ -1695,7 +1695,7 @@ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *
}
xc_undo_pass_two(compiler->new_php.op_array TSRMLS_CC);
xc_foreach_early_binding_class(compiler->new_php.op_array, xc_cache_early_binding_class_cb, (void *) compiler->new_php.SRMLS_CC);
xc_foreach_early_binding_class(compiler->new_php.op_array, xc_cache_early_binding_class_cb, (void *) &compiler->new_php TSRMLS_CC);
xc_redo_pass_two(compiler->new_php.op_array TSRMLS_CC);
/* }}} */
#endif
@ -3144,14 +3144,13 @@ PHP_FUNCTION(xcache_coredump)
/* {{{ proto string xcache_is_autoglobal(string name) */
PHP_FUNCTION(xcache_is_autoglobal)
{
char *name;
int name_len;
zval *name;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name) == FAILURE) {
return;
}
RETURN_BOOL(zend_hash_exists(CG(auto_globals), name, name_len + 1));
RETURN_BOOL(zend_u_hash_exists(CG(auto_globals), UG(unicode), Z_STRVAL_P(name), Z_STRLEN_P(name) + 1));
}
/* }}} */
static zend_function_entry xcache_functions[] = /* {{{ */

21
xcache.h

@ -42,9 +42,9 @@
# define ZESW(v1, v2) v2
#endif
#ifdef ZEND_ENGINE_2_4
# define ZEND_24(x) x
# define ZEND_24(pre24, v24) v24
#else
# define ZEND_24(x)
# define ZEND_24(pre24, v24) pre24
#endif
#ifdef do_alloca_with_limit
@ -190,22 +190,25 @@ typedef const zstr const_zstr;
/* {{{ u hash wrapper */
#ifndef IS_UNICODE
# define zend_u_hash_add(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \
zend_hash_add(ht, arKey, nKeyLength, pData, nDataSize, pDest)
zend_hash_add(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, pData, nDataSize, pDest)
# define zend_u_hash_quick_add(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \
zend_hash_quick_add(ht, arKey, nKeyLength, h, pData, nDataSize, pDest)
zend_hash_quick_add(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, h, pData, nDataSize, pDest)
# define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \
zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest)
zend_hash_update(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, pData, nDataSize, pDest)
# define zend_u_hash_quick_update(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \
zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest)
zend_hash_quick_update(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, h, pData, nDataSize, pDest)
# define zend_u_hash_find(ht, type, arKey, nKeyLength, pData) \
zend_hash_find(ht, arKey, nKeyLength, pData)
zend_hash_find(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, pData)
# define zend_u_hash_quick_find(ht, type, arKey, nKeyLength, h, pData) \
zend_hash_quick_find(ht, arKey, nKeyLength, h, pData)
zend_hash_quick_find(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength, h, pData)
# define zend_u_hash_exists(ht, type, arKey, nKeyLength) \
zend_hash_exists(ht, ZEND_24((char *), NOTHING) arKey, nKeyLength)
# define add_u_assoc_zval_ex(arg, type, key, key_len, value) \
add_assoc_zval_ex(arg, key, key_len, value)
@ -437,7 +440,7 @@ typedef struct {
#endif
int filepath_len;
ZEND_24(const) char *filepath;
ZEND_24(NOTHING, const) char *filepath;
int dirpath_len;
char *dirpath;
#ifdef IS_UNICODE

Loading…
Cancel
Save