summaryrefslogtreecommitdiffstats
path: root/cfgparser.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-26 00:28:32 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-26 00:28:32 +0000
commitcfbf4a19d737928bf5f3d51027ed10e1cc93bcc9 (patch)
treedfec3a4f09b2741c07c3d53e5a109dcc8922f957 /cfgparser.c
parent1fbd3baf78a734372fc3483155af4fb17ced7019 (diff)
downloadmpv-cfbf4a19d737928bf5f3d51027ed10e1cc93bcc9.tar.bz2
mpv-cfbf4a19d737928bf5f3d51027ed10e1cc93bcc9.tar.xz
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
Diffstat (limited to 'cfgparser.c')
-rw-r--r--cfgparser.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cfgparser.c b/cfgparser.c
index 30837e209a..89b54e6aa8 100644
--- a/cfgparser.c
+++ b/cfgparser.c
@@ -612,7 +612,7 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
last_ptr = ptr;
ptr = strchr(ptr,LIST_SEPARATOR);
if(!ptr) {
- if(strlen(last_ptr) > 0)
+// if(strlen(last_ptr) > 0)
n++;
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*));
ptr = param;
n = 0;
- while(ptr[0] != '\0') {
+// while(ptr[0] != '\0') {
+ while(1) {
last_ptr = ptr;
ptr = strchr(ptr,LIST_SEPARATOR);
if(!ptr) {
- if(strlen(last_ptr) > 0) {
+ //if(strlen(last_ptr) > 0)
+ {
res[n] = strdup(last_ptr);
n++;
}
@@ -642,7 +644,7 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
}
len = ptr - last_ptr;
res[n] = (char*)malloc(len + 1);
- strncpy(res[n],last_ptr,len);
+ if(len) strncpy(res[n],last_ptr,len);
res[n][len] = '\0';
ptr++;
n++;