Simplify control flow in swb_config_load_option()
[browser-switch] / config.c
index 395bcf2..faa9816 100644 (file)
--- a/config.c
+++ b/config.c
@@ -101,8 +101,8 @@ static int swb_config_load_option(struct swb_config *cfg,
                                  char *name, char *value) {
        struct swb_config_option *opt;
        ptrdiff_t i;
                                  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;
        for (opt = swb_config_options; opt->name; ++opt) {
                if (strcmp(name, opt->name))
                        continue;
@@ -124,14 +124,13 @@ static int swb_config_load_option(struct swb_config *cfg,
                           We want the first value, so ignore this one */
                        free(value);
                }
                           We want the first value, so ignore this one */
                        free(value);
                }
-               retval = 1;
+               return 1;
                break;
        }
 
                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
 }
 
 /* Read the config file and load settings into the provided swb_config struct