diff options
author | Yasuo Ohgaki <yohgaki@ohgaki.net> | 2015-08-30 17:13:24 +0900 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2016-06-26 13:26:43 +0100 |
commit | e3d9f1f4d8fc553e51881475e9dbc84c0de39e0e (patch) | |
tree | e68c5beb9b09d955eb0eff44807e00389a839702 /ext/json/json_encoder.c | |
parent | 3aa2aadcf0c39d7d22532c46d8921f443d27166f (diff) | |
download | php-git-e3d9f1f4d8fc553e51881475e9dbc84c0de39e0e.tar.gz |
Simply use ndigit for flag for zend_dtoa mode
Diffstat (limited to 'ext/json/json_encoder.c')
-rw-r--r-- | ext/json/json_encoder.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index cf9d9adaa2..b797e7da3d 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -104,11 +104,8 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options) { size_t len; char num[PHP_JSON_DOUBLE_MAX_LENGTH]; - if (JSON_G(precision) == -1) { - php_0cvt(d, 17, '.', 'e', num); - } else { - php_gcvt(d, JSON_G(precision), '.', 'e', num); - } + + php_gcvt(d, JSON_G(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++] = '.'; |