summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
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);