From a7b91019e9b551ff48dd91587674784b7020673f Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sat, 18 Jan 2003 19:49:28 +0000 Subject: Removed pointless memory allocation checks. --- ext/hwapi/hwapi.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'ext/hwapi/hwapi.cpp') diff --git a/ext/hwapi/hwapi.cpp b/ext/hwapi/hwapi.cpp index 6ebc07fb7c..c8a03013d7 100644 --- a/ext/hwapi/hwapi.cpp +++ b/ext/hwapi/hwapi.cpp @@ -311,9 +311,7 @@ static void print_hwapi_stringarray(const HW_API_StringArray& strings) { } static int stringArray2indexArray(pval **return_value, HW_API_StringArray *values) { - if (array_init(*return_value) == FAILURE) { - return 0; - } + array_init(*return_value); for (int i=0; icount(); i++) { HW_API_String str; values->string(i, str); @@ -324,9 +322,7 @@ static int stringArray2indexArray(pval **return_value, HW_API_StringArray *value } static int objectArray2indexArray(pval **return_value, HW_API_ObjectArray *objarr) { - if (array_init(*return_value) == FAILURE) { - return 0; - } + array_init(*return_value); for(int i=0; icount(); i++) { zval *child; @@ -2400,9 +2396,7 @@ PHP_FUNCTION(hwapi_mychildren) { objarr = (HW_API_ObjectArray) out.objects(); } - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); for(i=0; ivalue.ht, "typeInfo", 9, &rv, sizeof(zval *), NULL); @@ -4588,16 +4578,13 @@ PHP_FUNCTION(hwapi_content_read) { Z_TYPE_PP(arg1) = IS_STRING; /* FIXME: Need to finish the new zval */ value = (char *) emalloc(Z_LVAL_PP(arg2)+1); - if(value) { - Z_STRVAL_PP(arg1) = value; - len = contentp->read(value, Z_LVAL_PP(arg2)); - value[len] = '\0'; - Z_STRLEN_PP(arg1) = len; - RETURN_LONG(len); - } else { - RETURN_FALSE; - } + Z_STRVAL_PP(arg1) = value; + len = contentp->read(value, Z_LVAL_PP(arg2)); + value[len] = '\0'; + Z_STRLEN_PP(arg1) = len; + + RETURN_LONG(len); } /* }}} */ -- cgit v1.2.1