com php-src: added ZEND_INT_FMT: Zend/zend_int.h Zend/zend_operators.c ext/standard/var.c
| From: | Anatol Belski | Date: | Wed, 16 Oct 2013 10:14:12 +0000 |
| Subject: | com php-src: added ZEND_INT_FMT: Zend/zend_int.h Zend/zend_operators.c ext/standard/var.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73465@lists.php.net to get a copy of this message | ||
Commit: 889b8d75fe03fc691d45514050964966ab0b6270
Author: Anatol Belski <ab@php.net> Fri, 23 Aug 2013 03:32:35 -0700
Parents: 34818356fc3c957485a6fd94b92fdec0a3695621
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=889b8d75fe03fc691d45514050964966ab0b6270
Log:
added ZEND_INT_FMT
Changed paths:
M Zend/zend_int.h
M Zend/zend_operators.c
M ext/standard/var.c
Diff:
diff --git a/Zend/zend_int.h b/Zend/zend_int.h
index e9b3723..c2df1e7 100644
--- a/Zend/zend_int.h
+++ b/Zend/zend_int..h
@@ -46,6 +46,7 @@ typedef unsigned long zend_uint_t;
# define ZEND_ITOA(i, s, len) _i64toa_s((i), (s), (len), 10)
# define ZEND_ATOI(i, s) i = _atoi64((s))
# define ZEND_STRTOL(s0, s1, base) _strtoi64((s0), (s1), (base))
+# define ZEND_INT_FMT "%I64d"
# else
# define ZEND_ITOA(i, s, len) \
do { \
@@ -54,6 +55,7 @@ typedef unsigned long zend_uint_t;
} while (0)
# define ZEND_ATOI(i, s) (i) = atoll((s))
# define ZEND_STRTOL(s0, s1, base) strtoll((s0), (s1), (base))
+# define ZEND_INT_FMT "%lld"
# endif
#else
# define ZEND_STRTOL(s0, s1, base) strtol((s0), (s1), (base))
@@ -68,6 +70,7 @@ typedef unsigned long zend_uint_t;
} while (0)
# define ZEND_ATOI(i, s) (i) = atol((s))
# endif
+# define ZEND_INT_FMT "%ld"
#endif
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 0e3306b...daf4c8f 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -621,11 +621,7 @@ ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC) /* {{{ */
}
case IS_LONG:
lval = Z_LVAL_P(op);
-#ifdef ZEND_ENABLE_INT64
- Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%lld", lval);
-#else
- Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, "%ld", lval);
-#endif
+ Z_STRSIZE_P(op) = zend_spprintf(&Z_STRVAL_P(op), 0, ZEND_INT_FMT, lval);
break;
case IS_DOUBLE: {
TSRMLS_FETCH();
@@ -818,7 +814,7 @@ ZEND_API int add_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 lval = Z_LVAL_P(op1) + Z_LVAL_P(op2);
+ zend_int_t lval = Z_LVAL_P(op1) + Z_LVAL_P(op2);
/* check for overflow by comparing sign bits */
if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
@@ -882,7 +878,7 @@ ZEND_API int sub_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 lval = Z_LVAL_P(op1) - Z_LVAL_P(op2);
+ zend_int_t lval = Z_LVAL_P(op1) - Z_LVAL_P(op2);
/* check for overflow by comparing sign bits */
if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
diff --git a/ext/standard/var.c b/ext/standard/var.c
index c259df9..6812088 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -104,11 +104,7 @@ PHPAPI void php_var_dump(zval **struc, int level TSRMLS_DC) /* {{{ */
php_printf("%sNULL\n", COMMON);
break;
case IS_LONG:
-#ifdef ZEND_ENABLE_INT64
- php_printf("%sint(%lld)\n", COMMON, Z_LVAL_PP(struc));
-#else
- php_printf("%sint(%ld)\n", COMMON, Z_LVAL_PP(struc));
-#endif
+ php_printf("%sint(" ZEND_INT_FMT ")\n", COMMON, Z_LVAL_PP(struc));
break;
case IS_DOUBLE:
php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_PP(struc));