diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-04-19 04:11:52 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-04-20 04:22:52 +0300 |
commit | 2db33ab48cfa7858dacd2872b7e6b6b0c67b7214 (patch) | |
tree | c239ff1b2707431ef1d4fae191d29a600f3641eb /m_option.c | |
parent | acc187cd208f20de9c5a71ac3de7e80b7f69c1dc (diff) | |
download | mpv-2db33ab48cfa7858dacd2872b7e6b6b0c67b7214.tar.bz2 mpv-2db33ab48cfa7858dacd2872b7e6b6b0c67b7214.tar.xz |
options: support string list separators other than ','
Allow specifying a custom separator character for options of string
list type, and use that to define OPT_PATHLIST which takes a list of
strings separated by ':' (or ';' on Windows).
Diffstat (limited to 'm_option.c')
-rw-r--r-- | m_option.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/m_option.c b/m_option.c index 1530cc31db..25010487d8 100644 --- a/m_option.c +++ b/m_option.c @@ -535,7 +535,6 @@ const m_option_type_t m_option_type_string = { //////////// String list -#define LIST_SEPARATOR ',' #undef VAL #define VAL(x) (*(char***)(x)) @@ -683,9 +682,9 @@ static int parse_str_list(const m_option_t* opt,const char *name, const char *pa if (param == NULL || strlen(param) == 0) return M_OPT_MISSING_PARAM; - + char separator = opt->priv ? *(char *)opt->priv : OPTION_LIST_SEPARATOR; while(ptr[0] != '\0') { - ptr = get_nextsep(ptr, LIST_SEPARATOR, 0); + ptr = get_nextsep(ptr, separator, 0); if(!ptr) { n++; break; @@ -707,7 +706,7 @@ static int parse_str_list(const m_option_t* opt,const char *name, const char *pa while(1) { last_ptr = ptr; - ptr = get_nextsep(ptr, LIST_SEPARATOR, 1); + ptr = get_nextsep(ptr, separator, 1); if(!ptr) { res[n] = strdup(last_ptr); n++; @@ -1857,7 +1856,7 @@ static int parse_obj_settings_list(const m_option_t* opt,const char *name, while(ptr[0] != '\0') { last_ptr = ptr; - ptr = get_nextsep(ptr, LIST_SEPARATOR, 1); + ptr = get_nextsep(ptr, OPTION_LIST_SEPARATOR, 1); if(!ptr) { r = parse_obj_settings(name,last_ptr,opt->priv,dst ? &res : NULL,n); |