X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=config.c;h=289374b2b29eda998a1a80baca17a85554cfdaa1;hp=0fbddf00775af3de4e34828050e0ae9400405b02;hb=38de05f23e8556012be028c25f7a7a1571e34e1a;hpb=f80c0225d95f310c24a8a69bedf97069f2859636 diff --git a/config.c b/config.c index 0fbddf0..289374b 100644 --- a/config.c +++ b/config.c @@ -21,6 +21,7 @@ */ #include +#include #include #include "configfile.h" @@ -96,17 +97,17 @@ void swb_config_free(struct swb_config *cfg) { /* Load a value into the part of a struct swb_config indicated by name */ static int swb_config_load_option(struct swb_config *cfg, char *name, char *value) { - int i; - struct swb_config_option opt; + struct swb_config_option *opt; + ptrdiff_t i; int retval = 0; - for (i = 0; swb_config_options[i].name; ++i) { - opt = swb_config_options[i]; - if (strcmp(name, opt.name)) + for (opt = swb_config_options; opt->name; ++opt) { + if (strcmp(name, opt->name)) continue; - if (!(cfg->flags & opt.set_mask)) { - switch (opt.type) { + if (!(cfg->flags & opt->set_mask)) { + i = opt - swb_config_options; + switch (opt->type) { case SWB_CONFIG_OPT_STRING: *(char **)cfg->entries[i] = value; break; @@ -115,7 +116,7 @@ static int swb_config_load_option(struct swb_config *cfg, free(value); break; } - cfg->flags |= opt.set_mask; + cfg->flags |= opt->set_mask; } retval = 1; break;