tony2001 Wed Dec 20 23:30:11 2006 UTC
Modified files:
/php-src/ext/standard string.c
Log:
do not allocate the return value if it wasn't requested
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.624&r2=1.625&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.624 php-src/ext/standard/string.c:1.625
--- php-src/ext/standard/string.c:1.624 Tue Dec 19 21:38:59 2006
+++ php-src/ext/standard/string.c Wed Dec 20 23:30:11 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.624 2006/12/19 21:38:59 andrei Exp $ */
+/* $Id: string.c,v 1.625 2006/12/20 23:30:11 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1679,7 +1679,7 @@
*/
PHPAPI void php_u_basename(UChar *s, int len, UChar *suffix, int sufflen,
UChar **p_ret, int *p_len TSRMLS_DC)
{
- UChar *ret = NULL, *end, *c, *comp, *cend;
+ UChar *end, *c, *comp, *cend;
int state;
c = comp = cend = s;
@@ -1713,10 +1713,9 @@
}
len = cend - comp;
- ret = eustrndup(comp, len);
if (p_ret) {
- *p_ret = ret;
+ *p_ret = eustrndup(comp, len);
}
if (p_len) {
*p_len = len;
@@ -1784,11 +1783,10 @@
}
len = cend - comp;
- ret = emalloc(len + 1);
- memcpy(ret, comp, len);
- ret[len] = '\0';
-
if (p_ret) {
+ ret = emalloc(len + 1);
+ memcpy(ret, comp, len);
+ ret[len] = '\0';
*p_ret = ret;
}
if (p_len) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php