mirror of https://github.com/mpv-player/mpv
accept empty strings too for STRING_LIST (example: "-xyz 1,2.5,,4," )
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7504 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1fbd3baf78
commit
cfbf4a19d7
10
cfgparser.c
10
cfgparser.c
|
@ -612,7 +612,7 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
|
||||||
last_ptr = ptr;
|
last_ptr = ptr;
|
||||||
ptr = strchr(ptr,LIST_SEPARATOR);
|
ptr = strchr(ptr,LIST_SEPARATOR);
|
||||||
if(!ptr) {
|
if(!ptr) {
|
||||||
if(strlen(last_ptr) > 0)
|
// if(strlen(last_ptr) > 0)
|
||||||
n++;
|
n++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -630,11 +630,13 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
|
||||||
res = malloc((n+1)*sizeof(char*));
|
res = malloc((n+1)*sizeof(char*));
|
||||||
ptr = param;
|
ptr = param;
|
||||||
n = 0;
|
n = 0;
|
||||||
while(ptr[0] != '\0') {
|
// while(ptr[0] != '\0') {
|
||||||
|
while(1) {
|
||||||
last_ptr = ptr;
|
last_ptr = ptr;
|
||||||
ptr = strchr(ptr,LIST_SEPARATOR);
|
ptr = strchr(ptr,LIST_SEPARATOR);
|
||||||
if(!ptr) {
|
if(!ptr) {
|
||||||
if(strlen(last_ptr) > 0) {
|
//if(strlen(last_ptr) > 0)
|
||||||
|
{
|
||||||
res[n] = strdup(last_ptr);
|
res[n] = strdup(last_ptr);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
@ -642,7 +644,7 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
|
||||||
}
|
}
|
||||||
len = ptr - last_ptr;
|
len = ptr - last_ptr;
|
||||||
res[n] = (char*)malloc(len + 1);
|
res[n] = (char*)malloc(len + 1);
|
||||||
strncpy(res[n],last_ptr,len);
|
if(len) strncpy(res[n],last_ptr,len);
|
||||||
res[n][len] = '\0';
|
res[n][len] = '\0';
|
||||||
ptr++;
|
ptr++;
|
||||||
n++;
|
n++;
|
||||||
|
|
Loading…
Reference in New Issue