summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.h
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2003-08-28 05:50:15 +0000
committerSascha Schumann <sas@php.net>2003-08-28 05:50:15 +0000
commitcf1f6e3c4ca1bc5838101264e39e7ac145bb3b5c (patch)
tree6346097e0aa3340ec62a5060c78a855e5c252fdf /Zend/zend_alloc.h
parent5ef7cc4cb6b064828f1cd8d54eb97891142f9da4 (diff)
downloadphp-git-cf1f6e3c4ca1bc5838101264e39e7ac145bb3b5c.tar.gz
provide attribute((malloc)) where appropiate
Diffstat (limited to 'Zend/zend_alloc.h')
-rw-r--r--Zend/zend_alloc.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h
index a8a8886f47..e2123b1f17 100644
--- a/Zend/zend_alloc.h
+++ b/Zend/zend_alloc.h
@@ -64,10 +64,12 @@ typedef union _align_test {
#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 @@ typedef union _align_test {
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)