aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2016-07-23 21:43:06 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-08-15 20:25:13 +0200
commitd3ecb24539138ef40c386ba3f4e6b002b9538cf2 (patch)
tree53e3d96f6d071af9f9ef991b92e5ef4f29ce8148
parent0f6e244bb0090ebe84147d5fab9429b29a2c1cc4 (diff)
downloadffmpeg-d3ecb24539138ef40c386ba3f4e6b002b9538cf2.tar.gz
libavutil/opt: Small bugfix in example.
Fix const corectness and zero init the struct. This example code would actually crash when initializing string. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 69630f4d304a4e35d90957d6a170744af87cbf93) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavutil/opt.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 4f2b46e9d9..d8261db70b 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -58,7 +58,7 @@
* The following example illustrates an AVOptions-enabled struct:
* @code
* typedef struct test_struct {
- * AVClass *class;
+ * const AVClass *class;
* int int_opt;
* char *str_opt;
* uint8_t *bin_opt;
@@ -96,7 +96,7 @@
* @code
* test_struct *alloc_test_struct(void)
* {
- * test_struct *ret = av_malloc(sizeof(*ret));
+ * test_struct *ret = av_mallocz(sizeof(*ret));
* ret->class = &test_class;
* av_opt_set_defaults(ret);
* return ret;