cvs: ZendEngine2(PHP_5_0) / zend_alloc.c zend_alloc.h
| From: | Jani Taskinen | Date: | Thu, 07 Apr 2005 21:05:21 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_0) / zend_alloc.c zend_alloc.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3544@lists.php.net to get a copy of this message | ||
sniper Thu Apr 7 17:05:21 2005 EDT
Modified files: (Branch: PHP_5_0)
/ZendEngine2 zend_alloc.c zend_alloc.h
Log:
MFH: Nuke duplication
http://cvs.php.net/diff.php/ZendEngine2/zend_alloc.c?r1=1.137.2.2&r2=1.137.2.3&ty=u
Index: ZendEngine2/zend_alloc.c
diff -u ZendEngine2/zend_alloc.c:1.137.2.2 ZendEngine2/zend_alloc.c:1.137.2.3
--- ZendEngine2/zend_alloc.c:1.137.2.2 Thu Apr 7 10:00:00 2005
+++ ZendEngine2/zend_alloc.c Thu Apr 7 17:05:18 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_alloc.c,v 1.137.2.2 2005/04/07 14:00:00 zeev Exp $ */
+/* $Id: zend_alloc.c,v 1.137.2.3 2005/04/07 21:05:18 sniper Exp $ */
#include "zend.h"
#include "zend_alloc.h"
@@ -388,16 +388,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.52.2.2&r2=1.52.2.3&ty=u
Index: ZendEngine2/zend_alloc.h
diff -u ZendEngine2/zend_alloc.h:1.52.2.2 ZendEngine2/zend_alloc.h:1.52.2.3
--- ZendEngine2/zend_alloc.h:1.52.2.2 Thu Apr 7 10:00:00 2005
+++ ZendEngine2/zend_alloc.h Thu Apr 7 17:05:19 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_alloc.h,v 1.52.2.2 2005/04/07 14:00:00 zeev Exp $ */
+/* $Id: zend_alloc.h,v 1.52.2.3 2005/04/07 21:05:19 sniper Exp $ */
#ifndef ZEND_ALLOC_H
#define ZEND_ALLOC_H
@@ -124,16 +124,11 @@
#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)):(empty_string))
-#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
-
#else
#define _GNU_SOURCE
#include <string.h>
#undef _GNU_SOURCE
-
-char *_strndup(char *s, uint l);
/* Standard wrapper macros */
#define emalloc(size) malloc(size)
@@ -143,7 +138,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)
@@ -153,7 +148,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)
@@ -169,11 +164,10 @@
#define perealloc_rel(ptr, size, persistent) realloc((ptr), (size))
#define perealloc_recoverable_rel(ptr, size, persistent) realloc((ptr), (size))
#define pestrdup_rel(s, persistent) strdup(s)
+#endif /* !USE_ZEND_ALLOC */
-#define safe_estrdup(ptr) ((ptr)?(strdup(ptr)):(empty_string))
-#define safe_estrndup(ptr, len) ((ptr)?(_strndup((ptr), (len))):(empty_string))
-
-#endif
+#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
+#define safe_estrndup(ptr, len) ((ptr)?(estrndup((ptr), (len))):(empty_string))
ZEND_API int zend_set_memory_limit(unsigned int memory_limit);