On Sat, 2004-08-07 at 02:45, Andi Gutmans wrote:
> andi          Fri Aug  6 20:45:34 2004 EDT
> 
>   Modified files:              
>     /ZendEngine2      zend_alloc.h 
>   Log:
>   - Commit Derick's patch for allowing Zend to use regular libc memory
>   - allocation functions. Mainly useful in conjunction with tools such as
>   - valgrind which enables us to find bugs we might not find with the 
>   - current memory managers boundary protection.

Hi,

attached is a patch that fixes the build with
#define USE_ZEND_ALLOC 0

on FreeBSD (due to the missing strndup() in its libc). I have also
replaced empty_string with STR_EMPTY_ALLOC().

Regards,
-Alex
Index: Zend/zend_alloc.h
===================================================================
RCS file: /repository/ZendEngine2/zend_alloc.h,v
retrieving revision 1.58
diff -u -r1.58 zend_alloc.h
--- Zend/zend_alloc.h	11 Aug 2004 06:11:07 -0000	1.58
+++ Zend/zend_alloc.h	14 Aug 2004 12:22:19 -0000
@@ -142,7 +142,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)
@@ -152,7 +152,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)
@@ -170,8 +170,8 @@
 #define perealloc_recoverable_rel(ptr, size, persistent)	realloc((ptr), (size))
 #define pestrdup_rel(s, persistent)			strdup(s)
 
-#define safe_estrdup(ptr)  ((ptr)?(strdup(ptr)):(empty_string))
-#define safe_estrndup(ptr, len) ((ptr)?(strndup((ptr), (len))):(empty_string))
+#define safe_estrdup(ptr)  ((ptr)?(strdup(ptr)):STR_EMPTY_ALLOC())
+#define safe_estrndup(ptr, len) ((ptr)?(zend_strndup((ptr), (len))):STR_EMPTY_ALLOC())
 
 #endif
 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to