Just return out of the loop when a match is found, and get rid of the
retval variable.
char *name, char *value) {
struct swb_config_option *opt;
ptrdiff_t i;
- int retval = 0;
+ /* Search through list of recognized config options for a match */
for (opt = swb_config_options; opt->name; ++opt) {
if (strcmp(name, opt->name))
continue;
We want the first value, so ignore this one */
free(value);
}
- retval = 1;
+ return 1;
break;
}
- if (!retval)
- free(value);
-
- return retval;
+ /* Unrecognized config option */
+ free(value);
+ return 0;
}
/* Read the config file and load settings into the provided swb_config struct