Skip to content

Commit

Permalink
master renames phase 3
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Aug 25, 2014
1 parent 6f9f0bf commit 4d997f6
Show file tree
Hide file tree
Showing 131 changed files with 635 additions and 643 deletions.
6 changes: 3 additions & 3 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent,
}
} else {
char key[25];
snprintf(key, sizeof(key), ZEND_INT_FMT, num_key);
snprintf(key, sizeof(key), ZEND_LONG_FMT, num_key);
ZEND_PUTS_EX(key);
}
ZEND_PUTS_EX("] => ");
Expand Down Expand Up @@ -204,7 +204,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
if (string_key) {
ZEND_WRITE(string_key->val, string_key->len);
} else {
zend_printf(ZEND_UINT_FMT, num_key);
zend_printf(ZEND_ULONG_FMT, num_key);
}
ZEND_PUTS("] => ");
zend_print_flat_zval_r(tmp TSRMLS_CC);
Expand Down Expand Up @@ -235,7 +235,7 @@ ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy TSRMLS_DC) /*
char buf[sizeof("Resource id #") + MAX_LENGTH_OF_LONG];
int len;

len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_INT_FMT, Z_RES_HANDLE_P(expr));
len = snprintf(buf, sizeof(buf), "Resource id #" ZEND_LONG_FMT, Z_RES_HANDLE_P(expr));
ZVAL_NEW_STR(expr_copy, zend_string_init(buf, len, 0));
}
break;
Expand Down
18 changes: 9 additions & 9 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,11 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
return "long";
} else if (type == IS_DOUBLE) {
if (c == 'L') {
if (d > ZEND_INT_MAX) {
*p = ZEND_INT_MAX;
if (d > ZEND_LONG_MAX) {
*p = ZEND_LONG_MAX;
break;
} else if (d < ZEND_INT_MIN) {
*p = ZEND_INT_MIN;
} else if (d < ZEND_LONG_MIN) {
*p = ZEND_LONG_MIN;
break;
}
}
Expand All @@ -446,11 +446,11 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons

case IS_DOUBLE:
if (c == 'L') {
if (Z_DVAL_P(arg) > ZEND_INT_MAX) {
*p = ZEND_INT_MAX;
if (Z_DVAL_P(arg) > ZEND_LONG_MAX) {
*p = ZEND_LONG_MAX;
break;
} else if (Z_DVAL_P(arg) < ZEND_INT_MIN) {
*p = ZEND_INT_MIN;
} else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) {
*p = ZEND_LONG_MIN;
break;
}
}
Expand Down Expand Up @@ -1686,7 +1686,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value TSRMLS_DC)
result = zend_symtable_update(ht, STR_EMPTY_ALLOC(), value);
break;
case IS_RESOURCE:
zend_error(E_STRICT, "Resource ID#" ZEND_INT_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
zend_error(E_STRICT, "Resource ID#" ZEND_LONG_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value);
break;
case IS_FALSE:
Expand Down
16 changes: 8 additions & 8 deletions Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -1081,10 +1081,10 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
*dest = Z_LVAL_P(arg);
} else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_INT_MAX)) {
*dest = ZEND_INT_MAX;
} else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_INT_MIN)) {
*dest = ZEND_INT_MIN;
if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) {
*dest = ZEND_LONG_MAX;
} else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) {
*dest = ZEND_LONG_MIN;
} else {
*dest = zend_dval_to_lval(Z_DVAL_P(arg));
}
Expand All @@ -1094,10 +1094,10 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo

if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
if (EXPECTED(type != 0)) {
if (strict && UNEXPECTED(d > ZEND_INT_MAX)) {
*dest = ZEND_INT_MAX;
} else if (strict && UNEXPECTED(d < ZEND_INT_MIN)) {
*dest = ZEND_INT_MIN;
if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) {
*dest = ZEND_LONG_MAX;
} else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) {
*dest = ZEND_LONG_MIN;
} else {
*dest = zend_dval_to_lval(d);
}
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,9 +1984,9 @@ static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
#endif
HANDLE_UNBLOCK_INTERRUPTIONS();
#if ZEND_DEBUG
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
#else
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size);
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, size);
#endif
}

Expand Down Expand Up @@ -2297,9 +2297,9 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
#endif
HANDLE_UNBLOCK_INTERRUPTIONS();
#if ZEND_DEBUG
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted at %s:%d (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, __zend_filename, __zend_lineno, size);
#else
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_UINT_FMT " bytes exhausted (tried to allocate " ZEND_UINT_FMT " bytes)", heap->limit, size);
zend_mm_safe_error(heap, "Allowed memory size of " ZEND_ULONG_FMT " bytes exhausted (tried to allocate " ZEND_ULONG_FMT " bytes)", heap->limit, size);
#endif
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_builtin_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ ZEND_FUNCTION(func_get_arg)
arg_count = ex->num_args;

if (requested_offset >= arg_count) {
zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_INT_FMT " not passed to function", requested_offset);
zend_error(E_WARNING, "func_get_arg(): Argument " ZEND_LONG_FMT " not passed to function", requested_offset);
RETURN_FALSE;
}

Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{
case IS_RESOURCE: {
zend_long lval = Z_RES_HANDLE_P(arg);
char s_tmp[MAX_LENGTH_OF_LONG + 1];
int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */
int l_tmp = zend_sprintf(s_tmp, ZEND_LONG_FMT, lval); /* SAFE */
TRACE_APPEND_STR("Resource id #");
TRACE_APPEND_STRL(s_tmp, l_tmp);
TRACE_APPEND_STR(", ");
Expand All @@ -470,7 +470,7 @@ static void _build_trace_args(zval *arg, zend_string **str_ptr TSRMLS_DC) /* {{{
case IS_LONG: {
zend_long lval = Z_LVAL_P(arg);
char s_tmp[MAX_LENGTH_OF_LONG + 1];
int l_tmp = zend_sprintf(s_tmp, ZEND_INT_FMT, lval); /* SAFE */
int l_tmp = zend_sprintf(s_tmp, ZEND_LONG_FMT, lval); /* SAFE */
TRACE_APPEND_STRL(s_tmp, l_tmp);
TRACE_APPEND_STR(", ");
break;
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,14 +1024,14 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
if (retval == NULL) {
switch (type) {
case BP_VAR_R:
zend_error(E_NOTICE,"Undefined offset: " ZEND_UINT_FMT, hval);
zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval);
/* break missing intentionally */
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
zend_error(E_NOTICE,"Undefined offset: " ZEND_UINT_FMT, hval);
zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval);
/* break missing intentionally */
case BP_VAR_W:
retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab
}
ZVAL_COPY_VALUE(&p->val, pData);
if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
return &p->val;
} else { /* we have to keep the order :( */
Expand Down Expand Up @@ -461,7 +461,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab
ht->nInternalPointer = h;
}
if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
p->h = h;
p->key = NULL;
Expand Down Expand Up @@ -491,7 +491,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab
ZVAL_COPY_VALUE(&p->val, pData);
HANDLE_UNBLOCK_INTERRUPTIONS();
if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
return &p->val;
}
Expand All @@ -506,7 +506,7 @@ static zend_always_inline zval *_zend_hash_index_update_or_next_insert_i(HashTab
ht->nInternalPointer = idx;
}
if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
ht->nNextFreeElement = h < ZEND_INT_MAX ? h + 1 : ZEND_INT_MAX;
ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
p = ht->arData + idx;
p->h = h;
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,11 @@ static inline int _zend_handle_numeric_str(const char *key, size_t length, zend_
++tmp;
if (tmp == end) {
if (*key == '-') {
if (*idx-1 > ZEND_INT_MAX) { /* overflow */
if (*idx-1 > ZEND_LONG_MAX) { /* overflow */
return 0;
}
*idx = 0 - *idx;
} else if (*idx > ZEND_INT_MAX) { /* overflow */
} else if (*idx > ZEND_LONG_MAX) { /* overflow */
return 0;
}
return 1;
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{
ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length);
if (ini_entry) {
if (orig && ini_entry->modified) {
return (ini_entry->orig_value ? ZEND_STRTOI(ini_entry->orig_value, NULL, 0) : 0);
return (ini_entry->orig_value ? ZEND_STRTOL(ini_entry->orig_value, NULL, 0) : 0);
} else {
return (ini_entry->value ? ZEND_STRTOI(ini_entry->value, NULL, 0) : 0);
return (ini_entry->value ? ZEND_STRTOL(ini_entry->value, NULL, 0) : 0);
}
}

Expand Down
84 changes: 42 additions & 42 deletions Zend/zend_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
/* $Id$ */


#ifndef ZEND_INT_H
#define ZEND_INT_H
#ifndef ZEND_LONG_H
#define ZEND_LONG_H

#include "main/php_stdint.h"

Expand All @@ -37,8 +37,8 @@
typedef __int64 zend_long;
typedef unsigned __int64 zend_ulong;
typedef __int64 zend_off_t;
# define ZEND_INT_MAX _I64_MAX
# define ZEND_INT_MIN _I64_MIN
# define ZEND_LONG_MAX _I64_MAX
# define ZEND_LONG_MIN _I64_MIN
# define ZEND_UINT_MAX _UI64_MAX
# define Z_I(i) i##i64
# define Z_UI(i) i##Ui64
Expand All @@ -50,8 +50,8 @@ typedef __int64 zend_off_t;
typedef int64_t zend_long;
typedef uint64_t zend_ulong;
typedef off_t zend_off_t;
# define ZEND_INT_MAX INT64_MAX
# define ZEND_INT_MIN INT64_MIN
# define ZEND_LONG_MAX INT64_MAX
# define ZEND_LONG_MIN INT64_MIN
# define ZEND_UINT_MAX UINT64_MAX
# define Z_I(i) i##LL
# define Z_UI(i) i##ULL
Expand All @@ -64,8 +64,8 @@ typedef off_t zend_off_t;
typedef long zend_long;
typedef unsigned long zend_ulong;
typedef long zend_off_t;
# define ZEND_INT_MAX LONG_MAX
# define ZEND_INT_MIN LONG_MIN
# define ZEND_LONG_MAX LONG_MAX
# define ZEND_LONG_MIN LONG_MIN
# define ZEND_UINT_MAX ULONG_MAX
# define Z_I(i) i##L
# define Z_UI(i) i##UL
Expand All @@ -74,63 +74,63 @@ typedef long zend_off_t;


/* conversion macros */
#define ZEND_ITOA_BUF_LEN 65
#define ZEND_LTOA_BUF_LEN 65

#ifdef ZEND_ENABLE_INT64
# ifdef PHP_WIN32
# define ZEND_ITOA(i, s, len) _i64toa_s((i), (s), (len), 10)
# define ZEND_ATOI(i, s) i = _atoi64((s))
# define ZEND_STRTOI(s0, s1, base) _strtoi64((s0), (s1), (base))
# define ZEND_STRTOUI(s0, s1, base) _strtoui64((s0), (s1), (base))
# define ZEND_INT_FMT "%I64d"
# define ZEND_UINT_FMT "%I64u"
# define ZEND_INT_FMT_SPEC "I64d"
# define ZEND_UINT_FMT_SPEC "I64u"
# define ZEND_STRTOI_PTR _strtoi64
# define ZEND_STRTOUI_PTR _strtoui64
# define ZEND_LTOA(i, s, len) _i64toa_s((i), (s), (len), 10)
# define ZEND_ATOL(i, s) i = _atoi64((s))
# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base))
# define ZEND_STRTOUL(s0, s1, base) _strtoui64((s0), (s1), (base))
# define ZEND_LONG_FMT "%I64d"
# define ZEND_ULONG_FMT "%I64u"
# define ZEND_LONG_FMT_SPEC "I64d"
# define ZEND_ULONG_FMT_SPEC "I64u"
# define ZEND_STRTOL_PTR _strtoi64
# define ZEND_STRTOUL_PTR _strtoui64
# define ZEND_ABS _abs64
# else
# define ZEND_ITOA(i, s, len) \
# define ZEND_LTOA(i, s, len) \
do { \
int st = snprintf((s), (len), "%lld", (i)); \
(s)[st] = '\0'; \
} while (0)
# define ZEND_ATOI(i, s) (i) = atoll((s))
# define ZEND_STRTOI(s0, s1, base) strtoll((s0), (s1), (base))
# define ZEND_STRTOUI(s0, s1, base) strtoull((s0), (s1), (base))
# define ZEND_INT_FMT "%" PRId64
# define ZEND_UINT_FMT "%" PRIu64
# define ZEND_INT_FMT_SPEC PRId64
# define ZEND_UINT_FMT_SPEC PRIu64
# define ZEND_STRTOI_PTR strtoll
# define ZEND_STRTOUI_PTR strtoull
# define ZEND_ATOL(i, s) (i) = atoll((s))
# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base))
# define ZEND_STRTOUL(s0, s1, base) strtoull((s0), (s1), (base))
# define ZEND_LONG_FMT "%" PRId64
# define ZEND_ULONG_FMT "%" PRIu64
# define ZEND_LONG_FMT_SPEC PRId64
# define ZEND_ULONG_FMT_SPEC PRIu64
# define ZEND_STRTOL_PTR strtoll
# define ZEND_STRTOUL_PTR strtoull
# define ZEND_ABS llabs
# endif
#else
# define ZEND_STRTOI(s0, s1, base) strtol((s0), (s1), (base))
# define ZEND_STRTOUI(s0, s1, base) strtoul((s0), (s1), (base))
# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base))
# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base))
# ifdef PHP_WIN32
# define ZEND_ITOA(i, s, len) _ltoa_s((i), (s), (len), 10)
# define ZEND_ATOI(i, s) i = atol((s))
# define ZEND_LTOA(i, s, len) _ltoa_s((i), (s), (len), 10)
# define ZEND_ATOL(i, s) i = atol((s))
# else
# define ZEND_ITOA(i, s, len) \
# define ZEND_LTOA(i, s, len) \
do { \
int st = snprintf((s), (len), "%ld", (i)); \
(s)[st] = '\0'; \
} while (0)
# define ZEND_ATOI(i, s) (i) = atol((s))
# define ZEND_ATOL(i, s) (i) = atol((s))
# endif
# define ZEND_INT_FMT "%ld"
# define ZEND_UINT_FMT "%lu"
# define ZEND_INT_FMT_SPEC "ld"
# define ZEND_UINT_FMT_SPEC "lu"
# define ZEND_STRTOI_PTR strtol
# define ZEND_STRTOUI_PTR strtoul
# define ZEND_LONG_FMT "%ld"
# define ZEND_ULONG_FMT "%lu"
# define ZEND_LONG_FMT_SPEC "ld"
# define ZEND_ULONG_FMT_SPEC "lu"
# define ZEND_STRTOL_PTR strtol
# define ZEND_STRTOUL_PTR strtoul
# define ZEND_ABS abs
#endif


#endif /* ZEND_INT_H */
#endif /* ZEND_LONG_H */

/*
* Local variables:
Expand Down
Loading

0 comments on commit 4d997f6

Please sign in to comment.