From 89d758c37867decc97a4050a9b4ea2ca5b8714d5 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 5 Dec 2002 22:46:40 +0000 Subject: MFH --- ext/ereg/ereg.c | 5 +---- ext/standard/array.c | 8 ++------ ext/standard/basic_functions.c | 4 +--- ext/standard/datetime.c | 10 ++-------- ext/standard/dns.c | 12 +++--------- ext/standard/filestat.c | 4 +--- ext/standard/iptc.c | 10 ++-------- ext/standard/pack.c | 3 +-- ext/standard/reg.c | 5 +---- ext/standard/scanf.c | 6 ++---- ext/standard/string.c | 14 ++++---------- 11 files changed, 20 insertions(+), 61 deletions(-) (limited to 'ext') diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 9a5865c33e..89024a0e4d 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -517,10 +517,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) RETURN_FALSE; } - if (array_init(return_value) == FAILURE) { - regfree(&re); - RETURN_FALSE; - } + array_init(return_value); /* churn through str, generating array entries as we go */ while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) { diff --git a/ext/standard/array.c b/ext/standard/array.c index a1c0df8c0d..15a1138bc4 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1374,9 +1374,7 @@ PHP_FUNCTION(array_fill) } /* allocate an array for return */ - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); switch (Z_TYPE_PP(start_key)) { case IS_STRING: @@ -1428,9 +1426,7 @@ PHP_FUNCTION(range) } /* allocate an array for return */ - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (Z_TYPE_PP(zlow)==IS_STRING && Z_TYPE_PP(zhigh)==IS_STRING) { char *low, *high; diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index de8f55ad2b..242342deb6 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1504,9 +1504,7 @@ PHP_FUNCTION(getopt) } /* Initialize the return value as an array. */ - if (array_init(return_value)) { - RETURN_FALSE; - } + array_init(return_value); /* Disable getopt()'s error messages. */ opterr = 0; diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 386236a73c..1d0d6f1e75 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -662,10 +662,7 @@ PHP_FUNCTION(localtime) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid local time"); RETURN_FALSE; } - if (array_init(return_value) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot prepare return array from localtime"); - RETURN_FALSE; - } + array_init(return_value); if (assoc_array) { add_assoc_long(return_value, "tm_sec", ta->tm_sec); @@ -713,10 +710,7 @@ PHP_FUNCTION(getdate) php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot perform date calculation"); return; } - if (array_init(return_value) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array"); - return; - } + array_init(return_value); add_assoc_long(return_value, "seconds", ta->tm_sec); add_assoc_long(return_value, "minutes", ta->tm_min); add_assoc_long(return_value, "hours", ta->tm_hour); diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 901c6c6322..47f9cb3278 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -174,9 +174,7 @@ PHP_FUNCTION(gethostbynamel) } convert_to_string_ex(arg); - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); hp = gethostbyname(Z_STRVAL_PP(arg)); if (hp == NULL || hp->h_addr_list == NULL) { @@ -304,9 +302,7 @@ PHP_FUNCTION(getmxrr) } need_weight = 1; pval_destructor(weight_list); /* start with clean array */ - if (array_init(weight_list) == FAILURE) { - RETURN_FALSE; - } + array_init(weight_list); break; default: @@ -315,9 +311,7 @@ PHP_FUNCTION(getmxrr) convert_to_string(host); pval_destructor(mx_list); /* start with clean array */ - if (array_init(mx_list) == FAILURE ) { - RETURN_FALSE; - } + array_init(mx_list); /* Go! */ i = res_search(Z_STRVAL_P(host), C_IN, T_MX, (u_char *)&ans, sizeof(ans)); diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index e706534f7c..7774d6dd6f 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -747,9 +747,7 @@ static void php_stat(const char *filename, php_stat_len filename_length, int typ #endif /* FALLTHROUGH */ case FS_STAT: - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); MAKE_LONG_ZVAL_INCREF(stat_dev, stat_sb->st_dev); MAKE_LONG_ZVAL_INCREF(stat_ino, stat_sb->st_ino); diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index d42bcd489e..2d4f7def2f 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -353,19 +353,13 @@ PHP_FUNCTION(iptcparse) break; if (tagsfound == 0) { /* found the 1st tag - initialize the return array */ - if (array_init(return_value) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array"); - RETURN_FALSE; - } + array_init(return_value); } if (zend_hash_find(Z_ARRVAL_P(return_value), key, strlen(key) + 1, (void **) &element) == FAILURE) { ALLOC_ZVAL(values); INIT_PZVAL(values); - if (array_init(values) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array"); - RETURN_FALSE; - } + array_init(values); zend_hash_update(Z_ARRVAL_P(return_value), key, strlen(key)+1, (void *) &values, sizeof(pval*), (void **) &element); } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index eab6d2bac8..df84a8c4e7 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -534,8 +534,7 @@ PHP_FUNCTION(unpack) inputlen = Z_STRLEN_PP(inputarg); inputpos = 0; - if (array_init(return_value) == FAILURE) - RETURN_FALSE; + array_init(return_value); while (formatlen-- > 0) { char type = *(format++); diff --git a/ext/standard/reg.c b/ext/standard/reg.c index 9a5865c33e..89024a0e4d 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -517,10 +517,7 @@ static void php_split(INTERNAL_FUNCTION_PARAMETERS, int icase) RETURN_FALSE; } - if (array_init(return_value) == FAILURE) { - regfree(&re); - RETURN_FALSE; - } + array_init(return_value); /* churn through str, generating array entries as we go */ while ((count == -1 || count > 1) && !(err = regexec(&re, strp, 1, subs, 0))) { diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c index 94aa9a21b0..6f9a35582d 100644 --- a/ext/standard/scanf.c +++ b/ext/standard/scanf.c @@ -656,10 +656,8 @@ PHPAPI int php_sscanf_internal( char *string, char *format, if (!numVars) { /* allocate an array for return */ - if (array_init(*return_value) == FAILURE) { - scan_set_error_return(0, return_value); - return FAILURE; - } + array_init(*return_value); + for (i = 0; i < totalVars; i++) { if (add_next_index_null(*return_value) == FAILURE) { scan_set_error_return(0, return_value); diff --git a/ext/standard/string.c b/ext/standard/string.c index 6679b227a1..62e5022449 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -793,9 +793,7 @@ PHP_FUNCTION(explode) RETURN_FALSE; } - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (limit == 0 || limit == 1) { add_index_stringl(return_value, 0, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); @@ -3721,13 +3719,9 @@ PHP_FUNCTION(localeconv) WRONG_PARAM_COUNT; } - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - if (array_init(grouping) == FAILURE || array_init(mon_grouping) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); + array_init(grouping); + array_init(mon_grouping); #ifdef HAVE_LOCALECONV { -- cgit v1.2.1