diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-12-17 14:20:57 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-12-22 11:39:57 +0100 |
commit | 0ba70a679216a504ed4ea6f50c37283cf099e8ae (patch) | |
tree | 7a70044b7605933d36974c17edca23549a940432 /fftools/cmdutils.c | |
parent | 579238226901285eff24ef88ae1a53b7f166adf5 (diff) | |
download | ffmpeg-0ba70a679216a504ed4ea6f50c37283cf099e8ae.tar.gz |
fftools/cmdutils: add a struct for a list of SpecifierOpt
Significantly simplifies the code dealing with OPT_SPEC.
Diffstat (limited to 'fftools/cmdutils.c')
-rw-r--r-- | fftools/cmdutils.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index a52c7c5ae4..f53c4b7aec 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -239,25 +239,23 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, * a global var*/ void *dst = po->flags & OPT_FLAG_OFFSET ? (uint8_t *)optctx + po->u.off : po->u.dst_ptr; - int *dstcount; double num; int ret; if (po->flags & OPT_FLAG_SPEC) { - SpecifierOpt **so = dst; + SpecifierOptList *sol = dst; char *p = strchr(opt, ':'); char *str; - dstcount = (int *)(so + 1); - ret = grow_array((void**)so, sizeof(**so), dstcount, *dstcount + 1); + ret = GROW_ARRAY(sol->opt, sol->nb_opt); if (ret < 0) return ret; str = av_strdup(p ? p + 1 : ""); if (!str) return AVERROR(ENOMEM); - (*so)[*dstcount - 1].specifier = str; - dst = &(*so)[*dstcount - 1].u; + sol->opt[sol->nb_opt - 1].specifier = str; + dst = &sol->opt[sol->nb_opt - 1].u; } if (po->type == OPT_TYPE_STRING) { |