[FFmpeg-cvslog] r19742 - trunk/libavutil/internal.h

ramiro subversion
Sun Aug 30 00:38:48 CEST 2009


Author: ramiro
Date: Sun Aug 30 00:38:48 2009
New Revision: 19742

Log:
Add CHECKED_ALLOC macro.
It works the same as CHECKED_ALLOCZ except that it does not zero the allocated
memory.

Modified:
   trunk/libavutil/internal.h

Modified: trunk/libavutil/internal.h
==============================================================================
--- trunk/libavutil/internal.h	Sat Aug 29 23:04:18 2009	(r19741)
+++ trunk/libavutil/internal.h	Sun Aug 30 00:38:48 2009	(r19742)
@@ -249,6 +249,15 @@ if((y)<(x)){\
 #define perror please_use_av_log_instead_of_perror
 #endif
 
+#define CHECKED_ALLOC(p, size)\
+{\
+    p= av_malloc(size);\
+    if(p==NULL && (size)!=0){\
+        av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.");\
+        goto fail;\
+    }\
+}
+
 #define CHECKED_ALLOCZ(p, size)\
 {\
     p= av_mallocz(size);\



More information about the ffmpeg-cvslog mailing list