cvs: php4(PHP_4_3) /ext/standard metaphone.c pack.c reg.c
| From: | Ilia Alshanetsky | Date: | Tue, 22 Apr 2003 01:38:36 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/standard metaphone.c pack.c reg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20421@lists.php.net to get a copy of this message | ||
iliaa Mon Apr 21 21:38:36 2003 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/standard metaphone.c pack.c reg.c
Log:
emalloc -> safe_emalloc.
Index: php4/ext/standard/metaphone.c
diff -u php4/ext/standard/metaphone.c:1.21.4.3 php4/ext/standard/metaphone.c:1.21.4.4
--- php4/ext/standard/metaphone.c:1.21.4.3 Sat Apr 19 01:09:52 2003
+++ php4/ext/standard/metaphone.c Mon Apr 21 21:38:36 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: metaphone.c,v 1.21.4.3 2003/04/19 05:09:52 sas Exp $ */
+/* $Id: metaphone.c,v 1.21.4.4 2003/04/22 01:38:36 iliaa Exp $ */
/*
Based on CPANs "Text-Metaphone-1.96" by Michael G Schwern <schwern@pobox.com>
@@ -183,12 +183,12 @@
/*-- Allocate memory for our phoned_phrase --*/
if (max_phonemes == 0) { /* Assume largest possible */
max_buffer_len = word_len;
- *phoned_word = emalloc(sizeof(char) * word_len + 1);
+ *phoned_word = safe_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);
+ *phoned_word = safe_emalloc(sizeof(char), max_phonemes, 1);
if (!*phoned_word)
return -1;
}
Index: php4/ext/standard/pack.c
diff -u php4/ext/standard/pack.c:1.40.2.3 php4/ext/standard/pack.c:1.40.2.4
--- php4/ext/standard/pack.c:1.40.2.3 Tue Dec 31 11:35:32 2002
+++ php4/ext/standard/pack.c Mon Apr 21 21:38:36 2003
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.40.2.3 2002/12/31 16:35:32 sebastian Exp $ */
+/* $Id: pack.c,v 1.40.2.4 2003/04/22 01:38:36 iliaa Exp $ */
#include "php.h"
@@ -122,7 +122,7 @@
WRONG_PARAM_COUNT;
}
- argv = emalloc(argc * sizeof(zval **));
+ argv = safe_emalloc(sizeof(zval **), argc, 0);
if (zend_get_parameters_array_ex(argc, argv) == FAILURE) {
efree(argv);
@@ -134,8 +134,8 @@
formatlen = Z_STRLEN_PP(argv[0]);
/* We have a maximum of <formatlen> format codes to deal with */
- formatcodes = emalloc(formatlen * sizeof(*formatcodes));
- formatargs = emalloc(formatlen * sizeof(*formatargs));
+ formatcodes = safe_emalloc(formatlen, sizeof(*formatcodes), 0);
+ formatargs = safe_emalloc(formatlen, sizeof(*formatargs), 0);
currentarg = 1;
/* Preprocess format into formatcodes and formatargs */
Index: php4/ext/standard/reg.c
diff -u php4/ext/standard/reg.c:1.66.2.6 php4/ext/standard/reg.c:1.66.2.7
--- php4/ext/standard/reg.c:1.66.2.6 Mon Feb 24 11:56:25 2003
+++ php4/ext/standard/reg.c Mon Apr 21 21:38:36 2003
@@ -17,7 +17,7 @@
| Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
+----------------------------------------------------------------------+
*/
-/* $Id: reg.c,v 1.66.2.6 2003/02/24 16:56:25 moriyoshi Exp $ */
+/* $Id: reg.c,v 1.66.2.7 2003/04/22 01:38:36 iliaa Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -118,7 +118,7 @@
/* get the length of the message */
buf_len = regerror(REG_ITOA | err, re, NULL, 0);
if (buf_len) {
- buf = (char *)emalloc(buf_len * sizeof(char));
+ buf = (char *)safe_emalloc(buf_len, sizeof(char), 0);
if (!buf) return; /* fail silently */
/* finally, get the error message */
regerror(REG_ITOA | err, re, buf, buf_len);
@@ -130,7 +130,7 @@
if (len) {
TSRMLS_FETCH();
- message = (char *)emalloc((buf_len + len + 2) * sizeof(char));
+ message = (char *)safe_emalloc((buf_len + len + 2), sizeof(char), 0);
if (!message) {
return; /* fail silently */
}
@@ -298,7 +298,7 @@
/* start with a buffer that is twice the size of the stringo
we're doing replacements in */
buf_len = 2 * string_len + 1;
- buf = emalloc(buf_len * sizeof(char));
+ buf = safe_emalloc(buf_len, sizeof(char), 0);
err = pos = 0;
buf[0] = '\0';
@@ -373,7 +373,7 @@
new_l = strlen (buf) + 1;
if (new_l + 1 > buf_len) {
buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
+ nbuf = safe_emalloc(buf_len, sizeof(char), 0);
strcpy(nbuf, buf);
efree(buf);
buf = nbuf;
@@ -388,7 +388,7 @@
new_l = strlen(buf) + strlen(&string[pos]);
if (new_l + 1 > buf_len) {
buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
+ nbuf = safe_emalloc(buf_len, sizeof(char), 0);
strcpy(nbuf, buf);
efree(buf);
buf = nbuf;
@@ -607,7 +607,7 @@
}
convert_to_string_ex(string);
- tmp = emalloc((Z_STRLEN_PP(string) * 4) + 1);
+ tmp = safe_emalloc(Z_STRLEN_PP(string), 4, 1);
for (i = j = 0; i < Z_STRLEN_PP(string); i++) {
c = (unsigned char) Z_STRVAL_PP(string)[i];