cvs: Zend(PHP_4_3) / zend_alloc.h
| From: | Sascha Schumann | Date: | Thu, 28 Aug 2003 05:47:33 +0000 |
| Subject: | cvs: Zend(PHP_4_3) / zend_alloc.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1711@lists.php.net to get a copy of this message | ||
sas Thu Aug 28 01:47:33 2003 EDT
Modified files: (Branch: PHP_4_3)
/Zend zend_alloc.h
Log:
provide attribute((malloc)) where appropiate
Index: Zend/zend_alloc.h
diff -u Zend/zend_alloc.h:1.39.4.2 Zend/zend_alloc.h:1.39.4.3
--- Zend/zend_alloc.h:1.39.4.2 Mon Apr 14 21:30:46 2003
+++ Zend/zend_alloc.h Thu Aug 28 01:47:33 2003
@@ -59,10 +59,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)
@@ -70,15 +72,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)