summaryrefslogtreecommitdiff
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorZuxy Meng <zuxy.meng@gmail.com>2008-03-18 15:27:15 +0000
committerBenoit Fouet <benoit.fouet@free.fr>2008-03-18 15:27:15 +0000
commit6544f48f038552973a552401cea5d4e8f1fc9c0a (patch)
treedf001b9633d7c0cd7407cc0566e21917edf73d7b /libavutil/mem.h
parent38c669d853dfa60a73bf59695ff03e7104650623 (diff)
Pure, const and malloc attributes to libavutil.
Patch by Zuxy Meng: zuxy meng gmail com Original thread: [FFmpeg-devel] [PATCH] Pure, const and malloc attributes to libavutil Date: 03/18/2008 6:09 AM Originally committed as revision 12489 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