cvs: php-src(PHP_4_3) /ext/standard string.c

From: Date: Mon, 01 Dec 2003 23:21:26 +0000
Subject: cvs: php-src(PHP_4_3) /ext/standard string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-24807@lists.php.net to get a copy of this message
iliaa Mon Dec 1 18:21:26 2003 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/standard string.c Log: MFH: Optimize substr_replace Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.333.2.37 php-src/ext/standard/string.c:1.333.2.38 --- php-src/ext/standard/string.c:1.333.2.37 Wed Nov 26 20:08:51 2003 +++ php-src/ext/standard/string.c Mon Dec 1 18:21:25 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.333.2.37 2003/11/27 01:08:51 iliaa Exp $ */ +/* $Id: string.c,v 1.333.2.38 2003/12/01 23:21:25 iliaa Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1739,11 +1739,12 @@ } result_len = Z_STRLEN_PP(str) - l + Z_STRLEN_PP(repl); - result = ecalloc(result_len + 1, sizeof(char *)); + result = emalloc(result_len + 1); memcpy(result, Z_STRVAL_PP(str), f); - memcpy(&result[f], Z_STRVAL_PP(repl), Z_STRLEN_PP(repl)); - memcpy(&result[f + Z_STRLEN_PP(repl)], Z_STRVAL_PP(str) + f + l, Z_STRLEN_PP(str) - f - l); + memcpy((result + f), Z_STRVAL_PP(repl), Z_STRLEN_PP(repl)); + memcpy((result + f + Z_STRLEN_PP(repl)), Z_STRVAL_PP(str) + f + l, Z_STRLEN_PP(str) - f - l); + result[result_len] = '\0'; RETURN_STRINGL(result, result_len, 0); }

« previous php.cvs (#24807) next »