aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorZuxy Meng <zuxy.meng@gmail.com>2008-03-19 06:17:43 +0000
committerZuxy Meng <zuxy.meng@gmail.com>2008-03-19 06:17:43 +0000
commit85074d3c9388123d792995c8f98c9b5d807566b4 (patch)
tree54440eea962c4864599dd5403fc0244becb24875 /libavutil/mem.h
parentd1928ac1296a09c658ba64fe5c503979e280a2e0 (diff)
downloadffmpeg-85074d3c9388123d792995c8f98c9b5d807566b4.tar.gz
Reapply r12489: Add pure, const and malloc attributes to proper functions
in libavutil. Fix a compilation failure in r12489. Originally committed as revision 12498 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r--libavutil/mem.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h
index f8df42cfe7..c68117d43d 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -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 @@ void av_free(void *ptr);
* 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 @@ void *av_mallocz(unsigned int size);
* @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