Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_alloc.c zend_alloc.h
| From: | Andi Gutmans | Date: | Fri, 08 Apr 2005 23:49:05 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_alloc.c zend_alloc.h | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-3552@lists.php.net to get a copy of this message | ||
Yep, I was wondering about those earlier patches :)
Thanks.
At 08:15 PM 4/7/2005 +0000, Jani Taskinen wrote:
sniper Thu Apr 7 16:15:22 2005 EDTModified files:/ZendEngine2 zend_alloc.c zend_alloc.hLog: - Nuke the code duplication http://cvs.php.net/diff.php/ZendEngine2/zend_alloc.c?r1=1.142&r2=1.143&ty=u Index: ZendEngine2/zend_alloc.c diff -u ZendEngine2/zend_alloc.c:1.142 ZendEngine2/zend_alloc.c:1.143--- ZendEngine2/zend_alloc.c:1.142 Thu Apr 7 09:59:45 2005 +++ ZendEngine2/zend_alloc.c Thu Apr 7 16:15:21 2005@@ -17,7 +17,7 @@+----------------------------------------------------------------------+*/ -/* $Id: zend_alloc.c,v 1.142 2005/04/07 13:59:45 zeev Exp $ */ +/* $Id: zend_alloc.c,v 1.143 2005/04/07 20:15:21 sniper Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -409,16 +409,6 @@return p;} -#if !USE_ZEND_ALLOC -char *_strndup(char *s, uint l) -{- char *tmp = malloc(l+1); - tmp[l] = '\0'; - memcpy(tmp, s, l); - return tmp;-} -#endif - ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) {char *p;http://cvs.php.net/diff.php/ZendEngine2/zend_alloc.h?r1=1.60&r2=1.61&ty=u Index: ZendEngine2/zend_alloc.h diff -u ZendEngine2/zend_alloc.h:1.60 ZendEngine2/zend_alloc.h:1.61--- ZendEngine2/zend_alloc.h:1.60 Thu Apr 7 12:22:15 2005 +++ ZendEngine2/zend_alloc.h Thu Apr 7 16:15:21 2005@@ -17,7 +17,7 @@+----------------------------------------------------------------------+*/ -/* $Id: zend_alloc.h,v 1.60 2005/04/07 16:22:15 sniper Exp $ */ +/* $Id: zend_alloc.h,v 1.61 2005/04/07 20:15:21 sniper Exp $ */ #ifndef ZEND_ALLOC_H #define ZEND_ALLOC_H @@ -125,17 +125,12 @@ #define perealloc_recoverable_rel(ptr, size, persistent) ((persistent)?realloc((ptr), (size)):erealloc_recoverable_rel((ptr), (size))) #define pestrdup_rel(s, persistent) ((persistent)?strdup(s):estrdup_rel(s)) -#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC()) -#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC()) - #else #define _GNU_SOURCE #include <string.h> #undef _GNU_SOURCE -char *_strndup(char *s, uint l); - /* Standard wrapper macros */#define emalloc(size) malloc(size) #define safe_emalloc(nmemb, size, offset) malloc((nmemb) * (size) + (offset))@@ -144,7 +139,7 @@#define erealloc(ptr, size) realloc((ptr), (size)) #define erealloc_recoverable(ptr, size) realloc((ptr), (size)) #define estrdup(s) strdup(s) -#define estrndup(s, length) _strndup((s), (length)) +#define estrndup(s, length) zend_strndup((s), (length))/* Relay wrapper macros */#define emalloc_rel(size) malloc(size)@@ -154,7 +149,7 @@ #define erealloc_rel(ptr,size) realloc((ptr), (size)) #define erealloc_recoverable_rel(ptr, size) realloc((ptr), (size)) #define estrdup_rel(s) strdup(s) -#define estrndup_rel(s, length) _strndup((s), (length)) +#define estrndup_rel(s, length) zend_strndup((s), (length))/* Selective persistent/non persistent allocation macros */#define pemalloc(size, persistent) malloc(size)@@ -172,10 +167,10 @@ #define perealloc_recoverable_rel(ptr, size,persistent) realloc((ptr), (size)) #define pestrdup_rel(s, persistent) strdup(s)-#define safe_estrdup(ptr) ((ptr)?(strdup(ptr)):(STR_EMPTY_ALLOC())) -#define safe_estrndup(ptr, len) ((ptr)?(_strndup((ptr), (len))):(STR_EMPTY_ALLOC())) +#endif /* !USE_ZEND_ALLOC */ -#endif +#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):STR_EMPTY_ALLOC()) +#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):STR_EMPTY_ALLOC()) ZEND_API int zend_set_memory_limit(unsigned int memory_limit); -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php