iliaa Sat Jan 18 14:41:59 2003 EDT Modified files: /php4/ext/openssl openssl.c /php4/ext/odbc php_odbc.c /php4/ext/oci8 oci8.c /php4/ext/oracle oracle.c /php4/ext/mysql php_mysql.c /php4/ext/mssql php_mssql.c /php4/ext/msql php_msql.c /php4/ext/mnogosearch php_mnogo.c /php4/ext/mcrypt mcrypt.c /php4/ext/mcal php_mcal.c /php4/ext/interbase interbase.c /php4/ext/ingres_ii ii.c /php4/ext/informix ifx.ec Log: Removed pointless memory allocation checks.
Index: php4/ext/openssl/openssl.c diff -u php4/ext/openssl/openssl.c:1.62 php4/ext/openssl/openssl.c:1.63 --- php4/ext/openssl/openssl.c:1.62 Sat Jan 4 18:31:54 2003 +++ php4/ext/openssl/openssl.c Sat Jan 18 14:41:38 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.62 2003/01/04 23:31:54 iliaa Exp $ */ +/* $Id: openssl.c,v 1.63 2003/01/18 19:41:38 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2875,12 +2875,7 @@ ZVAL_STRINGL(sealdata, buf, len1 + len2, 0); zval_dtor(ekeys); - if (array_init(ekeys) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot initialize return value"); - RETVAL_FALSE; - efree(buf); - goto clean_exit; - } + array_init(ekeys); for (i=0; i<nkeys; i++) { eks[i][eksl[i]] = '\0'; add_next_index_stringl(ekeys, erealloc(eks[i], eksl[i] + 1), eksl[i], 0); Index: php4/ext/odbc/php_odbc.c diff -u php4/ext/odbc/php_odbc.c:1.150 php4/ext/odbc/php_odbc.c:1.151 --- php4/ext/odbc/php_odbc.c:1.150 Thu Jan 16 11:27:30 2003 +++ php4/ext/odbc/php_odbc.c Sat Jan 18 14:41:39 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_odbc.c,v 1.150 2003/01/16 16:27:30 kalowsky Exp $ */ +/* $Id: php_odbc.c,v 1.151 2003/01/18 19:41:39 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1396,9 +1396,7 @@ RETURN_FALSE; } - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); #ifdef HAVE_SQL_EXTENDED_FETCH if (result->fetch_abs) { @@ -1552,10 +1550,7 @@ } if (Z_TYPE_PP(pv_res_arr) != IS_ARRAY) { - if (array_init(*pv_res_arr) == FAILURE) { - php_error(E_WARNING, "Can't convert to type Array"); - RETURN_FALSE; - } + array_init(*pv_res_arr); } #ifdef HAVE_SQL_EXTENDED_FETCH Index: php4/ext/oci8/oci8.c diff -u php4/ext/oci8/oci8.c:1.198 php4/ext/oci8/oci8.c:1.199 --- php4/ext/oci8/oci8.c:1.198 Tue Jan 7 10:55:59 2003 +++ php4/ext/oci8/oci8.c Sat Jan 18 14:41:41 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oci8.c,v 1.198 2003/01/07 15:55:59 ldixon Exp $ */ +/* $Id: oci8.c,v 1.199 2003/01/18 19:41:41 iliaa Exp $ */ /* TODO list: * @@ -640,7 +640,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "OCI8 Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.198 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.199 $"); #ifndef PHP_WIN32 php_info_print_table_row(2, "Oracle Version", PHP_OCI8_VERSION ); php_info_print_table_row(2, "Compile-time ORACLE_HOME", PHP_OCI8_DIR ); @@ -4034,10 +4034,7 @@ } zval_dtor(*array); - if (array_init(*array) == FAILURE) { - php_error(E_WARNING, "OCIFetchInto: unable to convert arg 2 to array"); - RETURN_FALSE; - } + array_init(*array); for (i = 0; i < statement->ncolumns; i++) { column = oci_get_col(statement, i + 1, 0); Index: php4/ext/oracle/oracle.c diff -u php4/ext/oracle/oracle.c:1.82 php4/ext/oracle/oracle.c:1.83 --- php4/ext/oracle/oracle.c:1.82 Wed Jan 15 21:53:43 2003 +++ php4/ext/oracle/oracle.c Sat Jan 18 14:41:42 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: oracle.c,v 1.82 2003/01/16 02:53:43 iliaa Exp $ */ +/* $Id: oracle.c,v 1.83 2003/01/18 19:41:42 iliaa Exp $ */ /* comment out the next line if you're on Oracle 7.x and don't have the olog call. */ @@ -619,10 +619,7 @@ } ZEND_FETCH_RESOURCE2(conn, oraConnection *, arg, -1, "Oracle-Connection", le_conn, le_pconn); - if ((cursor = (oraCursor *)emalloc(sizeof(oraCursor))) == NULL){ - php_error(E_WARNING, "Out of memory"); - RETURN_FALSE; - } + cursor = (oraCursor *)emalloc(sizeof(oraCursor); memset(cursor, 0, sizeof(oraCursor)); if (oopen(&cursor->cda, &conn->lda, (text *) 0, -1, -1, (text *) 0, -1)) { php_error(E_WARNING, "Unable to open new cursor (%s)", @@ -840,10 +837,7 @@ RETURN_FALSE; } } - if ((newparam = (oraParam *)emalloc(sizeof(oraParam))) == NULL) { - php_error(E_WARNING, "Out of memory for parameter"); - RETURN_FALSE; - } + newparam = (oraParam *)emalloc(sizeof(oraParam); if ((paramname = estrndup(Z_STRVAL_PP(pvar), Z_STRLEN_PP(pvar))) == NULL) { php_error(E_WARNING, "Out of memory for parametername"); @@ -866,10 +860,7 @@ paramptr->progvl = Z_LVAL_PP(plen) + 1; paramptr->inout = inout; - if ((paramptr->progv = (text *)emalloc(paramptr->progvl)) == NULL) { - php_error(E_WARNING, "Out of memory for parameter value"); - RETURN_FALSE; - } + paramptr->progv = (text *)emalloc(paramptr->progvl); /* XXX Maximum for progvl */ paramptr->alen = paramptr->progvl; @@ -997,10 +988,7 @@ convert_to_string_ex(sql); - if ((cursor = (oraCursor *)emalloc(sizeof(oraCursor))) == NULL){ - php_error(E_WARNING, "Out of memory"); - RETURN_FALSE; - } + cursor = (oraCursor *)emalloc(sizeof(oraCursor); memset(cursor, 0, sizeof(oraCursor)); @@ -1137,10 +1125,7 @@ if (Z_TYPE_PP(arr) != IS_ARRAY){ pval_destructor(*arr); - if (array_init(*arr) == FAILURE){ - php_error(E_WARNING, "Can't convert to type Array"); - RETURN_FALSE; - } + array_init(*arr); } zend_hash_internal_pointer_reset(Z_ARRVAL_PP(arr)); @@ -1667,10 +1652,6 @@ if (cursor->ncols > 0){ cursor->columns = (oraColumn *) emalloc(sizeof(oraColumn) * cursor->ncols); - if (cursor->columns == NULL){ - php_error(E_WARNING, "Out of memory"); - return -1; - } memset(cursor->columns,0,sizeof(oraColumn) * cursor->ncols); } @@ -1704,10 +1685,8 @@ break; } - if ((cursor->columns[col].buf = (ub1 *) emalloc(cursor->columns[col].dsize + 1)) == NULL){ - php_error(E_WARNING, "Out of memory"); - return -1; - } + cursor->columns[col].buf = (ub1 *) emalloc(cursor->columns[col].dsize ++ 1); + /* Define an output variable for the column */ if (odefin(&cursor->cda, (sword)col + 1, cursor->columns[col].buf, cursor->columns[col].dsize + 1, type, -1, &cursor->columns[col].indp, Index: php4/ext/mysql/php_mysql.c diff -u php4/ext/mysql/php_mysql.c:1.182 php4/ext/mysql/php_mysql.c:1.183 --- php4/ext/mysql/php_mysql.c:1.182 Wed Jan 8 06:00:06 2003 +++ php4/ext/mysql/php_mysql.c Sat Jan 18 14:41:44 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mysql.c,v 1.182 2003/01/08 11:00:06 georg Exp $ */ +/* $Id: php_mysql.c,v 1.183 2003/01/18 19:41:44 iliaa Exp $ */ /* TODO: * @@ -1888,9 +1888,7 @@ RETURN_FALSE; } - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); mysql_field_seek(mysql_result, 0); for (mysql_field=mysql_fetch_field(mysql_result), i=0; mysql_field; mysql_field=mysql_fetch_field(mysql_result), i++) { @@ -2012,9 +2010,7 @@ if ((lengths=mysql_fetch_lengths(mysql_result))==NULL) { RETURN_FALSE; } - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); num_fields = mysql_num_fields(mysql_result); for (i=0; i<num_fields; i++) { Index: php4/ext/mssql/php_mssql.c diff -u php4/ext/mssql/php_mssql.c:1.99 php4/ext/mssql/php_mssql.c:1.100 --- php4/ext/mssql/php_mssql.c:1.99 Sun Jan 12 01:28:41 2003 +++ php4/ext/mssql/php_mssql.c Sat Jan 18 14:41:45 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.99 2003/01/12 06:28:41 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.100 2003/01/18 19:41:45 iliaa Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -1280,9 +1280,7 @@ RETURN_FALSE; } - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); for (i=0; i<result->num_fields; i++) { if (Z_TYPE(result->data[result->cur_row][i]) != IS_NULL) { @@ -1838,15 +1836,8 @@ statement=NULL; statement = ecalloc(1,sizeof(mssql_statement)); - - if (statement!=NULL) { - statement->link = mssql_ptr; - statement->executed=FALSE; - } - else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unable to allocate statement"); - RETURN_FALSE; - } + statement->link = mssql_ptr; + statement->executed=FALSE; statement->id = zend_list_insert(statement,le_statement); Index: php4/ext/msql/php_msql.c diff -u php4/ext/msql/php_msql.c:1.50 php4/ext/msql/php_msql.c:1.51 --- php4/ext/msql/php_msql.c:1.50 Tue Dec 31 11:07:00 2002 +++ php4/ext/msql/php_msql.c Sat Jan 18 14:41:46 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_msql.c,v 1.50 2002/12/31 16:07:00 sebastian Exp $ */ +/* $Id: php_msql.c,v 1.51 2003/01/18 19:41:46 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -931,9 +931,7 @@ num_fields = msqlNumFields(msql_result); - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); msqlFieldSeek(msql_result,0); for (msql_field=msqlFetchField(msql_result),i=0; msql_field; msql_field=msqlFetchField(msql_result),i++) { Index: php4/ext/mnogosearch/php_mnogo.c diff -u php4/ext/mnogosearch/php_mnogo.c:1.69 php4/ext/mnogosearch/php_mnogo.c:1.70 --- php4/ext/mnogosearch/php_mnogo.c:1.69 Tue Dec 31 11:06:58 2002 +++ php4/ext/mnogosearch/php_mnogo.c Sat Jan 18 14:41:47 2003 @@ -1,5 +1,5 @@ /* $Source: /usr/repository/php4/ext/mnogosearch/php_mnogo.c,v $ */ -/* $Id: php_mnogo.c,v 1.69 2002/12/31 16:06:58 sebastian Exp $ */ +/* $Id: php_mnogo.c,v 1.70 2003/01/18 19:41:47 iliaa Exp $ */ /* +----------------------------------------------------------------------+ @@ -2265,9 +2265,7 @@ #else if((c=UdmCatList(Agent,cat))){ #endif - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (!(buf=calloc(1,UDMSTRSIZ+1))) { RETURN_FALSE; @@ -2339,9 +2337,7 @@ #else if((c=UdmCatPath(Agent,cat))){ #endif - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (!(buf=calloc(1,UDMSTRSIZ+1))) { RETURN_FALSE; Index: php4/ext/mcrypt/mcrypt.c diff -u php4/ext/mcrypt/mcrypt.c:1.81 php4/ext/mcrypt/mcrypt.c:1.82 --- php4/ext/mcrypt/mcrypt.c:1.81 Tue Jan 7 22:33:00 2003 +++ php4/ext/mcrypt/mcrypt.c Sat Jan 18 14:41:48 2003 @@ -16,7 +16,7 @@ | Derick Rethans <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: mcrypt.c,v 1.81 2003/01/08 03:33:00 iliaa Exp $ */ +/* $Id: mcrypt.c,v 1.82 2003/01/18 19:41:48 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -210,12 +210,6 @@ return; \ } -#define MCRYPT_INIT_RETURN_ARRAY \ - if (array_init(return_value) == FAILURE) { \ - php_error_docref (NULL TSRMLS_CC, E_ERROR, "Unable to initialize array"); \ - return; \ - } - #define MCRYPT_OPEN_MODULE_FAILED "Module initialization failed" #define MCRYPT_ENTRY2_2_4(a,b) REGISTER_STRING_CONSTANT("MCRYPT_" #a, b, CONST_PERSISTENT) @@ -546,7 +540,7 @@ int *key_sizes; MCRYPT_GET_TD_ARG - MCRYPT_INIT_RETURN_ARRAY + array_init(return_value); key_sizes = mcrypt_enc_get_supported_key_sizes(td, &count); @@ -797,7 +791,7 @@ int *key_sizes; MCRYPT_GET_MODE_DIR_ARGS(algorithms_dir) - MCRYPT_INIT_RETURN_ARRAY + array_init(return_value); key_sizes = mcrypt_module_get_algo_supported_key_sizes(module, dir, &count); @@ -823,7 +817,7 @@ return; } - MCRYPT_INIT_RETURN_ARRAY + array_init(return_value); modules = mcrypt_list_algorithms(lib_dir, &count); if (count == 0) { @@ -851,7 +845,7 @@ return; } - MCRYPT_INIT_RETURN_ARRAY + array_init(return_value); modules = mcrypt_list_modes(lib_dir, &count); if (count == 0) { Index: php4/ext/mcal/php_mcal.c diff -u php4/ext/mcal/php_mcal.c:1.53 php4/ext/mcal/php_mcal.c:1.54 --- php4/ext/mcal/php_mcal.c:1.53 Tue Dec 31 11:06:54 2002 +++ php4/ext/mcal/php_mcal.c Sat Jan 18 14:41:50 2003 @@ -533,9 +533,7 @@ } /* Initialize return array */ - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (myargc == 7) { convert_to_long_ex(startyear); @@ -651,9 +649,7 @@ RETURN_FALSE; } - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); if (myargc == 7) { convert_to_long_ex(year); Index: php4/ext/interbase/interbase.c diff -u php4/ext/interbase/interbase.c:1.97 php4/ext/interbase/interbase.c:1.98 --- php4/ext/interbase/interbase.c:1.97 Wed Jan 15 14:36:13 2003 +++ php4/ext/interbase/interbase.c Sat Jan 18 14:41:52 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interbase.c,v 1.97 2003/01/15 19:36:13 iliaa Exp $ */ +/* $Id: interbase.c,v 1.98 2003/01/18 19:41:52 iliaa Exp $ */ /* TODO: Arrays, roles? @@ -609,7 +609,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Interbase Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.97 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.98 $"); #ifdef COMPILE_DL_INTERBASE php_info_print_table_row(2, "Dynamic Module", "yes"); #endif @@ -1982,9 +1982,7 @@ RETURN_FALSE; } - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); arr_cnt = 0; var = ib_result->out_sqlda->sqlvar; @@ -2427,8 +2425,7 @@ if (Z_LVAL_PP(field_arg)<0 || Z_LVAL_PP(field_arg)>=ib_result->out_sqlda->sqld) RETURN_FALSE; - if (array_init(return_value)==FAILURE) - RETURN_FALSE; + array_init(return_value); var = ib_result->out_sqlda->sqlvar + Z_LVAL_PP(field_arg); @@ -2762,9 +2759,7 @@ GET_BLOB_ID_ARG(*blob_arg, ib_blob_id); - if (array_init(return_value)==FAILURE){ - RETURN_FALSE; - } + array_init(return_value); if (ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low) { /*not null ?*/ if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle, Index: php4/ext/ingres_ii/ii.c diff -u php4/ext/ingres_ii/ii.c:1.32 php4/ext/ingres_ii/ii.c:1.33 --- php4/ext/ingres_ii/ii.c:1.32 Tue Dec 31 11:06:47 2002 +++ php4/ext/ingres_ii/ii.c Sat Jan 18 14:41:55 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ii.c,v 1.32 2002/12/31 16:06:47 sebastian Exp $ */ +/* $Id: ii.c,v 1.33 2003/01/18 19:41:55 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1067,9 +1067,7 @@ int len, should_copy, correct_length; /* array initialization */ - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); /* going through all fields */ for (i = 1; i <= ii_link->fieldCount;) { Index: php4/ext/informix/ifx.ec diff -u php4/ext/informix/ifx.ec:1.72 php4/ext/informix/ifx.ec:1.73 --- php4/ext/informix/ifx.ec:1.72 Wed Jan 15 12:22:02 2003 +++ php4/ext/informix/ifx.ec Sat Jan 18 14:41:56 2003 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ifx.ec,v 1.72 2003/01/15 17:22:02 iliaa Exp $ */ +/* $Id: ifx.ec,v 1.73 2003/01/18 19:41:56 iliaa Exp $ */ /* ------------------------------------------------------------------- * if you want a function reference : "grep '^\*\*' ifx.ec" will give @@ -1741,9 +1741,7 @@ } Ifx_Result->rowid++; - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); num_fields = fieldcount; locind = 0; @@ -2365,9 +2363,7 @@ EXEC SQL set connection :ifx; PHP_IFX_CHECK_CONNECTION(ifx); - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); num_fields = fieldcount; for (i = 1; i <= num_fields; i++) { EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :fieldname = NAME, :fieldtype = TYPE; @@ -2523,9 +2519,7 @@ EXEC SQL set connection :ifx; PHP_IFX_CHECK_CONNECTION(ifx); - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); num_fields = fieldcount; for (i = 1; i <= num_fields; i++) { @@ -2681,9 +2675,7 @@ ZEND_FETCH_RESOURCE(Ifx_Result, IFX_RES *, result, -1, "Informix Result", le_result); /* create pseudo-row array to return */ - if (array_init(return_value)==FAILURE) { - RETURN_FALSE; - } + array_init(return_value); /* fill array with 6 fields sqlerrd0 .. sqlerrd5 */ /* each ESQLC call saves these sqlca values */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php