[MPlayer-dev-eng] [PATCH] new subopt type for malloced string

Ivo ivop at euronet.nl
Sun Jan 16 15:57:35 CET 2005

On Sunday 16 January 2005 14:35, Reimar Döffinger wrote:
> Hi,
> The attached patch moves some duplicated code to subopt_parser.c, by
> providing a new opt type, malloced, zero terminated string.
> You need to free it, and you must initialize it either to NULL or a
> malloced buffer (e.g. via strdup).
> I'd also like to extend the documentation of the test function to make
> it say: "it may also modify the argument within the limits that apply to
> initializing variables and modifying them after the parsing".
> The last part is because strarg_t.str may not be modified, and for the
> OPT_ARG_MSTRZ arg it must still point to a malloced buffer.

Looks great!

Also, I think we need a few standard validation functions, e.q. test for 
non-negative, test for [0-100] et cetera. There's already some duplicated 
code and the amount will only grow if other vo's and ao's start using this 
suboption parser.

And, if we want vf's and af's to use it, we also need something like 
OPT_ARG_INT_WITHOUT_LABEL (or something named a little better). Hmm, 
proposing a dependency for libaf, Alex B. will probably kill me for that :)


More information about the MPlayer-dev-eng mailing list