diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2003-01-18 19:49:28 +0000 | 
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2003-01-18 19:49:28 +0000 | 
| commit | a7b91019e9b551ff48dd91587674784b7020673f (patch) | |
| tree | cfa8e9cb23f2e0a71364f747f2e3debcb508a5f5 | |
| parent | a395304c7245ec411e8c735c82734e1fd0c27725 (diff) | |
| download | php-git-a7b91019e9b551ff48dd91587674784b7020673f.tar.gz | |
Removed pointless memory allocation checks.
| -rw-r--r-- | ext/db/db.c | 10 | ||||
| -rw-r--r-- | ext/dba/dba.c | 12 | ||||
| -rw-r--r-- | ext/dbx/dbx.c | 26 | ||||
| -rw-r--r-- | ext/dbx/dbx_odbc.c | 6 | ||||
| -rw-r--r-- | ext/domxml/php_domxml.c | 48 | ||||
| -rw-r--r-- | ext/fbsql/php_fbsql.c | 7 | ||||
| -rw-r--r-- | ext/fdf/fdf.c | 13 | ||||
| -rw-r--r-- | ext/hwapi/hwapi.cpp | 35 | ||||
| -rw-r--r-- | ext/hyperwave/hw.c | 108 | ||||
| -rw-r--r-- | ext/iconv/iconv.c | 19 | 
10 files changed, 68 insertions, 216 deletions
diff --git a/ext/db/db.c b/ext/db/db.c index 785eaebc7d..338d8dd581 100644 --- a/ext/db/db.c +++ b/ext/db/db.c @@ -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; diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 2e59825c1b..5b98455e1f 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -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) { diff --git a/ext/dbx/dbx.c b/ext/dbx/dbx.c index 9c6fa208a8..fc780a0b9c 100644 --- a/ext/dbx/dbx.c +++ b/ext/dbx/dbx.c @@ -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; diff --git a/ext/dbx/dbx_odbc.c b/ext/dbx/dbx_odbc.c index f05a3f267b..235ee1f123 100644 --- a/ext/dbx/dbx_odbc.c +++ b/ext/dbx/dbx_odbc.c @@ -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; diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index 173f648c47..4bfb061722 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -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); diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index 75a6e14b98..11786c7b30 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -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; diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c index 293d53df7d..2d77b947fa 100644 --- a/ext/fdf/fdf.c +++ b/ext/fdf/fdf.c @@ -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); 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; 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);  }  /* }}} */ diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index f893a3336a..e81c1d44e9 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -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]); diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index ea8d3a20bb..cdf13887f3 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -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);  | 
