iliaa Tue Aug 29 14:32:16 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard string.c
Log:
Finalize implode() patch
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.16&r2=1.445.2.14.2.17&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.16
php-src/ext/standard/string.c:1.445.2.14.2.17
--- php-src/ext/standard/string.c:1.445.2.14.2.16 Tue Aug 29 12:20:18 2006
+++ php-src/ext/standard/string.c Tue Aug 29 14:32:16 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.16 2006/08/29 12:20:18 tony2001 Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.17 2006/08/29 14:32:16 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -905,7 +905,7 @@
case IS_LONG: {
char stmp[MAX_LENGTH_OF_LONG + 1];
- str_len = sprintf(stmp, "%ld", Z_LVAL_PP(tmp));
+ str_len = snprintf(stmp, sizeof(stmp), "%ld",
Z_LVAL_PP(tmp));
smart_str_appendl(&implstr, stmp, str_len);
}
break;
@@ -920,11 +920,10 @@
break;
case IS_DOUBLE: {
- char *stmp;
- stmp = emalloc(MAX_LENGTH_OF_DOUBLE +
EG(precision) + 1);
- str_len = sprintf(stmp, "%.*G", (int)
EG(precision), Z_DVAL_PP(tmp));
+ char *stmp = (char *)
do_alloca(MAX_LENGTH_OF_DOUBLE + EG(precision) + 2); /* +1 for decimal point */
+ str_len = snprintf(stmp, sizeof(stmp), "%.*G",
(int) EG(precision), Z_DVAL_PP(tmp));
smart_str_appendl(&implstr, stmp, str_len);
- efree(stmp);
+ free_alloca(stmp);
}
break;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php