summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-08-14 11:52:46 +0800
committerXinchen Hui <laruence@php.net>2014-08-14 11:52:46 +0800
commitbfc1ae07bec3bda6dc0522da50b35ba093d4247c (patch)
treece6d954be2be675df92a9cab7c662bc73a6491e0 /ext/date/php_date.c
parent35dd200430994b1b2807633e5d5dd3370b59633e (diff)
parent73fe4186370d8ca8bd0b8a4a8f995852cb42fa75 (diff)
downloadphp-git-bfc1ae07bec3bda6dc0522da50b35ba093d4247c.tar.gz
Merge branch 'phpng' of https://git.php.net/repository/php-src into phpng
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 78251383e1..49dab65147 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -4556,7 +4556,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
int rs;
timelib_time *t;
timelib_tzinfo *tzi;
- char *retstr;
+ zend_string *retstr;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
RETURN_FALSE;
@@ -4621,11 +4621,8 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
switch (retformat) {
case SUNFUNCS_RET_STRING:
- spprintf(&retstr, 0, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));
- // TODO: avoid reallocation ???
- RETVAL_STRINGL(retstr, 5);
- efree(retstr);
- return;
+ retstr = strpprintf(0, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));
+ RETURN_STR(retstr);
break;
case SUNFUNCS_RET_DOUBLE:
RETURN_DOUBLE(N);