]> granicus.if.org Git - php/commitdiff
Removed pointless memory allocation checks.
authorIlia Alshanetsky <iliaa@php.net>
Sat, 18 Jan 2003 19:49:28 +0000 (19:49 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sat, 18 Jan 2003 19:49:28 +0000 (19:49 +0000)
ext/db/db.c
ext/dba/dba.c
ext/dbx/dbx.c
ext/dbx/dbx_odbc.c
ext/domxml/php_domxml.c
ext/fbsql/php_fbsql.c
ext/fdf/fdf.c
ext/hwapi/hwapi.cpp
ext/hyperwave/hw.c
ext/iconv/iconv.c

index 785eaebc7d1d5f85a48b9f8db78746ff35a68a68..338d8dd5813a778fe3503facab0c0970e7e4a4ca 100644 (file)
@@ -198,10 +198,8 @@ PHP_FUNCTION(db_id_list)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
-               RETURN_FALSE;
-       }
+       array_init(return_value);
+
        numitems = zend_hash_next_free_element(&EG(regular_list));
        for (i=1; i<numitems; i++) {
                if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
@@ -395,10 +393,6 @@ dbm_info *php_dbm_open(char *filename, char *mode TSRMLS_DC)
 
        if (dbf) {
                info = (dbm_info *)emalloc(sizeof(dbm_info));
-               if (!info) {
-                       php_error_docref1(NULL TSRMLS_CC, filename, E_ERROR, "Problem allocating memory!");
-                       return NULL;
-               }
 
                info->filename = estrdup(filename);
                info->lockfn = lockfn;
index 2e59825c1be5db14c532368ec9dcd8cd449c29b0..5b98455e1f4a15ec04fc84f86ec46268c252f653 100644 (file)
@@ -841,10 +841,8 @@ PHP_FUNCTION(dba_handlers)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
-               RETURN_FALSE;
-       }
+       array_init(return_value);
+
        for(hptr = handler; hptr->name; hptr++) {
                if (full_info) {
                        add_assoc_string(return_value, hptr->name, hptr->info(hptr, NULL TSRMLS_CC), 0);
@@ -868,10 +866,8 @@ PHP_FUNCTION(dba_list)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
-               RETURN_FALSE;
-       }
+       array_init(return_value);
+
        numitems = zend_hash_next_free_element(&EG(regular_list));
        for (i=1; i<numitems; i++) {
                if (zend_hash_index_find(&EG(regular_list), i, (void **) &le)==FAILURE) {
index 9c6fa208a81f21166cea3d45d104340bc73be96b..fc780a0b9c8de7c4e06b92e4df501aaab0f552e1 100644 (file)
@@ -437,20 +437,12 @@ ZEND_FUNCTION(dbx_query)
        /* init info property as array and add to return_value as a property */
        if (result_flags & DBX_RESULT_INFO) {
                MAKE_STD_ZVAL(info); 
-               if (array_init(info) != SUCCESS) {
-                       zend_error(E_ERROR, "dbx_query: unable to create info-array for results...");
-                       FREE_ZVAL(info);
-                       RETURN_LONG(0);
-               }
+               array_init(info);
                zend_hash_update(Z_OBJPROP_P(return_value), "info", 5, (void *)&(info), sizeof(zval *), NULL);
        }
        /* init data property as array and add to return_value as a property */
        MAKE_STD_ZVAL(data); 
-       if (array_init(data) != SUCCESS) {
-               zend_error(E_ERROR, "dbx_query: unable to create data-array for results...");
-               FREE_ZVAL(data);
-               RETURN_LONG(0);
-       }
+       array_init(data);
        zend_hash_update(Z_OBJPROP_P(return_value), "data", 5, (void *)&(data), sizeof(zval *), NULL);
        /* get columncount and add to returnvalue as property */
        MAKE_STD_ZVAL(rv_column_count); 
@@ -468,18 +460,8 @@ ZEND_FUNCTION(dbx_query)
                zval *info_row_type;
                MAKE_STD_ZVAL(info_row_name);
                MAKE_STD_ZVAL(info_row_type);
-               if (array_init(info_row_name) != SUCCESS) {
-                       zend_error(E_ERROR, "dbx_query: unable to create info_row_name-array for results...");
-                       FREE_ZVAL(info_row_name);
-                       FREE_ZVAL(info_row_type);
-                       RETURN_LONG(0);
-               }
-               if (array_init(info_row_type) != SUCCESS) {
-                       zend_error(E_ERROR, "dbx_query: unable to create info_row_type-array for results...");
-                       FREE_ZVAL(info_row_name);
-                       FREE_ZVAL(info_row_type);
-                       RETURN_LONG(0);
-               }
+               array_init(info_row_name);
+               array_init(info_row_type);
                for (col_index=0; col_index<Z_LVAL_P(rv_column_count); ++col_index) {
                        zval *rv_column_name;
                        zval *rv_column_type;
index f05a3f267bb188a45c785b704f8e1539a755ed20..235ee1f123c0b13d7a53fe8fc4b78bbee29016bb 100644 (file)
@@ -233,11 +233,7 @@ int dbx_odbc_getrow(zval **rv, zval **result_handle, long row_number, INTERNAL_F
        zval_ptr_dtor(&fetch_row_result_zval);
        /* fill array with field results... */
        MAKE_STD_ZVAL(returned_zval);
-       if (array_init(returned_zval) != SUCCESS) {
-               zend_error(E_ERROR, "dbx_odbc_getrow: unable to create result-array...");
-               FREE_ZVAL(returned_zval);
-               return 0;
-       }
+       array_init(returned_zval);
        MAKE_STD_ZVAL(field_index_zval);
        ZVAL_LONG(field_index_zval, 0);
        number_of_arguments=2;
index 173f648c47760598b71f2d914c79f42f7a1ed52e..4bfb06172280ff5e21d8fdcb4106bf5b696452e3 100644 (file)
@@ -1343,9 +1343,7 @@ static void domxml_error_ext(void *ctx, const char *msg, ...)
                zval *errormessages;
                MAKE_STD_ZVAL(errormessages);
 
-               if(array_init(errormessages) != SUCCESS) {
-                       /* do error handling here */
-               } 
+               array_init(errormessages);
                add_assoc_string(errormessages,"errormessage",buf,1);                           
                input = ctxt->input;
                if (ctxt->name) {
@@ -1380,9 +1378,7 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
        if (ctxt != NULL && ctxt->errors != NULL) {
                zval *errormessages;
                MAKE_STD_ZVAL(errormessages);
-               if(array_init(errormessages) != SUCCESS) {
-                       /* do error handling here */
-               } 
+               array_init(errormessages);
                if (ctxt->parser != NULL) {
                        if (ctxt->parser->name) {
                                add_assoc_string(errormessages,"nodename",ctxt->parser->name,1); 
@@ -2254,9 +2250,7 @@ PHP_FUNCTION(domxml_node_children)
        else
                last = nodep->children;
 
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
        
        if (last) {
                while (last) {
@@ -2932,9 +2926,6 @@ PHP_FUNCTION(domxml_doc_get_elements_by_tagname)
        }
        ctxp->node = contextnodep;
        str = (char*) emalloc((name_len+3) * sizeof(char)) ;
-       if (str == NULL) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate memory for string");
-       }
        sprintf(str ,"//%s",name);
 
        xpathobjp = xmlXPathEval(str, ctxp);
@@ -2945,11 +2936,7 @@ PHP_FUNCTION(domxml_doc_get_elements_by_tagname)
        }
        MAKE_STD_ZVAL(rv);
 
-       if(array_init(rv) != SUCCESS)
-       {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required array");
-               RETURN_FALSE;
-       }
+       array_init(rv);
 
        switch (Z_TYPE_P(xpathobjp)) {
 
@@ -3040,10 +3027,7 @@ PHP_FUNCTION(domxml_elem_get_elements_by_tagname)
 
        MAKE_STD_ZVAL(rv);
 
-       if(array_init(rv) != SUCCESS) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required array");
-               RETURN_FALSE;
-       }
+       array_init(rv);
 
        nodesetp = php_get_elements_by_tagname(nodep, name, NULL);
 
@@ -3139,9 +3123,7 @@ PHP_FUNCTION(domxml_doctype_entities)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        while (last) {
                zval *child;
@@ -3170,9 +3152,7 @@ PHP_FUNCTION(domxml_doctype_notations)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        while (last) {
                zval *child;
@@ -3774,10 +3754,7 @@ PHP_FUNCTION(domxml_doc_ids)
        ids = docp->ids;
 
        if(ids) {
-               if (array_init(return_value) == FAILURE) {
-                       RETURN_FALSE;
-               }
-
+               array_init(return_value);
                xmlHashScan(ids, (void *)idsHashScanner2, return_value);
        } else {
                RETURN_FALSE;
@@ -4508,9 +4485,7 @@ static int node_namespace(zval **attributes, xmlNode *nodep TSRMLS_DC)
 
        /* create an php array for the children */
        MAKE_STD_ZVAL(*attributes);
-       if (array_init(*attributes) == FAILURE) {
-               return -1;
-       }
+       array_init(*attributes);
 
        while (ns) {
                zval *pattr;
@@ -4792,10 +4767,7 @@ static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr)
                        xmlNodeSetPtr nodesetp;
 
                        MAKE_STD_ZVAL(arr);
-                       if (array_init(arr) == FAILURE) {
-                               zval_dtor(rv);
-                               RETURN_FALSE;
-                       }
+                       array_init(arr);
 
                        if (NULL == (nodesetp = xpathobjp->nodesetval)) {
                                zval_dtor(rv);
index 75a6e14b98459df795157ebfe8644b0a39010d8f..11786c7b30c507b4c130f6c736b5cfeffd302a10 100644 (file)
@@ -2815,10 +2815,7 @@ static void php_fbsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal result type use FBSQL_NUM, FBSQL_ASSOC, or FBSQL_BOTH");
                RETURN_FALSE;
        }
-       if (array_init(return_value)==FAILURE)
-       {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
        if (result->fetchHandle == NULL)
        {
                if (result->array == NULL && result->list == NULL)
@@ -3015,7 +3012,7 @@ PHP_FUNCTION(fbsql_fetch_lengths)
        ZEND_FETCH_RESOURCE(result, PHPFBResult *, fbsql_result_index, -1, "FrontBase-Result", le_result);
 
        if (result->row == NULL) RETURN_FALSE;
-       if (array_init(return_value)==FAILURE) RETURN_FALSE;
+       array_init(return_value);
        for (i=0; i < result->columnCount; i++)
        {
                unsigned  length = 0;
index 293d53df7d0480e416a5ec09571c3a5edd3117ad..2d77b947faa79acd8b019d7088747c52f83a7170 100644 (file)
@@ -358,10 +358,7 @@ PHP_FUNCTION(fdf_get_value)
                } 
 #if HAVE_FDFTK_5
        } else if((err == FDFErcValueIsArray) && (which == -1)) {
-               if (array_init(return_value) == FAILURE) {
-                       efree(buffer);
-                       FDF_FAILURE(FDFErcInternalError);
-               }
+               array_init(return_value);
                which = 0;
                do {
                        err = FDFGetNthValue(fdf, fieldname, which, buffer, size-2, &nr); 
@@ -1037,9 +1034,7 @@ PHP_FUNCTION(fdf_get_opt) {
                if(err != FDFErcOK) {
                        FDF_FAILURE(err);
                }
-               if (array_init(return_value) == FAILURE) {
-                       RETURN_FALSE;
-               }
+               array_init(return_value);
                add_next_index_stringl(return_value, buf1, strlen(buf1), 1);
                add_next_index_stringl(return_value, buf2, strlen(buf2), 1);
                efree(buf1);
@@ -1470,9 +1465,7 @@ PHP_FUNCTION(fdf_get_attachment) {
                FDF_FAILURE(err);
        }
 
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
        add_assoc_string(return_value, "path", pathbuf, 1);
     add_assoc_string(return_value, "type", mimebuf, 1);
        stat(pathbuf, &statBuf);
index 6ebc07fb7c0e9fbf2ad2090471c6230f7ae0f11d..c8a03013d7b97266a7c6e482b3658e437aa078d1 100644 (file)
@@ -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; i<values->count(); 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; i<objarr->count(); 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; i<objarr.count(); i++) {
                zval *child;
@@ -2544,9 +2538,7 @@ PHP_FUNCTION(hwapi_find) {
        /* FIXME: No a good idea to return just the objects. There is actually
         * more to return. Changing this to an object of type hw_api_find_out would
         * mean to change hw_api_parents() and hw_api_children() as well. */
-       if (array_init(return_value) == FAILURE) {
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        /* FIXME: More than just the list of objects is returned by find() */
        if(0 == objectArray2indexArray(&rv, &objarr)) {
@@ -4092,9 +4084,7 @@ PHP_FUNCTION(hwapi_info) {
 
        if (!out.error().error()) {
                HW_API_StringArray languages, customidx, systemidx;
-               if (array_init(return_value) == FAILURE) {
-                       RETURN_FALSE;
-               }
+               array_init(return_value);
                HW_API_Object *object = new HW_API_Object(out.typeInfo());
                rv = php_hwapi_object_new(object, le_hwapi_objectp);
                zend_hash_add(return_value->value.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);
 }
 /* }}} */
 
index f893a3336a116235475964b5bb737f9afdc1a276..e81c1d44e933f7b77b0726ac84eadb37963f69e9 100644 (file)
@@ -255,13 +255,7 @@ int make_return_objrec(pval **return_value, char **objrecs, int count)
        int hidden, collhead, fullcollhead, total;
         int collheadnr, fullcollheadnr;
 
-       if (array_init(*return_value) == FAILURE) {
-               /* Ups, failed! Let's at least free the memory */
-               for(i=0; i<count; i++)
-                       efree(objrecs[i]);
-               efree(objrecs);
-               return -1;
-       }
+       array_init(*return_value);
 
        hidden = collhead = fullcollhead = total = 0;
        collheadnr = fullcollheadnr = -1;
@@ -288,9 +282,7 @@ int make_return_objrec(pval **return_value, char **objrecs, int count)
 
        /* Array for statistics */
        MAKE_STD_ZVAL(stat_arr);
-       if (array_init(stat_arr) == FAILURE) {
-               return -1;
-       }
+       array_init(stat_arr);
 
        add_assoc_long(stat_arr, "Hidden", hidden);
        add_assoc_long(stat_arr, "CollectionHead", collhead);
@@ -332,12 +324,7 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr
                add_assoc_long(spec_arr, "SQLStmt", HW_ATTR_NR);
        }
 
-       if (array_init(*return_value) == FAILURE) {
-               Z_TYPE_PP(return_value) = IS_STRING;
-               Z_STRVAL_PP(return_value) = empty_string;
-               Z_STRLEN_PP(return_value) = 0;
-               return -1;
-       }
+       array_init(*return_value);
 
        /* Loop through the attributes of object record and check
           if the attribute has a specification. If it has the value
@@ -438,12 +425,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) {
        MAKE_STD_ZVAL(keyword_arr);
        MAKE_STD_ZVAL(group_arr);
 
-       if (array_init(*return_value) == FAILURE) {
-               Z_TYPE_PP(return_value) = IS_STRING;
-               Z_STRVAL_PP(return_value) = empty_string;
-               Z_STRLEN_PP(return_value) = 0;
-               return -1;
-       }
+       array_init(*return_value);
 
        /* Fill Array of titles, descriptions and keywords */
        temp = estrdup(objrec);
@@ -455,30 +437,34 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) {
                iKeyword = 0;
                iGroup = 0;
                if(0 == strncmp(attrname, "Title=", 6)) {
-                       if ((hasTitle == 0) && (array_init(title_arr) == FAILURE)) {
+                       if (hasTitle == 0) {
                                return -1;
                        }
+                       array_init(title_arr);
                        hasTitle = 1;
                        str += 6;
                        iTitle = 1;
                } else if(0 == strncmp(attrname, "Description=", 12)) {
-                       if ((hasDescription == 0) && (array_init(desc_arr) == FAILURE)) {
+                       if (hasDescription == 0) {
                                return -1;
                        }
+                       array_init(desc_arr);
                        hasDescription = 1;
                        str += 12;
                        iDesc = 1;
                } else if(0 == strncmp(attrname, "Keyword=", 8)) {
-                       if ((hasKeyword == 0) && (array_init(keyword_arr) == FAILURE)) {
+                       if (hasKeyword == 0) {
                                return -1;
                        }
+                       array_init(keyword_arr);
                        hasKeyword = 1;
                        str += 8;
                        iKeyword = 1;
                } else if(0 == strncmp(attrname, "Group=", 6)) {
-                       if ((hasGroup == 0) && (array_init(group_arr) == FAILURE)) {
+                       if (hasGroup == 0) {
                                return -1;
                        }
+                       array_init(group_arr);
                        hasGroup = 1;
                        str += 6;
                        iGroup = 1;
@@ -1414,10 +1400,7 @@ php_printf("%s\n", ptr);
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(object);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        temp = estrdup(ptr);
        attrname = php_strtok_r(temp, "\n", &strtok_buf);
@@ -1426,10 +1409,7 @@ php_printf("%s\n", ptr);
                char *name;
 
                ALLOC_ZVAL(user_arr);
-               if (array_init(user_arr) == FAILURE) {
-                       efree(object);
-                       RETURN_FALSE;
-               }
+               array_init(user_arr);
 
                ptr = attrname;
                if(*ptr++ == '*')
@@ -1594,10 +1574,7 @@ PHP_FUNCTION(hw_getobject)
                        RETURN_FALSE;
                        }
                efree(ids);
-               if (array_init(return_value) == FAILURE) {
-                       efree(objects);
-                       RETURN_FALSE;
-               }
+               array_init(return_value);
 
                for(i=0; i<count; i++) {
                        add_index_string(return_value, i, objects[i], 0);
@@ -2390,10 +2367,7 @@ php_printf("count = %d, remainder = <HR>%s---<HR>", count, remainder);
                Z_LVAL_P(return_value) = zend_list_insert(doc, le_document);
                Z_TYPE_P(return_value) = IS_LONG;
        } else {
-               if (array_init(return_value) == FAILURE) {
-                       efree(offsets);
-                       RETURN_FALSE;
-               }
+               array_init(return_value);
 
                ptr1 = remainder;
                for(i=0; i<count; i++) {
@@ -3015,10 +2989,7 @@ PHP_FUNCTION(hw_getparents)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++) {
                add_index_long(return_value, i, childIDs[i]);
@@ -3055,10 +3026,7 @@ PHP_FUNCTION(hw_children)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++) {
                add_index_long(return_value, i, childIDs[i]);
@@ -3125,10 +3093,7 @@ PHP_FUNCTION(hw_getchildcoll)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++) {
                add_index_long(return_value, i, childIDs[i]);
@@ -3252,10 +3217,7 @@ PHP_FUNCTION(hw_getobjectbyquery)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++)
                add_index_long(return_value, i, childIDs[i]);
@@ -3325,10 +3287,7 @@ PHP_FUNCTION(hw_getobjectbyquerycoll)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++)
                add_index_long(return_value, i, childIDs[i]);
@@ -3399,10 +3358,7 @@ PHP_FUNCTION(hw_getobjectbyftquery)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value) ;
 
        for(i=0; i<count; i++)
                add_index_long(return_value, i, childIDs[i]);
@@ -3474,10 +3430,7 @@ PHP_FUNCTION(hw_getobjectbyftquerycoll)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++)
                add_index_long(return_value, i, childIDs[i]);
@@ -3544,10 +3497,7 @@ PHP_FUNCTION(hw_getchilddoccoll)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(childIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++)
                add_index_long(return_value, i, childIDs[i]);
@@ -3608,10 +3558,7 @@ PHP_FUNCTION(hw_getanchors)
                RETURN_FALSE;
        }
 
-       if (array_init(return_value) == FAILURE) {
-               efree(anchorIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<count; i++)
                add_index_long(return_value, i, anchorIDs[i]);
@@ -3802,10 +3749,7 @@ PHP_FUNCTION(hw_incollections)
        if(objectIDs) efree(objectIDs);
        if(collIDs) efree(collIDs);
 
-       if (array_init(return_value) == FAILURE) {
-               efree(retIDs);
-               RETURN_FALSE;
-       }
+       array_init(return_value);
 
        for(i=0; i<cretids; i++)
                add_index_long(return_value, i, retIDs[i]);
index ea8d3a20bbd7e5bb2cafa3adb8a14cdaa78fa29c..cdf13887f3466f7535927c5bedff2b9cd5cc6c17 100644 (file)
@@ -423,13 +423,10 @@ php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
                                bsz += in_len;
 
                                tmp_buf = (char*) erealloc(out_buf, bsz+1);
-
-                               if (tmp_buf != NULL) {
-                                       out_p = out_buf = tmp_buf;
-                                       out_p += out_size;
-                                       out_left = bsz - out_size;
-                                       continue;       
-                               }
+                               out_p = out_buf = tmp_buf;
+                               out_p += out_size;
+                               out_left = bsz - out_size;
+                               continue;       
                        }
                }
                break;
@@ -448,10 +445,6 @@ php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len,
                        if (errno == E2BIG) {
                                bsz += 16;
                                tmp_buf = (char *) erealloc(out_buf, bsz);
-
-                               if (tmp_buf == NULL) {
-                                       break;
-                               }
                                
                                out_p = out_buf = tmp_buf;
                                out_p += out_size;
@@ -1818,9 +1811,7 @@ PHP_FUNCTION(iconv_get_encoding)
                return;
 
        if (!strcasecmp("all", type)) {
-               if (array_init(return_value) == FAILURE) {
-                       RETURN_FALSE;
-               }
+               array_init(return_value);
                add_assoc_string(return_value, "input_encoding",    ICONVG(input_encoding), 1);
                add_assoc_string(return_value, "output_encoding",   ICONVG(output_encoding), 1);
                add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding), 1);