com php-src: Fix ext/standard build with the recent fixes to array.c: ext/standard/array.c ext/standard/php_math.h
| From: | Kalle Sommer Nielsen | Date: | Sat, 30 Jul 2016 15:52:57 +0000 |
| Subject: | com php-src: Fix ext/standard build with the recent fixes to array.c: ext/standard/array.c ext/standard/php_math.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93495@lists.php.net to get a copy of this message | ||
Commit: 040331c36462eac94308bbef3200ee11389ca444
Author: Kalle Sommer Nielsen <kalle@php.net> Sat, 30 Jul 2016 17:52:57 +0200
Parents: c192bdecd5e0effd57224743d16caa66e863dd95
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=040331c36462eac94308bbef3200ee11389ca444
Log:
Fix ext/standard build with the recent fixes to array.c
This solution might not be canon, but it works by re-using _php_math_round() from math.c, since
round() is not available
in the C++98 Standard Library on Windows at least. At the same
time it seems like the symbol export for it was missing from
php_math.h.
Changed paths:
M ext/standard/array.c
M ext/standard/php_math.h
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 38e275a..9bc17acf 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -45,6 +45,7 @@
#include "basic_functions.h"
#include "php_string.h"
#include "php_rand.h"
+#include "php_math.h"
#include "zend_smart_str.h"
#include "zend_bitset.h"
#include "ext/spl/spl_array.h"
@@ -2141,7 +2142,7 @@ PHP_FUNCTION(array_fill_keys)
php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size:
start=%0.0f end=%0.0f", end, start); \
RETURN_FALSE; \
} \
- size = (uint32_t)round(__calc_size); \
+ size = (uint32_t)_php_math_round(__calc_size, 0, PHP_ROUND_HALF_UP); \
array_init_size(return_value, size); \
zend_hash_real_init(Z_ARRVAL_P(return_value), 1); \
} while (0)
@@ -5060,6 +5061,7 @@ PHP_FUNCTION(array_rand)
zend_bitset bitset;
int negative_bitset = 0;
uint32_t bitset_len;
+ ALLOCA_FLAG(use_heap)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|l", &input, &num_req) == FAILURE)
{
return;
@@ -5113,7 +5115,6 @@ PHP_FUNCTION(array_rand)
num_req = num_avail - num_req;
}
- ALLOCA_FLAG(use_heap);
bitset_len = zend_bitset_len(num_avail);
bitset = ZEND_BITSET_ALLOCA(bitset_len, use_heap);
zend_bitset_clear(bitset, bitset_len);
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
index 406fd49..62c089b 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.h
@@ -22,6 +22,7 @@
#ifndef PHP_MATH_H
#define PHP_MATH_H
+PHPAPI double _php_math_round(double, int, int);
PHPAPI zend_string *_php_math_number_format(double, int, char, char);
PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t);
PHPAPI zend_string * _php_math_longtobase(zval *arg, int base);