iliaa Sat Jan 18 15:01:48 2003 EDT
Modified files:
/php4/ext/standard exec.c file.c image.c info.c metaphone.c
string.c
Log:
Removed pointless memory allocation checks.
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.91 php4/ext/standard/exec.c:1.92
--- php4/ext/standard/exec.c:1.91 Wed Jan 15 11:29:00 2003
+++ php4/ext/standard/exec.c Sat Jan 18 15:01:40 2003
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.91 2003/01/15 16:29:00 wez Exp $ */
+/* $Id: exec.c,v 1.92 2003/01/18 20:01:40 iliaa Exp $ */
#include <stdio.h>
#include "php.h"
@@ -67,10 +67,6 @@
#endif
buf = (char *) emalloc(EXEC_INPUT_BUF);
- if (!buf) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to emalloc %d
bytes for exec buffer", EXEC_INPUT_BUF);
- return -1;
- }
buflen = EXEC_INPUT_BUF;
if (PG(safe_mode)) {
@@ -162,14 +158,6 @@
do {
if ( buflen <= (l+1) ) {
buf = erealloc(buf, buflen + EXEC_INPUT_BUF);
- if ( buf == NULL ) {
- php_error_docref(NULL TSRMLS_CC,
E_WARNING, "Unable to erealloc %d bytes for exec buffer",
- buflen +
EXEC_INPUT_BUF);
-#if PHP_SIGCHILD
- signal (SIGCHLD, sig_handler);
-#endif
- return -1;
- }
buflen += EXEC_INPUT_BUF;
}
Index: php4/ext/standard/file.c
diff -u php4/ext/standard/file.c:1.294 php4/ext/standard/file.c:1.295
--- php4/ext/standard/file.c:1.294 Sat Jan 18 09:10:22 2003
+++ php4/ext/standard/file.c Sat Jan 18 15:01:41 2003
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.294 2003/01/18 14:10:22 wez Exp $ */
+/* $Id: file.c,v 1.295 2003/01/18 20:01:41 iliaa Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1495,7 +1495,7 @@
WRONG_PARAM_COUNT;
}
args = (zval ***)emalloc(argCount * sizeof(zval **));
- if (!args || (zend_get_parameters_array_ex(argCount, args) == FAILURE)) {
+ if (zend_get_parameters_array_ex(argCount, args) == FAILURE) {
efree( args );
WRONG_PARAM_COUNT;
}
Index: php4/ext/standard/image.c
diff -u php4/ext/standard/image.c:1.84 php4/ext/standard/image.c:1.85
--- php4/ext/standard/image.c:1.84 Fri Jan 17 13:51:30 2003
+++ php4/ext/standard/image.c Sat Jan 18 15:01:43 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: image.c,v 1.84 2003/01/17 18:51:30 helly Exp $ */
+/* $Id: image.c,v 1.85 2003/01/18 20:01:43 iliaa Exp $ */
#include "php.h"
#include <stdio.h>
@@ -215,10 +215,6 @@
do {
szlength=slength*(1<<factor++);
buf = (char *) erealloc(buf,szlength);
- if (!buf) {
- status = 1;
- break;
- }
status = uncompress(buf, &szlength, bufz, slength);
} while ((status==Z_BUF_ERROR)&&(factor<maxfactor));
@@ -439,7 +435,6 @@
length -= 2; /* length includes itself */
buffer = emalloc(length);
- if ( !buffer) return;
if (php_stream_read(stream, buffer, (long) length) <= 0) {
efree(buffer);
@@ -485,8 +480,6 @@
if (result == NULL) {
/* handle SOFn block */
result = (struct gfxinfo *) ecalloc(1,
sizeof(struct gfxinfo));
- if ( !result)
- return NULL;
length = php_read2(stream TSRMLS_CC);
result->bits = php_stream_getc(stream);
result->height = php_read2(stream TSRMLS_CC);
@@ -605,9 +598,6 @@
}
result = (struct gfxinfo *)ecalloc(1, sizeof(struct gfxinfo));
- if (!result) {
- return NULL;
- }
dummy_short = php_read2(stream TSRMLS_CC); /* Lsiz */
dummy_short = php_read2(stream TSRMLS_CC); /* Rsiz */
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.223 php4/ext/standard/info.c:1.224
--- php4/ext/standard/info.c:1.223 Fri Jan 17 13:07:10 2003
+++ php4/ext/standard/info.c Sat Jan 18 15:01:43 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.223 2003/01/17 18:07:10 derick Exp $ */
+/* $Id: info.c,v 1.224 2003/01/18 20:01:43 iliaa Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -439,10 +439,7 @@
for
(zend_hash_internal_pointer_reset(url_stream_wrappers_hash);
zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol,
&stream_protocol_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
zend_hash_move_forward(url_stream_wrappers_hash)) {
- if (NULL == (stream_protocols_buf =
erealloc(stream_protocols_buf,
-
stream_protocols_buf_len + stream_protocol_len + 2 /* ", " */ + 1 /* 0 byte at end
*/))) {
- break;
- }
+ stream_protocols_buf =
+erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 +
+1);
memcpy(stream_protocols_buf +
stream_protocols_buf_len, stream_protocol, stream_protocol_len);
stream_protocols_buf[stream_protocols_buf_len
+ stream_protocol_len] = ',';
stream_protocols_buf[stream_protocols_buf_len
+ stream_protocol_len + 1] = ' ';
Index: php4/ext/standard/metaphone.c
diff -u php4/ext/standard/metaphone.c:1.22 php4/ext/standard/metaphone.c:1.23
--- php4/ext/standard/metaphone.c:1.22 Tue Dec 31 11:07:48 2002
+++ php4/ext/standard/metaphone.c Sat Jan 18 15:01:46 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: metaphone.c,v 1.22 2002/12/31 16:07:48 sebastian Exp $ */
+/* $Id: metaphone.c,v 1.23 2003/01/18 20:01:46 iliaa Exp $ */
/*
Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <[EMAIL PROTECTED]>
@@ -145,9 +145,7 @@
* could be one though; or more too). */
#define Phonize(c) { \
if (p_idx >= max_buffer_len) { \
- if (NULL == (*phoned_word =
erealloc(*phoned_word, max_buffer_len + 2))) { \
- return -1; \
- } \
+ *phoned_word =
+erealloc(*phoned_word, max_buffer_len + 2); \
max_buffer_len += 2; \
} \
(*phoned_word)[p_idx++] = c; \
@@ -185,13 +183,9 @@
if (max_phonemes == 0) { /* Assume largest possible */
max_buffer_len = word_len;
*phoned_word = emalloc(sizeof(char) * word_len + 1);
- if (!*phoned_word)
- return -1;
} else {
max_buffer_len = max_phonemes;
*phoned_word = emalloc(sizeof(char) * max_phonemes + 1);
- if (!*phoned_word)
- return -1;
}
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.346 php4/ext/standard/string.c:1.347
--- php4/ext/standard/string.c:1.346 Sat Jan 11 18:05:19 2003
+++ php4/ext/standard/string.c Sat Jan 18 15:01:46 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.346 2003/01/11 23:05:19 moriyoshi Exp $ */
+/* $Id: string.c,v 1.347 2003/01/18 20:01:46 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -113,9 +113,6 @@
size_t i, j;
result = (char *) emalloc(oldlen * 2 * sizeof(char) + 1);
- if (!result) {
- return result;
- }
for (i = j = 0; i < oldlen; i++) {
result[j++] = hexconvtab[old[i] >> 4];
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php