summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2014-02-19 17:58:39 +0800
committerXinchen Hui <laruence@gmail.com>2014-02-19 17:58:39 +0800
commitc1c4d2681782772d41ba68f32eb71baa907e10de (patch)
tree2a8575279b7bea19482ab8fc6a2a1cb437ce593f /ext
parent9067dbcd0d8d8bed6c723d274b162182f33281ea (diff)
downloadphp-git-c1c4d2681782772d41ba68f32eb71baa907e10de.tar.gz
Use better data structures (incomplete)
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c7
-rw-r--r--ext/spl/spl_heap.c4
2 files changed, 5 insertions, 6 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 19895ee7e6..05dccf4f8e 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -4215,14 +4215,14 @@ PHP_FUNCTION(date_interval_create_from_date_string)
/* }}} */
/* {{{ date_interval_format - */
-static char *date_interval_format(char *format, int format_len, timelib_rel_time *t)
+static zend_string *date_interval_format(char *format, int format_len, timelib_rel_time *t)
{
smart_str string = {0};
int i, length, have_format_spec = 0;
char buffer[33];
if (!format_len) {
- return estrdup("");
+ return STR_EMPTY_ALLOC();
}
for (i = 0; i < format_len; i++) {
@@ -4292,8 +4292,7 @@ PHP_FUNCTION(date_interval_format)
diobj = (php_interval_obj *) Z_OBJ_P(object);
DATE_CHECK_INITIALIZED(diobj->initialized, DateInterval);
-//??? RETURN_STRING(date_interval_format(format, format_len, diobj->diff), 0);
- RETURN_STRING(date_interval_format(format, format_len, diobj->diff));
+ RETURN_STR(date_interval_format(format, format_len, diobj->diff));
}
/* }}} */
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 45b50c2d25..9159000799 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -896,7 +896,7 @@ static zval *spl_heap_it_get_current_data(zend_object_iterator *iter TSRMLS_DC)
if (iterator->object->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0 TSRMLS_CC);
- return;
+ return NULL;
}
if (iterator->object->heap->count == 0 || ZVAL_IS_UNDEF(element)) {
@@ -914,7 +914,7 @@ static zval *spl_pqueue_it_get_current_data(zend_object_iterator *iter TSRMLS_DC
if (iterator->object->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0 TSRMLS_CC);
- return;
+ return NULL;
}
if (iterator->object->heap->count == 0 || ZVAL_IS_UNDEF(element)) {