[FFmpeg-devel] [PATCH 2/3] avutil/internal: add MAKE_CHECKED_ACCESSORS()

Michael Niedermayer michaelni at gmx.at
Tue Dec 17 14:34:09 CET 2013


These are identical to MAKE_ACCESSORS, except that a user provided check function
is called on the structure first

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavutil/internal.h |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 9c5546f..a076cc3 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -89,6 +89,10 @@
     type av_##name##_get_##field(const str *s) { return s->field; } \
     void av_##name##_set_##field(str *s, type v) { s->field = v; }
 
+#define MAKE_CHECKED_ACCESSORS(str, name, type, field, check) \
+    type av_##name##_get_##field(const str *s) { check(s); return s->field; } \
+    void av_##name##_set_##field(str *s, type v) { check(s); s->field = v; }
+
 // Some broken preprocessors need a second expansion
 // to be forced to tokenize __VA_ARGS__
 #define E1(x) x
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list