Commit cd75d6f0 authored by Pietro Fezzardi's avatar Pietro Fezzardi

lib/conf.c: fix ARG_NONE, factorize code

Every case of the switch was colling the cfg_handler out of the
switch construct, avery time with the same arguments.
The only case not calling the config function was case ARG_NONE.
But this doesn't make sense, because if a configuration option
does not do anything, then it should not be there, even without
arguments.
So the call to config function is now made from every case, even
ARG_NONE, then it should not stay inside the switch.
parent 35456ab1
...@@ -287,8 +287,6 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno) ...@@ -287,8 +287,6 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno)
lineno, word); lineno, word);
return -1; return -1;
} }
if (l->f(lineno, &cfg_arg))
return -1;
break; break;
case ARG_STR: case ARG_STR:
...@@ -296,8 +294,6 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno) ...@@ -296,8 +294,6 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno)
line++; line++;
cfg_arg.s = line; cfg_arg.s = line;
if (l->f(lineno, &cfg_arg))
return -1;
break; break;
case ARG_NAMES: case ARG_NAMES:
...@@ -310,8 +306,6 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno) ...@@ -310,8 +306,6 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno)
return -1; return -1;
} }
cfg_arg.i = n->value; cfg_arg.i = n->value;
if (l->f(lineno, &cfg_arg))
return -1;
break; break;
case ARG_TIME: case ARG_TIME:
...@@ -320,12 +314,12 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno) ...@@ -320,12 +314,12 @@ static int pp_config_line(struct pp_globals *ppg, char *line, int lineno)
"\"%s\"\n", lineno, line, word); "\"%s\"\n", lineno, line, word);
return -1; return -1;
} }
if (l->f(lineno, &cfg_arg))
return -1;
break; break;
} }
if (l->f(lineno, &cfg_arg))
return -1;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment