]> granicus.if.org Git - php/commitdiff
Use better data structures (incomplete)
authorXinchen Hui <laruence@gmail.com>
Wed, 19 Feb 2014 09:58:39 +0000 (17:58 +0800)
committerXinchen Hui <laruence@gmail.com>
Wed, 19 Feb 2014 09:58:39 +0000 (17:58 +0800)
ext/date/php_date.c
ext/spl/spl_heap.c
sapi/phpdbg/phpdbg_info.c
sapi/phpdbg/phpdbg_list.c
sapi/phpdbg/phpdbg_print.c

index 19895ee7e62bdd0315b129b69a120740f2d198a5..05dccf4f8e86eef10f71e7343fe4f170410d03ef 100644 (file)
@@ -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));
 }
 /* }}} */
 
index 45b50c2d25e142dee15b4428fc85fee221de0c80..91590007994bb323898ad815e80601ea33098327 100644 (file)
@@ -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)) {
index 281cfc406a8c3544df6be3395a2cae3dc1b95526..d1a3cf6a9b08837f8389c1deb1291b9623a41690 100644 (file)
@@ -196,15 +196,15 @@ PHPDBG_INFO(literal) /* {{{ */
                if (ops->function_name) {
                        if (ops->scope) {
                                phpdbg_notice(
-                               "Literal Constants in %s::%s() (%d)", ops->scope->name, ops->function_name, count);
+                               "Literal Constants in %s::%s() (%d)", ops->scope->name, ops->function_name->val, count);
                        } else {
                                phpdbg_notice(
-                                       "Literal Constants in %s() (%d)", ops->function_name, count);
+                                       "Literal Constants in %s() (%d)", ops->function_name->val, count);
                        }
                } else {
                        if (ops->filename) {
                                phpdbg_notice(
-                               "Literal Constants in %s (%d)", ops->filename, count);
+                               "Literal Constants in %s (%d)", ops->filename->val, count);
                        } else {
                                phpdbg_notice(
                                        "Literal Constants @ %p (%d)", ops, count);
index 4ef3db98ea67d964febd690e22b0d118dd58aee4..68352ac7635f397a4fa2cb80fd788f38f7ff10e0 100644 (file)
@@ -238,7 +238,7 @@ void phpdbg_list_function(const zend_function *fbc TSRMLS_DC) /* {{{ */
        const zend_op_array *ops;
 
        if (fbc->type != ZEND_USER_FUNCTION) {
-               phpdbg_error("The function requested (%s) is not user defined", fbc->common.function_name);
+               phpdbg_error("The function requested (%s) is not user defined", fbc->common.function_name->val);
                return;
        }
 
index 8836eed13743b683390c98182244a0a8e469b0c4..131862ceb8d519035c2b849d304b9ab914060a23 100644 (file)
@@ -155,7 +155,7 @@ PHPDBG_PRINT(class) /* {{{ */
                                                (ce->ce_flags & ZEND_ACC_ABSTRACT) ?
                                                        "Abstract Class" :
                                                        "Class",
-                                       *ce->name->val);
+                                       ce->name->val);
 
                                phpdbg_writeln("Methods (%d):", zend_hash_num_elements(&ce->function_table));
                                if (zend_hash_num_elements(&ce->function_table)) {
@@ -197,7 +197,7 @@ PHPDBG_PRINT(method) /* {{{ */
                                if ((fbc = zend_hash_str_find_ptr(&ce->function_table, lcname, strlen(lcname))) != NULL) {
                                        phpdbg_notice("%s Method %s",
                                                (fbc->type == ZEND_USER_FUNCTION) ? "User" : "Internal",
-                                               fbc->common.function_name);
+                                               fbc->common.function_name->val);
 
                                        phpdbg_print_function_helper(fbc TSRMLS_CC);
                                } else {