mirror of https://git.ffmpeg.org/ffmpeg.git
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 69630f4d30
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
08ab94e6a6
commit
b0453449fd
|
@ -57,7 +57,7 @@
|
||||||
* The following example illustrates an AVOptions-enabled struct:
|
* The following example illustrates an AVOptions-enabled struct:
|
||||||
* @code
|
* @code
|
||||||
* typedef struct test_struct {
|
* typedef struct test_struct {
|
||||||
* AVClass *class;
|
* const AVClass *class;
|
||||||
* int int_opt;
|
* int int_opt;
|
||||||
* char *str_opt;
|
* char *str_opt;
|
||||||
* uint8_t *bin_opt;
|
* uint8_t *bin_opt;
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
* @code
|
* @code
|
||||||
* test_struct *alloc_test_struct(void)
|
* test_struct *alloc_test_struct(void)
|
||||||
* {
|
* {
|
||||||
* test_struct *ret = av_malloc(sizeof(*ret));
|
* test_struct *ret = av_mallocz(sizeof(*ret));
|
||||||
* ret->class = &test_class;
|
* ret->class = &test_class;
|
||||||
* av_opt_set_defaults(ret);
|
* av_opt_set_defaults(ret);
|
||||||
* return ret;
|
* return ret;
|
||||||
|
|
Loading…
Reference in New Issue