cvs: ZendEngine2 / zend_alloc.h
| From: | Sascha Schumann | Date: | Thu, 28 Aug 2003 05:50:15 +0000 |
| Subject: | cvs: ZendEngine2 / zend_alloc.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1712@lists.php.net to get a copy of this message | ||
sas Thu Aug 28 01:50:15 2003 EDT
Modified files:
/ZendEngine2 zend_alloc.h
Log:
provide attribute((malloc)) where appropiate
Index: ZendEngine2/zend_alloc.h
diff -u ZendEngine2/zend_alloc.h:1.44 ZendEngine2/zend_alloc.h:1.45
--- ZendEngine2/zend_alloc.h:1.44 Mon Aug 18 17:17:26 2003
+++ ZendEngine2/zend_alloc.h Thu Aug 28 01:50:15 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_alloc.h,v 1.44 2003/08/18 21:17:26 zeev Exp $ */
+/* $Id: zend_alloc.h,v 1.45 2003/08/28 05:50:15 sas Exp $ */
#ifndef ZEND_ALLOC_H
#define ZEND_ALLOC_H
@@ -64,10 +64,12 @@
#define MAX_CACHED_ENTRIES 256
#define PRE_INIT_CACHE_ENTRIES 32
-#if (defined (__GNUC__) && __GNUC__ >= 2)
-#define PLATFORM_ALIGNMENT (__alignof__ (align_test))
+#if __GNUC__ -0 >= 2
+# define PLATFORM_ALIGNMENT (__alignof__ (align_test))
+# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((malloc))
#else
-#define PLATFORM_ALIGNMENT (sizeof(align_test))
+# define PLATFORM_ALIGNMENT (sizeof(align_test))
+# define ZEND_ATTRIBUTE_MALLOC
#endif
#define MEM_HEADER_PADDING
(((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
@@ -75,15 +77,15 @@
BEGIN_EXTERN_C()
-ZEND_API char *zend_strndup(const char *s, unsigned int length);
+ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
-ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
ZEND_ATTRIBUTE_MALLOC;
+ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
+ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
ZEND_ATTRIBUTE_MALLOC;
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC);
-ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
-ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC);
+ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
ZEND_ATTRIBUTE_MALLOC;
+ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC
ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
/* Standard wrapper macros */
#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)