com php-src: Replace json.precision with serialize_precision : ext/json/json.c ext/json/json_encoder.c ext/jso n/php_json.h
| From: | Jakub Zelenka | Date: | Sun, 26 Jun 2016 12:26:43 +0000 |
| Subject: | com php-src: Replace json.precision with serialize_precision : ext/json/json.c ext/json/json_encoder.c ext/jso n/php_json.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92669@lists.php.net to get a copy of this message | ||
Commit: 75b86a2c22a5484c34acbbaa47520a05b3a6f5f0
Author: Jakub Zelenka <bukka@php.net> Thu, 23 Jun 2016 20:13:49 +0100
Parents: 3043be37160961faf6985c242684892ee745b713
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=75b86a2c22a5484c34acbbaa47520a05b3a6f5f0
Log:
Replace json.precision with serialize_precision
Changed paths:
M ext/json/json.c
M ext/json/json_encoder.c
M ext/json/php_json.h
Diff:
diff --git a/ext/json/json..c b/ext/json/json.c
index 0cfffe8..d3c6111 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -93,31 +93,6 @@ static const zend_function_entry json_serializable_interface[] = {
};
/* }}} */
-
-/* {{{ PHP_INI_MH
- */
-static PHP_INI_MH(OnSetJsonPrecision)
-{
- zend_long i;
-
- ZEND_ATOL(i, ZSTR_VAL(new_value));
- if (i >= -1) {
- JSON_G(precision) = i;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-/* }}} */
-
-
-/* {{{ PHP_INI
- */
-PHP_INI_BEGIN()
-STD_PHP_INI_ENTRY("json.precision", "-1", PHP_INI_ALL, OnSetJsonPrecision,
precision, zend_json_globals, json_globals)
-PHP_INI_END()
-/* }}} */
-
/* Register constant for options and errors */
#define PHP_JSON_REGISTER_CONSTANT(_name, _value) \
REGISTER_LONG_CONSTANT(_name, _value, CONST_CS | CONST_PERSISTENT);
@@ -127,8 +102,6 @@ static PHP_MINIT_FUNCTION(json)
{
zend_class_entry ce;
- REGISTER_INI_ENTRIES();
-
INIT_CLASS_ENTRY(ce, "JsonSerializable", json_serializable_interface);
php_json_serializable_ce = zend_register_internal_interface(&ce);
@@ -180,16 +153,6 @@ static PHP_GINIT_FUNCTION(json)
}
/* }}} */
-/* {{{ PHP_MSHUTDOWN_FUNCTION
-*/
-static PHP_MSHUTDOWN_FUNCTION(json)
-{
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
/* {{{ json_module_entry
*/
@@ -198,7 +161,7 @@ zend_module_entry json_module_entry = {
"json",
json_functions,
PHP_MINIT(json),
- PHP_MSHUTDOWN(json),
+ NULL,
NULL,
NULL,
PHP_MINFO(json),
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c
index 48d082a..7720393 100644
--- a/ext/json/json_encoder.c
+++ b/ext/json/json_encoder.c
@@ -105,7 +105,7 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)
size_t len;
char num[PHP_JSON_DOUBLE_MAX_LENGTH];
- php_gcvt(d, (int)JSON_G(precision), '.', 'e', num);
+ php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
len = strlen(num);
if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL
&& len < PHP_JSON_DOUBLE_MAX_LENGTH - 2) {
num[len++] = '.';
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index 2bf1c68..d1fabd1 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -81,7 +81,6 @@ typedef enum {
#define PHP_JSON_PARSER_DEFAULT_DEPTH 512
ZEND_BEGIN_MODULE_GLOBALS(json)
- zend_long precision;
int encoder_depth;
int encode_max_depth;
php_json_error_code error_code;