iliaa Sat Jan 18 14:28:10 2003 EDT
Modified files:
/php4/ext/zlib zlib.c
/php4/ext/xml php_xml.h xml.c
/php4/ext/sockets sockets.c
/php4/ext/session session.c
/php4/ext/qtdom qtdom.c
/php4/ext/pspell pspell.c
/php4/ext/posix posix.c
/php4/ext/pgsql pgsql.c
/php4/ext/pdf pdf.c
/php4/ext/ovrimos ovrimos.c
Log:
Removed pointless memory allocation checks.
Index: php4/ext/zlib/zlib.c
diff -u php4/ext/zlib/zlib.c:1.159 php4/ext/zlib/zlib.c:1.160
--- php4/ext/zlib/zlib.c:1.159 Tue Dec 31 11:08:15 2002
+++ php4/ext/zlib/zlib.c Sat Jan 18 14:28:05 2003
@@ -18,7 +18,7 @@
| Jade Nicoletti <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: zlib.c,v 1.159 2002/12/31 16:08:15 sebastian Exp $ */
+/* $Id: zlib.c,v 1.160 2003/01/18 19:28:05 iliaa Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -303,9 +303,7 @@
}
/* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
/* Now loop through the file and do the magic quotes thing if needed */
memset(buf,0,sizeof(buf));
@@ -495,7 +493,6 @@
do {
length=plength?plength:Z_STRLEN_PP(data)*(1<<factor++);
s2 = (char *) erealloc(s1,length);
- if(! s2) { if(s1) efree(s1); RETURN_FALSE; }
status = uncompress(s2, &length ,Z_STRVAL_PP(data), Z_STRLEN_PP(data));
s1=s2;
} while((status==Z_BUF_ERROR)&&(!plength)&&(factor<maxfactor));
@@ -820,8 +817,6 @@
stream.avail_out = stream.avail_in + (stream.avail_in/1000) + 15 + 1; /* room
for \0 */
s2 = (char *)
emalloc(stream.avail_out+GZIP_HEADER_LENGTH+(coding==CODING_GZIP?GZIP_FOOTER_LENGTH:0));
- if(!s2)
- RETURN_FALSE;
/* add gzip file header */
s2[0] = gz_magic[0];
Index: php4/ext/xml/php_xml.h
diff -u php4/ext/xml/php_xml.h:1.20 php4/ext/xml/php_xml.h:1.21
--- php4/ext/xml/php_xml.h:1.20 Tue Dec 31 11:08:07 2002
+++ php4/ext/xml/php_xml.h Sat Jan 18 14:28:06 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.h,v 1.20 2002/12/31 16:08:07 sebastian Exp $ */
+/* $Id: php_xml.h,v 1.21 2003/01/18 19:28:06 iliaa Exp $ */
#ifndef PHP_XML_H
#define PHP_XML_H
@@ -97,10 +97,6 @@
PHP_XML_OPTION_SKIP_TAGSTART,
PHP_XML_OPTION_SKIP_WHITE
};
-
-#define RETURN_OUT_OF_MEMORY \
- php_error(E_WARNING, "Out of memory");\
- RETURN_FALSE
/* for xml_parse_into_struct */
Index: php4/ext/xml/xml.c
diff -u php4/ext/xml/xml.c:1.113 php4/ext/xml/xml.c:1.114
--- php4/ext/xml/xml.c:1.113 Tue Dec 31 11:08:08 2002
+++ php4/ext/xml/xml.c Sat Jan 18 14:28:06 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml.c,v 1.113 2002/12/31 16:08:08 sebastian Exp $ */
+/* $Id: xml.c,v 1.114 2003/01/18 19:28:06 iliaa Exp $ */
#define IS_EXT_MODULE
@@ -594,12 +594,7 @@
if (zend_hash_find(Z_ARRVAL_P(parser->info),name,strlen(name) + 1,(void **)
&element) == FAILURE) {
MAKE_STD_ZVAL(values);
- if (array_init(values) == FAILURE) {
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to
initialize array");
- return;
- }
+ array_init(values);
zend_hash_update(Z_ARRVAL_P(parser->info), name, strlen(name)+1, (void
*) &values, sizeof(zval*), (void **) &element);
}
Index: php4/ext/sockets/sockets.c
diff -u php4/ext/sockets/sockets.c:1.130 php4/ext/sockets/sockets.c:1.131
--- php4/ext/sockets/sockets.c:1.130 Mon Jan 13 21:39:10 2003
+++ php4/ext/sockets/sockets.c Sat Jan 18 14:28:06 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.130 2003/01/14 02:39:10 iliaa Exp $ */
+/* $Id: sockets.c,v 1.131 2003/01/18 19:28:06 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -473,10 +473,9 @@
/* {{{ PHP_RINIT_FUNCTION */
PHP_RINIT_FUNCTION(sockets)
{
- if ((SOCKETS_G(strerror_buf) = emalloc(16384)))
- return SUCCESS;
-
- return FAILURE;
+ SOCKETS_G(strerror_buf) = emalloc(16384);
+
+ return SUCCESS;
}
/* }}} */
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.346 php4/ext/session/session.c:1.347
--- php4/ext/session/session.c:1.346 Thu Jan 16 02:21:49 2003
+++ php4/ext/session/session.c Sat Jan 18 14:28:07 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.346 2003/01/16 07:21:49 sas Exp $ */
+/* $Id: session.c,v 1.347 2003/01/18 19:28:07 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1225,10 +1225,7 @@
WRONG_PARAM_COUNT;
}
- if (array_init(return_value) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot initialize return
value from session_get_cookie_parameters");
- RETURN_FALSE;
- }
+ array_init(return_value);
add_assoc_long(return_value, "lifetime", PS(cookie_lifetime));
add_assoc_string(return_value, "path", PS(cookie_path), 1);
Index: php4/ext/qtdom/qtdom.c
diff -u php4/ext/qtdom/qtdom.c:1.18 php4/ext/qtdom/qtdom.c:1.19
--- php4/ext/qtdom/qtdom.c:1.18 Tue Jan 14 21:54:52 2003
+++ php4/ext/qtdom/qtdom.c Sat Jan 18 14:28:07 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: qtdom.c,v 1.18 2003/01/15 02:54:52 iliaa Exp $ */
+/* $Id: qtdom.c,v 1.19 2003/01/18 19:28:07 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -119,8 +119,7 @@
count = 0;
MAKE_STD_ZVAL(*children);
- if (array_init(*children) == FAILURE)
- return -1;
+ array_init(*children);
for ( i = 0; i < attr->Count; ++i )
{
node = qdom_do_attribute_at( attr, i );
@@ -158,8 +157,7 @@
/* node = orig_node; */
MAKE_STD_ZVAL(*children);
- if (array_init(*children) == FAILURE)
- return -1;
+ array_init(*children);
while( node )
{
int num_childs, num_attrs;
Index: php4/ext/pspell/pspell.c
diff -u php4/ext/pspell/pspell.c:1.29 php4/ext/pspell/pspell.c:1.30
--- php4/ext/pspell/pspell.c:1.29 Tue Dec 31 11:07:19 2002
+++ php4/ext/pspell/pspell.c Sat Jan 18 14:28:07 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pspell.c,v 1.29 2002/12/31 16:07:19 sebastian Exp $ */
+/* $Id: pspell.c,v 1.30 2003/01/18 19:28:07 iliaa Exp $ */
#define IS_EXT_MODULE
@@ -355,9 +355,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE){
- RETURN_FALSE;
- }
+ array_init(return_value);
wl = pspell_manager_suggest(manager, Z_STRVAL_PP(word));
if(wl){
Index: php4/ext/posix/posix.c
diff -u php4/ext/posix/posix.c:1.52 php4/ext/posix/posix.c:1.53
--- php4/ext/posix/posix.c:1.52 Tue Dec 31 11:07:18 2002
+++ php4/ext/posix/posix.c Sat Jan 18 14:28:08 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: posix.c,v 1.52 2002/12/31 16:07:18 sebastian Exp $ */
+/* $Id: posix.c,v 1.53 2003/01/18 19:28:08 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -130,7 +130,7 @@
static PHP_MINFO_FUNCTION(posix)
{
php_info_print_table_start();
- php_info_print_table_row(2, "Revision", "$Revision: 1.52 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.53 $");
php_info_print_table_end();
}
/* }}} */
@@ -366,12 +366,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- /* TODO: Should we issue a warning here so we don't have ambiguity
- * with the above return value ?
- */
- RETURN_FALSE;
- }
+ array_init(return_value);
for (i=0; i<result; i++) {
add_next_index_long(return_value, gidlist[i]);
@@ -501,12 +496,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- /* TODO: Should we issue a warning here so we don't have ambiguity
- * with the above return value ?
- */
- RETURN_FALSE;
- }
+ array_init(return_value);
add_assoc_string(return_value, "sysname", u.sysname, 1);
add_assoc_string(return_value, "nodename", u.nodename, 1);
@@ -538,12 +528,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- /* TODO: Should we issue a warning here so we don't have ambiguity
- * with the above return value ?
- */
- RETURN_FALSE;
- }
+ array_init(return_value);
add_assoc_long(return_value, "ticks", ticks); /* clock ticks
*/
add_assoc_long(return_value, "utime", t.tms_utime); /* user time */
@@ -736,8 +721,7 @@
return 0;
MAKE_STD_ZVAL(array_members);
- if (array_init(array_members) == FAILURE)
- return 0;
+ array_init(array_members);
add_assoc_string(array_group, "name", g->gr_name, 1);
add_assoc_string(array_group, "passwd", g->gr_passwd, 1);
@@ -779,12 +763,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- /* TODO: Should we issue a warning here so we don't have ambiguity
- * with the above return value ?
- */
- RETURN_FALSE;
- }
+ array_init(return_value);
if (!php_posix_group_to_array(g, return_value)) {
php_error(E_WARNING, "%s() unable to convert posix group to array",
@@ -809,12 +788,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- /* TODO: Should we issue a warning here so we don't have ambiguity
- * with the above return value ?
- */
- RETURN_FALSE;
- }
+ array_init(return_value);
if (!php_posix_group_to_array(g, return_value)) {
php_error(E_WARNING, "%s() unable to convert posix group struct to
array",
@@ -856,9 +830,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
if (!php_posix_passwd_to_array(pw, return_value)) {
php_error(E_WARNING, "%s() unable to convert posix passwd struct to
array",
@@ -884,9 +856,7 @@
RETURN_FALSE;
}
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
if (!php_posix_passwd_to_array(pw, return_value)) {
php_error(E_WARNING, "%s() unable to convert posix passwd struct to
array",
@@ -1002,9 +972,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE)
return;
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
for (l=limits; l->name; l++) {
if (posix_addlimit(l->limit, l->name, return_value TSRMLS_CC) ==
FAILURE)
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.256 php4/ext/pgsql/pgsql.c:1.257
--- php4/ext/pgsql/pgsql.c:1.256 Wed Jan 15 05:21:15 2003
+++ php4/ext/pgsql/pgsql.c Sat Jan 18 14:28:08 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.256 2003/01/15 10:21:15 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.257 2003/01/18 19:28:08 iliaa Exp $ */
#include <stdlib.h>
@@ -2442,9 +2442,7 @@
case PGRES_COPY_OUT:
if (pgsql_result) {
PQclear(pgsql_result);
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
while (!copydone)
{
if ((ret = PQgetline(pgsql, copybuf,
COPYBUFSIZ))) {
@@ -3259,11 +3257,7 @@
return FAILURE;
}
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t), re.re_nsub+1);
- if (!subs) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate memory.");
- regfree(&re);
- return FAILURE;
- }
+
regerr = regexec(&re, str, re.re_nsub+1, subs, 0);
if (regerr == REG_NOMATCH) {
#ifdef PHP_DEBUG
@@ -3343,11 +3337,7 @@
return FAILURE;
}
MAKE_STD_ZVAL(meta);
- if (array_init(meta) == FAILURE) {
- zval_dtor(meta);
- FREE_ZVAL(meta);
- return FAILURE;
- }
+ array_init(meta);
if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
zval_dtor(meta);
FREE_ZVAL(meta);
Index: php4/ext/pdf/pdf.c
diff -u php4/ext/pdf/pdf.c:1.116 php4/ext/pdf/pdf.c:1.117
--- php4/ext/pdf/pdf.c:1.116 Thu Jan 16 16:18:48 2003
+++ php4/ext/pdf/pdf.c Sat Jan 18 14:28:09 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdf.c,v 1.116 2003/01/16 21:18:48 iliaa Exp $ */
+/* $Id: pdf.c,v 1.117 2003/01/18 19:28:09 iliaa Exp $ */
/* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE.
Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */
@@ -331,7 +331,7 @@
#else
php_info_print_table_row(2, "PDFlib GmbH Version", tmp );
#endif
- php_info_print_table_row(2, "Revision", "$Revision: 1.116 $" );
+ php_info_print_table_row(2, "Revision", "$Revision: 1.117 $" );
php_info_print_table_end();
}
@@ -2459,9 +2459,7 @@
array = Z_ARRVAL_PP(arg2);
len = zend_hash_num_elements(array);
- if (NULL == (darray = emalloc(len * sizeof(double)))) {
- RETURN_FALSE;
- }
+ darray = emalloc(len * sizeof(double));
zend_hash_internal_pointer_reset(array);
for (i=0; i<len; i++) {
zval *keydata, **keydataptr;
Index: php4/ext/ovrimos/ovrimos.c
diff -u php4/ext/ovrimos/ovrimos.c:1.19 php4/ext/ovrimos/ovrimos.c:1.20
--- php4/ext/ovrimos/ovrimos.c:1.19 Tue Dec 31 11:07:11 2002
+++ php4/ext/ovrimos/ovrimos.c Sat Jan 18 14:28:10 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ovrimos.c,v 1.19 2002/12/31 16:07:11 sebastian Exp $ */
+/* $Id: ovrimos.c,v 1.20 2003/01/18 19:28:10 iliaa Exp $ */
#include <php.h>
#include <php_globals.h>
@@ -102,7 +102,6 @@
}
state = ecalloc( 1, sizeof(CON_STATE));
- if (state==NULL) RETURN_FALSE;
state->connection = conn;
state->statements = NULL;
@@ -185,10 +184,7 @@
if (!ret) return ret;
state->nstatements++;
- state->statements = erealloc( state->statements,
- state->nstatements*sizeof( STATEMENT));
-
- if (state->statements==NULL) return 0;
+ state->statements = erealloc(state->statements, state->nstatements*sizeof(
+STATEMENT));
index = state->nstatements - 1;
state->statements[ index].statement = (*stmt);
@@ -216,7 +212,6 @@
}
new_statements = emalloc( (state->nstatements-1) * sizeof(STATEMENT));
- if (new_statements==NULL) return 0;
for (i=j=0;i<state->nstatements;i++) {
if (state->statements->statement != stmt) {
@@ -700,11 +695,7 @@
}
if (Z_TYPE_P(arr) != IS_ARRAY) {
- if (array_init(arr) == FAILURE) {
- php_error(E_WARNING,
- "Can't convert to type Array");
- RETURN_FALSE;
- }
+ array_init(arr);
}
switch (how) {
case h_absolute:
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php