andrei Tue Jan 24 23:09:43 2006 UTC
Modified files:
/php-src/ext/standard string.c
Log:
eurealloc() should not be used with UBYTES()
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/string.c?r1=1.514&r2=1.515&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.514 php-src/ext/standard/string.c:1.515
--- php-src/ext/standard/string.c:1.514 Tue Jan 17 12:18:52 2006
+++ php-src/ext/standard/string.c Tue Jan 24 23:09:43 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.514 2006/01/17 12:18:52 dmitry Exp $ */
+/* $Id: string.c,v 1.515 2006/01/24 23:09:43 andrei Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1211,12 +1211,12 @@
/* Append elem */
if (return_type == IS_UNICODE) {
Z_USTRVAL_P(retval) = eurealloc(Z_USTRVAL_P(retval),
-
UBYTES(Z_USTRLEN_P(retval)+Z_USTRLEN_PP(tmp)+1));
+
Z_USTRLEN_P(retval)+Z_USTRLEN_PP(tmp)+1);
memcpy(Z_USTRVAL_P(retval)+Z_USTRLEN_P(retval),
Z_USTRVAL_PP(tmp), UBYTES(Z_USTRLEN_PP(tmp)+1));
Z_USTRLEN_P(retval) += Z_USTRLEN_PP(tmp);
if (++i < numelems) { /* Append delim */
Z_USTRVAL_P(retval) =
eurealloc(Z_USTRVAL_P(retval),
-
UBYTES(Z_USTRLEN_P(retval)+Z_USTRLEN_P(delim)+1));
+
Z_USTRLEN_P(retval)+Z_USTRLEN_P(delim)+1);
memcpy(Z_USTRVAL_P(retval)+Z_USTRLEN_P(retval),
Z_USTRVAL_P(delim), UBYTES(Z_USTRLEN_P(delim)+1));
Z_USTRLEN_P(retval) += Z_USTRLEN_P(delim);
}
@@ -2942,7 +2942,7 @@
}
if (Z_TYPE_PP(str) == IS_UNICODE) {
- buf = emalloc(UBYTES(Z_USTRLEN_PP(str) -l + repl_len + 1));
+ buf = eumalloc(Z_USTRLEN_PP(str) -l + repl_len + 1);
/* buf_len is codept count here */
buf_len = 0; idx = 0;
@@ -2959,7 +2959,7 @@
buf_len += (Z_USTRLEN_PP(str) - idx);
*((UChar *)buf + buf_len) = 0;
- buf = erealloc(buf, UBYTES(buf_len + 1));
+ buf = eurealloc(buf, buf_len + 1);
} else {
/* buf_len is char count here */
buf_len = Z_STRLEN_PP(str) - l + repl_len;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php