diff mem.h @ 481:f4187c1c15a6 libavutil

Reapply r12489: Add pure, const and malloc attributes to proper functions in libavutil. Fix a compilation failure in r12489.
author zuxy
date Wed, 19 Mar 2008 06:17:43 +0000
parents 8d2c05ebf5f1
children 0b8d0ec536a8
line wrap: on
line diff
--- a/mem.h	Tue Mar 18 22:28:33 2008 +0000
+++ b/mem.h	Wed Mar 19 06:17:43 2008 +0000
@@ -42,6 +42,12 @@
     #define DECLARE_ASM_CONST(n,t,v)    static const t v
 #endif
 
+#ifdef __GNUC__
+    #define av_malloc_attrib __attribute__((__malloc__))
+#else
+    #define av_malloc_attrib
+#endif
+
 /**
  * Allocate a block of \p size bytes with alignment suitable for all
  * memory accesses (including vectors if available on the CPU).
@@ -50,7 +56,7 @@
  * it.
  * @see av_mallocz()
  */
-void *av_malloc(unsigned int size);
+void *av_malloc(unsigned int size) av_malloc_attrib;
 
 /**
  * Allocate or reallocate a block of memory.
@@ -85,7 +91,7 @@
  * it.
  * @see av_malloc()
  */
-void *av_mallocz(unsigned int size);
+void *av_mallocz(unsigned int size) av_malloc_attrib;
 
 /**
  * Duplicate the string \p s.
@@ -93,7 +99,7 @@
  * @return Pointer to a newly allocated string containing a
  * copy of \p s or NULL if it cannot be allocated.
  */
-char *av_strdup(const char *s);
+char *av_strdup(const char *s) av_malloc_attrib;
 
 /**
  * Free a memory block which has been allocated with av_malloc(z)() or