diff --git a/src/main.c b/src/main.c
index 7da8af7..805d330 100644
--- a/src/main.c
+++ b/src/main.c
NULL
};
+static const struct group_table {
+ const char *name;
+ const char * const *options;
+} valid_groups[] = {
+ { "General", supported_options },
+ { "Policy", policy_options },
+ { "GATT", gatt_options },
+ { }
+};
+
+
GKeyFile *btd_get_main_conf(void)
{
return main_conf;
static void check_config(GKeyFile *config)
{
- const char *valid_groups[] = { "General", "Policy", "GATT", NULL };
char **keys;
int i;
+ const struct group_table *group;
if (!config)
return;
keys = g_key_file_get_groups(config, NULL);
for (i = 0; keys != NULL && keys[i] != NULL; i++) {
- const char **group;
bool match = false;
- for (group = valid_groups; *group; group++) {
- if (g_str_equal(keys[i], *group)) {
+ for (group = valid_groups; group && group->name ; group++) {
+ if (g_str_equal(keys[i], group->name)) {
match = true;
break;
}
g_strfreev(keys);
- check_options(config, "General", supported_options);
- check_options(config, "Policy", policy_options);
- check_options(config, "GATT", gatt_options);
+ for (group = valid_groups; group && group->name; group++)
+ check_options(config, group->name, group->options);
}
static int get_mode(const char *str)