com php-src: one more walk through in Zend, fixed things being overseen: Zend/zend.c Zend/zend.h Zend/zend_alloc.c Zend/zend_exc eptions.c
Zend/zend_exceptions.h Zend/zend_execute .h Zend/zend_execute_API.c Zend/zend_generators .h Zend/zend_globals.h Zend/zend_operators.c Ze
nd/zend_operators.h Zend/zend_virtual_cwd.c Zend/ zend_virtual_cwd.h
| From: | Anatol Belski | Date: | Sun, 24 Nov 2013 15:06:47 +0000 |
| Subject: | com php-src: one more walk through in Zend, fixed things being overseen: Zend/zend.c Zend/zend.h Zend/zend_alloc.c Zend/zend_exc eptions.c Zend/zend_exceptions.h Zend/zend_execute .h Zend/zend_execute_API.c Zend/zend_generators .h Zend/zend_globals.h Zend/zend_operators.c Ze nd/zend_operators.h Zend/zend_virtual_cwd.c Zend/ zend_virtual_cwd.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74031@lists.php.net to get a copy of this message | ||
Commit: a73c8812a16ffa5bf730412ff51bb36beee89c5a
Author: Anatol Belski <ab@php.net> Sun, 24 Nov 2013 16:06:47 +0100
Parents: 9238345922c2c42e1f9b9ac90cf80423c7e996cb
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a73c8812a16ffa5bf730412ff51bb36beee89c5a
Log:
one more walk through in Zend, fixed things being overseen
Changed paths:
M Zend/zend.c
M Zend/zend.h
M Zend/zend_alloc.c
M Zend/zend_exceptions.c
M Zend/zend_exceptions.h
M Zend/zend_execute.h
M Zend/zend_execute_API..c
M Zend/zend_generators.h
M Zend/zend_globals.h
M Zend/zend_operators.c
M Zend/zend_operators.h
M Zend/zend_virtual_cwd.c
M Zend/zend_virtual_cwd.h
diff --git a/Zend/zend.c b/Zend/zend.c index 8f9c4a3..13dec8a 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -64,7 +64,7 @@ ZEND_API char *(*zend_resolve_path)(const char *filename, zend_str_size_int file void (*zend_on_timeout)(int seconds TSRMLS_DC); -static void (*zend_message_dispatcher_p)(long message, const void *data TSRMLS_DC); +static void (*zend_message_dispatcher_p)(zend_int_t message, const void *data TSRMLS_DC); static int (*zend_get_configuration_directive_p)(const char *name, zend_str_size_uint name_length, zval *contents); static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ @@ -179,7 +179,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, case HASH_KEY_IS_LONG: { char key[25]; - snprintf(key, sizeof(key), "%ld", num_key); + snprintf(key, sizeof(key), ZEND_INT_FMT, num_key); ZEND_PUTS_EX(key); } break; @@ -217,7 +217,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */ ZEND_PUTS(string_key); break; case HASH_KEY_IS_LONG: - zend_printf("%ld", num_key); + zend_printf(ZEND_INT_FMT, num_key); break; } ZEND_PUTS("] => "); @@ -249,7 +249,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop break; case IS_RESOURCE: Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG); - Z_STRSIZE_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr)); + Z_STRSIZE_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #" ZEND_INT_FMT, Z_LVAL_P(expr)); break; case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); @@ -985,7 +985,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* {{{ */ +ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC) /* {{{ */ { if (zend_message_dispatcher_p) { zend_message_dispatcher_p(message, data TSRMLS_CC); @@ -1306,7 +1306,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co zend_file_handle *file_handle; zend_op_array *orig_op_array = EG(active_op_array); zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); - long orig_interactive = CG(interactive); + zend_int_t orig_interactive = CG(interactive); va_start(files, file_count); for (i = 0; i < file_count; i++) { diff --git a/Zend/zend.h b/Zend/zend.h index 69dcf51..01db626 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -544,7 +544,7 @@ typedef struct _zend_utility_functions { zend_str_size_int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); zend_str_size_int (*write_function)(const char *str, zend_str_size_uint str_length); FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); - void (*message_handler)(long message, const void *data TSRMLS_DC); + void (*message_handler)(zend_int_t message, const void *data TSRMLS_DC); void (*block_interruptions)(void); void (*unblock_interruptions)(void); int (*get_configuration_directive)(const char *name, zend_str_size_uint name_length, zval *contents); @@ -727,7 +727,7 @@ END_EXTERN_C() #endif BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC); +ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC); ZEND_API int zend_get_configuration_directive(const char *name, zend_str_size_uint name_length, zval *contents); END_EXTERN_C() diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f25461b..f1f297b 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -1231,9 +1231,9 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) } #if ZEND_DEBUG -static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) +static zend_int_t zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) { - long leaks = 0; + zend_int_t leaks = 0; zend_mm_block *p, *q; p = ZEND_MM_NEXT_BLOCK(b); @@ -1291,7 +1291,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC) } if (!ZEND_MM_IS_FREE_BLOCK(p)) { if (p->magic == MEM_BLOCK_VALID) { - long repeated; + zend_int_t repeated; zend_leak_info leak; ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index c86b27a..791a53f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -413,9 +413,9 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z TRACE_APPEND_STR("Resource id #"); /* break; */ case IS_LONG: { - long lval = Z_LVAL_PP(arg); + zend_int_t lval = Z_LVAL_PP(arg); char s_tmp[MAX_LENGTH_OF_LONG + 1]; - zend_str_size l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ + zend_str_size l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); break; @@ -464,7 +464,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg { char *s_tmp, **str; zend_str_size *len, *num; - long line; + zend_int_t line; HashTable *ht = Z_ARRVAL_PP(frame); zval **file, **tmp; @@ -478,7 +478,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg num = va_arg(args, zend_str_size*); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1); - sprintf(s_tmp, "#%d ", (*num)++); + sprintf(s_tmp, "#" ZEND_INT_FMT " ", (*num)++); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) { @@ -497,7 +497,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg line = 0; } s_tmp = emalloc(Z_STRSIZE_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1); - sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line); + sprintf(s_tmp, "%s(" ZEND_INT_FMT "): ", Z_STRVAL_PP(file), line); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); } @@ -541,7 +541,7 @@ ZEND_METHOD(exception, getTraceAsString) zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1); - sprintf(s_tmp, "#%d {main}", num); + sprintf(s_tmp, "#" ZEND_INT_FMT " {main}", num); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); @@ -734,7 +734,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */ +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code TSRMLS_DC) /* {{{ */ { zval *ex; @@ -762,7 +762,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char } /* }}} */ -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */ +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_int_t code TSRMLS_DC, const char *format, ...) /* {{{ */ { va_list arg; char *message; @@ -777,7 +777,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod } /* }}} */ -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */ +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code, int severity TSRMLS_DC) /* {{{ */ { zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC); zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index b135131..e85c05f 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -40,12 +40,12 @@ ZEND_API void zend_register_default_classes(TSRMLS_D); /* exception_ce NULL or zend_exception_get_default() or a derived class * message NULL or the message of the exception */ -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC); -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...); +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code TSRMLS_DC); +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_int_t code TSRMLS_DC, const char *format, ...); ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC); ZEND_API void zend_clear_exception(TSRMLS_D); -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC); +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code, int severity TSRMLS_DC); extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 1fb8e92..be6e1be 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -355,7 +355,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D); ZEND_API zend_str_size_uint zend_get_executed_lineno(TSRMLS_D); ZEND_API zend_bool zend_is_executing(TSRMLS_D); -ZEND_API void zend_set_timeout(long seconds, int reset_signals); +ZEND_API void zend_set_timeout(zend_int_t seconds, int reset_signals); ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint class_name_len, int fetch_type TSRMLS_DC); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a5de29c..0cc05e8 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1447,7 +1447,7 @@ void zend_shutdown_timeout_thread(void) /* {{{ */ #define SIGPROF 27 #endif -void zend_set_timeout(long seconds, int reset_signals) /* {{{ */ +void zend_set_timeout(zend_int_t seconds, int reset_signals) /* {{{ */ { TSRMLS_FETCH(); diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index bc12565..60c24fd 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -51,7 +51,7 @@ typedef struct _zend_generator { /* Variable to put sent value into */ temp_variable *send_target; /* Largest used integer key for auto-incrementing keys */ - long largest_used_integer_key; + zend_int_t largest_used_integer_key; /* ZEND_GENERATOR_* flags */ zend_uchar flags; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index b9a5b39..493cdbb 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -111,7 +111,7 @@ struct _zend_compiler_globals { zend_llist open_files; - long catch_begin; + zend_int_t catch_begin; struct _zend_ini_parser_param *ini_parser_param; @@ -181,8 +181,8 @@ struct _zend_executor_globals { JMP_BUF *bailout; - int error_reporting; - int orig_error_reporting; + zend_int_t error_reporting; + zend_int_t orig_error_reporting; int exit_status; zend_op_array *active_op_array; @@ -196,7 +196,7 @@ struct _zend_executor_globals { zval *This; - long precision; + zend_int_t precision; int ticks_count; @@ -229,7 +229,7 @@ struct _zend_executor_globals { zend_class_entry *exception_class; /* timeout support */ - int timeout_seconds; + zend_int_t timeout_seconds; int lambda_count; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index bd33fc0..2ce466e 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -927,7 +927,7 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { case TYPE_PAIR(IS_LONG, IS_LONG): { - long overflow; + zend_int_t overflow; ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 2fb0c7f..7b11445 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -774,7 +774,7 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { - long overflow; + zend_int_t overflow; ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow); Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index ff181e5..1fe6f1d 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -582,9 +582,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */ /* }}} */ #ifdef PHP_WIN32 -static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ +static inline zend_uint_t realpath_cache_key(const char *path, zend_str_size_int path_len TSRMLS_DC) /* {{{ */ { - register unsigned long h; + register zend_uint_t h; char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); char *bucket_key = (char *)bucket_key_start; const char *e = bucket_key + strlen(bucket_key); @@ -602,9 +602,9 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TS } /* }}} */ #else -static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */ +static inline zend_uint_t realpath_cache_key(const char *path, zend_str_size_int path_len) /* {{{ */ { - register unsigned long h; + register zend_uint_t h; const char *e = path + path_len; for (h = 2166136261U; path < e;) { @@ -634,14 +634,14 @@ CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */ } /* }}} */ -CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */ +CWD_API void realpath_cache_del(const char *path, zend_str_size_int path_len TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 - unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); + zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC); #else - unsigned long key = realpath_cache_key(path, path_len); + zend_uint_t key = realpath_cache_key(path, path_len); #endif - unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { @@ -666,9 +666,9 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ } /* }}} */ -static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */ +static inline void realpath_cache_add(const char *path, zend_str_size_int path_len, const char *realpath, zend_str_size_int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */ { - long size = sizeof(realpath_cache_bucket) + path_len + 1; + zend_int_t size = sizeof(realpath_cache_bucket) + path_len + 1; int same = 1; if (realpath_len != path_len || @@ -679,7 +679,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) { realpath_cache_bucket *bucket = malloc(size); - unsigned long n; + zend_uint_t n; if (bucket == NULL) { return; @@ -716,15 +716,15 @@ static inline void realpath_cache_add(const char *path, int path_len, const char } /* }}} */ -static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */ +static inline realpath_cache_bucket* realpath_cache_find(const char *path, zend_str_size_int path_len, time_t t TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 - unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); + zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC); #else - unsigned long key = realpath_cache_key(path, path_len); + zend_uint_t key = realpath_cache_key(path, path_len); #endif - unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { @@ -756,12 +756,12 @@ CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_ } /* }}} */ -CWD_API int realpath_cache_size(TSRMLS_D) +CWD_API zend_int_t realpath_cache_size(TSRMLS_D) { return CWDG(realpath_cache_size); } -CWD_API int realpath_cache_max_buckets(TSRMLS_D) +CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D) { return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); } diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 2a70660..03e83e4 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -211,7 +211,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC); #define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */ typedef struct _realpath_cache_bucket { - unsigned long key; + zend_uint_t key; char *path; int path_len; char *realpath; @@ -229,9 +229,9 @@ typedef struct _realpath_cache_bucket { typedef struct _virtual_cwd_globals { cwd_state cwd; - long realpath_cache_size; - long realpath_cache_size_limit; - long realpath_cache_ttl; + zend_int_t realpath_cache_size; + zend_int_t realpath_cache_size_limit; + zend_int_t realpath_cache_ttl; realpath_cache_bucket *realpath_cache[1024]; } virtual_cwd_globals; @@ -244,10 +244,10 @@ extern virtual_cwd_globals cwd_globals; #endif CWD_API void realpath_cache_clean(TSRMLS_D); -CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC); -CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC); -CWD_API int realpath_cache_size(TSRMLS_D); -CWD_API int realpath_cache_max_buckets(TSRMLS_D); +CWD_API void realpath_cache_del(const char *path, zend_str_size_int path_len TSRMLS_DC); +CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, zend_str_size_int path_len, time_t t TSRMLS_DC); +CWD_API zend_int_t realpath_cache_size(TSRMLS_D); +CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D); CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D); /* The actual macros to be used in programs using TSRM
diff --git a/Zend/zend.c b/Zend/zend.c index 8f9c4a3..13dec8a 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -64,7 +64,7 @@ ZEND_API char *(*zend_resolve_path)(const char *filename, zend_str_size_int file void (*zend_on_timeout)(int seconds TSRMLS_DC); -static void (*zend_message_dispatcher_p)(long message, const void *data TSRMLS_DC); +static void (*zend_message_dispatcher_p)(zend_int_t message, const void *data TSRMLS_DC); static int (*zend_get_configuration_directive_p)(const char *name, zend_str_size_uint name_length, zval *contents); static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ @@ -179,7 +179,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, case HASH_KEY_IS_LONG: { char key[25]; - snprintf(key, sizeof(key), "%ld", num_key); + snprintf(key, sizeof(key), ZEND_INT_FMT, num_key); ZEND_PUTS_EX(key); } break; @@ -217,7 +217,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */ ZEND_PUTS(string_key); break; case HASH_KEY_IS_LONG: - zend_printf("%ld", num_key); + zend_printf(ZEND_INT_FMT, num_key); break; } ZEND_PUTS("] => "); @@ -249,7 +249,7 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop break; case IS_RESOURCE: Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG); - Z_STRSIZE_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr)); + Z_STRSIZE_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #" ZEND_INT_FMT, Z_LVAL_P(expr)); break; case IS_ARRAY: zend_error(E_NOTICE, "Array to string conversion"); @@ -985,7 +985,7 @@ ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* {{{ */ +ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC) /* {{{ */ { if (zend_message_dispatcher_p) { zend_message_dispatcher_p(message, data TSRMLS_CC); @@ -1306,7 +1306,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co zend_file_handle *file_handle; zend_op_array *orig_op_array = EG(active_op_array); zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); - long orig_interactive = CG(interactive); + zend_int_t orig_interactive = CG(interactive); va_start(files, file_count); for (i = 0; i < file_count; i++) { diff --git a/Zend/zend.h b/Zend/zend.h index 69dcf51..01db626 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -544,7 +544,7 @@ typedef struct _zend_utility_functions { zend_str_size_int (*printf_function)(const char *format, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); zend_str_size_int (*write_function)(const char *str, zend_str_size_uint str_length); FILE *(*fopen_function)(const char *filename, char **opened_path TSRMLS_DC); - void (*message_handler)(long message, const void *data TSRMLS_DC); + void (*message_handler)(zend_int_t message, const void *data TSRMLS_DC); void (*block_interruptions)(void); void (*unblock_interruptions)(void); int (*get_configuration_directive)(const char *name, zend_str_size_uint name_length, zval *contents); @@ -727,7 +727,7 @@ END_EXTERN_C() #endif BEGIN_EXTERN_C() -ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC); +ZEND_API void zend_message_dispatcher(zend_int_t message, const void *data TSRMLS_DC); ZEND_API int zend_get_configuration_directive(const char *name, zend_str_size_uint name_length, zval *contents); END_EXTERN_C() diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f25461b..f1f297b 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -1231,9 +1231,9 @@ ZEND_API zend_mm_heap *zend_mm_startup(void) } #if ZEND_DEBUG -static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) +static zend_int_t zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b) { - long leaks = 0; + zend_int_t leaks = 0; zend_mm_block *p, *q; p = ZEND_MM_NEXT_BLOCK(b); @@ -1291,7 +1291,7 @@ static void zend_mm_check_leaks(zend_mm_heap *heap TSRMLS_DC) } if (!ZEND_MM_IS_FREE_BLOCK(p)) { if (p->magic == MEM_BLOCK_VALID) { - long repeated; + zend_int_t repeated; zend_leak_info leak; ZEND_MM_SET_MAGIC(p, MEM_BLOCK_LEAK); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index c86b27a..791a53f 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -413,9 +413,9 @@ static int _build_trace_args(zval **arg TSRMLS_DC, int num_args, va_list args, z TRACE_APPEND_STR("Resource id #"); /* break; */ case IS_LONG: { - long lval = Z_LVAL_PP(arg); + zend_int_t lval = Z_LVAL_PP(arg); char s_tmp[MAX_LENGTH_OF_LONG + 1]; - zend_str_size l_tmp = zend_sprintf(s_tmp, "%ld", lval); /* SAFE */ + zend_str_size l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */ TRACE_APPEND_STRL(s_tmp, l_tmp); TRACE_APPEND_STR(", "); break; @@ -464,7 +464,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg { char *s_tmp, **str; zend_str_size *len, *num; - long line; + zend_int_t line; HashTable *ht = Z_ARRVAL_PP(frame); zval **file, **tmp; @@ -478,7 +478,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg num = va_arg(args, zend_str_size*); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1); - sprintf(s_tmp, "#%d ", (*num)++); + sprintf(s_tmp, "#" ZEND_INT_FMT " ", (*num)++); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); if (zend_hash_find(ht, "file", sizeof("file"), (void**)&file) == SUCCESS) { @@ -497,7 +497,7 @@ static int _build_trace_string(zval **frame TSRMLS_DC, int num_args, va_list arg line = 0; } s_tmp = emalloc(Z_STRSIZE_PP(file) + MAX_LENGTH_OF_LONG + 4 + 1); - sprintf(s_tmp, "%s(%ld): ", Z_STRVAL_PP(file), line); + sprintf(s_tmp, "%s(" ZEND_INT_FMT "): ", Z_STRVAL_PP(file), line); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); } @@ -541,7 +541,7 @@ ZEND_METHOD(exception, getTraceAsString) zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num); s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1); - sprintf(s_tmp, "#%d {main}", num); + sprintf(s_tmp, "#" ZEND_INT_FMT " {main}", num); TRACE_APPEND_STRL(s_tmp, strlen(s_tmp)); efree(s_tmp); @@ -734,7 +734,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(TSRMLS_D) /* {{{ */ } /* }}} */ -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC) /* {{{ */ +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code TSRMLS_DC) /* {{{ */ { zval *ex; @@ -762,7 +762,7 @@ ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char } /* }}} */ -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...) /* {{{ */ +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_int_t code TSRMLS_DC, const char *format, ...) /* {{{ */ { va_list arg; char *message; @@ -777,7 +777,7 @@ ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long cod } /* }}} */ -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC) /* {{{ */ +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code, int severity TSRMLS_DC) /* {{{ */ { zval *ex = zend_throw_exception(exception_ce, message, code TSRMLS_CC); zend_update_property_long(default_exception_ce, ex, "severity", sizeof("severity")-1, severity TSRMLS_CC); diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index b135131..e85c05f 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -40,12 +40,12 @@ ZEND_API void zend_register_default_classes(TSRMLS_D); /* exception_ce NULL or zend_exception_get_default() or a derived class * message NULL or the message of the exception */ -ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, long code TSRMLS_DC); -ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *format, ...); +ZEND_API zval * zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code TSRMLS_DC); +ZEND_API zval * zend_throw_exception_ex(zend_class_entry *exception_ce, zend_int_t code TSRMLS_DC, const char *format, ...); ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC); ZEND_API void zend_clear_exception(TSRMLS_D); -ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, long code, int severity TSRMLS_DC); +ZEND_API zval * zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_int_t code, int severity TSRMLS_DC); extern ZEND_API void (*zend_throw_exception_hook)(zval *ex TSRMLS_DC); diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 1fb8e92..be6e1be 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -355,7 +355,7 @@ ZEND_API const char *zend_get_executed_filename(TSRMLS_D); ZEND_API zend_str_size_uint zend_get_executed_lineno(TSRMLS_D); ZEND_API zend_bool zend_is_executing(TSRMLS_D); -ZEND_API void zend_set_timeout(long seconds, int reset_signals); +ZEND_API void zend_set_timeout(zend_int_t seconds, int reset_signals); ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, zend_str_size_uint class_name_len, int fetch_type TSRMLS_DC); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a5de29c..0cc05e8 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1447,7 +1447,7 @@ void zend_shutdown_timeout_thread(void) /* {{{ */ #define SIGPROF 27 #endif -void zend_set_timeout(long seconds, int reset_signals) /* {{{ */ +void zend_set_timeout(zend_int_t seconds, int reset_signals) /* {{{ */ { TSRMLS_FETCH(); diff --git a/Zend/zend_generators.h b/Zend/zend_generators.h index bc12565..60c24fd 100644 --- a/Zend/zend_generators.h +++ b/Zend/zend_generators.h @@ -51,7 +51,7 @@ typedef struct _zend_generator { /* Variable to put sent value into */ temp_variable *send_target; /* Largest used integer key for auto-incrementing keys */ - long largest_used_integer_key; + zend_int_t largest_used_integer_key; /* ZEND_GENERATOR_* flags */ zend_uchar flags; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index b9a5b39..493cdbb 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -111,7 +111,7 @@ struct _zend_compiler_globals { zend_llist open_files; - long catch_begin; + zend_int_t catch_begin; struct _zend_ini_parser_param *ini_parser_param; @@ -181,8 +181,8 @@ struct _zend_executor_globals { JMP_BUF *bailout; - int error_reporting; - int orig_error_reporting; + zend_int_t error_reporting; + zend_int_t orig_error_reporting; int exit_status; zend_op_array *active_op_array; @@ -196,7 +196,7 @@ struct _zend_executor_globals { zval *This; - long precision; + zend_int_t precision; int ticks_count; @@ -229,7 +229,7 @@ struct _zend_executor_globals { zend_class_entry *exception_class; /* timeout support */ - int timeout_seconds; + zend_int_t timeout_seconds; int lambda_count; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index bd33fc0..2ce466e 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -927,7 +927,7 @@ ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ * while (1) { switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) { case TYPE_PAIR(IS_LONG, IS_LONG): { - long overflow; + zend_int_t overflow; ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), Z_LVAL_P(result),Z_DVAL_P(result),overflow); Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 2fb0c7f..7b11445 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -774,7 +774,7 @@ static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *o { if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) { if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) { - long overflow; + zend_int_t overflow; ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow); Z_TYPE_P(result) = overflow ? IS_DOUBLE : IS_LONG; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index ff181e5..1fe6f1d 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -582,9 +582,9 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC) /* {{{ */ /* }}} */ #ifdef PHP_WIN32 -static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ +static inline zend_uint_t realpath_cache_key(const char *path, zend_str_size_int path_len TSRMLS_DC) /* {{{ */ { - register unsigned long h; + register zend_uint_t h; char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); char *bucket_key = (char *)bucket_key_start; const char *e = bucket_key + strlen(bucket_key); @@ -602,9 +602,9 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TS } /* }}} */ #else -static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */ +static inline zend_uint_t realpath_cache_key(const char *path, zend_str_size_int path_len) /* {{{ */ { - register unsigned long h; + register zend_uint_t h; const char *e = path + path_len; for (h = 2166136261U; path < e;) { @@ -634,14 +634,14 @@ CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */ } /* }}} */ -CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ */ +CWD_API void realpath_cache_del(const char *path, zend_str_size_int path_len TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 - unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); + zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC); #else - unsigned long key = realpath_cache_key(path, path_len); + zend_uint_t key = realpath_cache_key(path, path_len); #endif - unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { @@ -666,9 +666,9 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{ } /* }}} */ -static inline void realpath_cache_add(const char *path, int path_len, const char *realpath, int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */ +static inline void realpath_cache_add(const char *path, zend_str_size_int path_len, const char *realpath, zend_str_size_int realpath_len, int is_dir, time_t t TSRMLS_DC) /* {{{ */ { - long size = sizeof(realpath_cache_bucket) + path_len + 1; + zend_int_t size = sizeof(realpath_cache_bucket) + path_len + 1; int same = 1; if (realpath_len != path_len || @@ -679,7 +679,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char if (CWDG(realpath_cache_size) + size <= CWDG(realpath_cache_size_limit)) { realpath_cache_bucket *bucket = malloc(size); - unsigned long n; + zend_uint_t n; if (bucket == NULL) { return; @@ -716,15 +716,15 @@ static inline void realpath_cache_add(const char *path, int path_len, const char } /* }}} */ -static inline realpath_cache_bucket* realpath_cache_find(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */ +static inline realpath_cache_bucket* realpath_cache_find(const char *path, zend_str_size_int path_len, time_t t TSRMLS_DC) /* {{{ */ { #ifdef PHP_WIN32 - unsigned long key = realpath_cache_key(path, path_len TSRMLS_CC); + zend_uint_t key = realpath_cache_key(path, path_len TSRMLS_CC); #else - unsigned long key = realpath_cache_key(path, path_len); + zend_uint_t key = realpath_cache_key(path, path_len); #endif - unsigned long n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); + zend_uint_t n = key % (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); realpath_cache_bucket **bucket = &CWDG(realpath_cache)[n]; while (*bucket != NULL) { @@ -756,12 +756,12 @@ CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_ } /* }}} */ -CWD_API int realpath_cache_size(TSRMLS_D) +CWD_API zend_int_t realpath_cache_size(TSRMLS_D) { return CWDG(realpath_cache_size); } -CWD_API int realpath_cache_max_buckets(TSRMLS_D) +CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D) { return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0])); } diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 2a70660..03e83e4 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -211,7 +211,7 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC); #define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */ typedef struct _realpath_cache_bucket { - unsigned long key; + zend_uint_t key; char *path; int path_len; char *realpath; @@ -229,9 +229,9 @@ typedef struct _realpath_cache_bucket { typedef struct _virtual_cwd_globals { cwd_state cwd; - long realpath_cache_size; - long realpath_cache_size_limit; - long realpath_cache_ttl; + zend_int_t realpath_cache_size; + zend_int_t realpath_cache_size_limit; + zend_int_t realpath_cache_ttl; realpath_cache_bucket *realpath_cache[1024]; } virtual_cwd_globals; @@ -244,10 +244,10 @@ extern virtual_cwd_globals cwd_globals; #endif CWD_API void realpath_cache_clean(TSRMLS_D); -CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC); -CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC); -CWD_API int realpath_cache_size(TSRMLS_D); -CWD_API int realpath_cache_max_buckets(TSRMLS_D); +CWD_API void realpath_cache_del(const char *path, zend_str_size_int path_len TSRMLS_DC); +CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, zend_str_size_int path_len, time_t t TSRMLS_DC); +CWD_API zend_int_t realpath_cache_size(TSRMLS_D); +CWD_API zend_int_t realpath_cache_max_buckets(TSRMLS_D); CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D); /* The actual macros to be used in programs using TSRM