summaryrefslogtreecommitdiff
path: root/main/snprintf.c
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@ohgaki.net>2015-08-30 17:13:24 +0900
committerJakub Zelenka <bukka@php.net>2016-06-26 13:26:43 +0100
commite3d9f1f4d8fc553e51881475e9dbc84c0de39e0e (patch)
treee68c5beb9b09d955eb0eff44807e00389a839702 /main/snprintf.c
parent3aa2aadcf0c39d7d22532c46d8921f443d27166f (diff)
downloadphp-git-e3d9f1f4d8fc553e51881475e9dbc84c0de39e0e.tar.gz
Simply use ndigit for flag for zend_dtoa mode
Diffstat (limited to 'main/snprintf.c')
-rw-r--r--main/snprintf.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/main/snprintf.c b/main/snprintf.c
index a69ebb3e31..80a5c6e249 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -139,11 +139,15 @@ static inline char *php_fcvt(double value, int ndigit, int *decpt, int *sign) /*
}
/* }}} */
-static inline char *_php_cvt(double value, int ndigit, char dec_point, char exponent, char *buf, int mode) /* {{{ */
+PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf) /* {{{ */
{
char *digits, *dst, *src;
int i, decpt, sign;
+ int mode = ndigit > 0 ? 2 : 0;
+ if (mode == 0) {
+ ndigit = 17;
+ }
digits = zend_dtoa(value, mode, ndigit, &decpt, &sign, NULL);
if (decpt == 9999) {
/*
@@ -234,18 +238,6 @@ static inline char *_php_cvt(double value, int ndigit, char dec_point, char expo
}
/* }}} */
-PHPAPI char *php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf) /* {{{ */
-{
- return _php_cvt(value, ndigit, dec_point, exponent, buf, 2);
-}
-/* }}} */
-
-PHPAPI char *php_0cvt(double value, int ndigit, char dec_point, char exponent, char *buf) /* {{{ */
-{
- return _php_cvt(value, ndigit, dec_point, exponent, buf, 0);
-}
-/* }}} */
-
/* {{{ Apache license */