From f83cc6bb45a473df0d0db21122e17701d911cdef Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 24 May 2012 05:56:41 +0000 Subject: [PATCH] whitespaces-- SVN revision: 71391 --- src/modules/xkbswitch/e_mod_parse.c | 118 ++++++++++++++-------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/modules/xkbswitch/e_mod_parse.c b/src/modules/xkbswitch/e_mod_parse.c index be14f3045..789dacf04 100644 --- a/src/modules/xkbswitch/e_mod_parse.c +++ b/src/modules/xkbswitch/e_mod_parse.c @@ -17,12 +17,12 @@ find_rules(void) "/usr/local/share/X11/xkb/rules/xorg.lst", "/usr/local/share/X11/xkb/rules/xfree86.lst", "/usr/X11R6/lib/X11/xkb/rules/xorg.lst", - "/usr/X11R6/lib/X11/xkb/rules/xfree86.lst", + "/usr/X11R6/lib/X11/xkb/rules/xfree86.lst", "/usr/local/X11R6/lib/X11/xkb/rules/xorg.lst", "/usr/local/X11R6/lib/X11/xkb/rules/xfree86.lst", NULL }; - + for (; lstfiles[i]; i++) { FILE *f = fopen(lstfiles[i], "r"); @@ -44,18 +44,18 @@ parse_rules(void) E_XKB_Variant *variant = NULL; E_XKB_Option_Group *group = NULL; char buf[4096]; - + if (!rules_file) return 0; - + layouts = NULL; models = NULL; - + FILE *f = fopen(rules_file, "r"); if (!f) return 0; - + /* move on to next line, the first one is useless */ if (!fgets(buf, sizeof(buf), f)) goto err; - + /* let X decide on this one, also serves as * "fallback on global" for layout combinations */ @@ -63,7 +63,7 @@ parse_rules(void) model->name = eina_stringshare_add("default"); model->description = eina_stringshare_add("Automatic"); models = eina_list_append(models, model); - + /* read models here */ for (;;) { @@ -71,32 +71,32 @@ parse_rules(void) { char *n = strchr(buf, '\n'); if (n) *n = '\0'; - + /* means end of section */ if (!buf[0]) break; /* get rid of initial 2 spaces here */ char *p = buf + 2; char *tmp = strdup(p); - + model = E_NEW(E_XKB_Model, 1); model->name = eina_stringshare_add(strtok(tmp, " ")); - + free(tmp); - + p += strlen(model->name); while (p[0] == ' ') ++p; - + model->description = eina_stringshare_add(p); - + models = eina_list_append(models, model); } else break; } - + /* move on again */ if (!fgets(buf, sizeof(buf), f)) goto err; - + /* read layouts here */ for (;;) { @@ -104,36 +104,36 @@ parse_rules(void) { char *n = strchr(buf, '\n'); if (n) *n = '\0'; - + if (!buf[0]) break; - + char *p = buf + 2; char *tmp = strdup(p); - + layout = E_NEW(E_XKB_Layout, 1); layout->name = eina_stringshare_add(strtok(tmp, " ")); - + free(tmp); - + p += strlen(layout->name); while (p[0] == ' ') ++p; - + variant = E_NEW(E_XKB_Variant, 1); variant->name = eina_stringshare_add("basic"); variant->description = eina_stringshare_add("Default layout variant"); - + layout->description = eina_stringshare_add(p); layout->variants = eina_list_append(layout->variants, variant); - + layouts = eina_list_append(layouts, layout); } else break; } - + /* move on again */ if (!fgets(buf, sizeof(buf), f)) goto err; - + /* read variants here */ for (;;) { @@ -141,37 +141,37 @@ parse_rules(void) { char *n = strchr(buf, '\n'); if (n) *n = '\0'; - + if (!buf[0]) break; - + char *p = buf + 2; char *tmp = strdup(p); - + variant = E_NEW(E_XKB_Variant, 1); variant->name = eina_stringshare_add(strtok(tmp, " ")); - + char *tok = strtok(NULL, " "); *strchr(tok, ':') = '\0'; - + layout = eina_list_search_unsorted(layouts, layout_sort_by_name_cb, tok); layout->variants = eina_list_append(layout->variants, variant); - + p += strlen(variant->name); while (p[0] == ' ') ++p; p += strlen(tok); p += 2; - + free(tmp); - + variant->description = eina_stringshare_add(p); } else break; } - + /* move on again */ if (!fgets(buf, sizeof(buf), f)) goto err; - + /* read options here */ for (;;) { @@ -179,13 +179,13 @@ parse_rules(void) { char *n = strchr(buf, '\n'); if (n) *n = '\0'; - + if (!buf[0]) break; - + char *p = buf + 2; char *tmp = strdup(p); char *name = strtok(tmp, " "); - + p += strlen(name); while (p[0] == ' ') ++p; @@ -195,7 +195,7 @@ parse_rules(void) if (!strchr(name, ':')) { group = E_NEW(E_XKB_Option_Group, 1); - + /* A hack to get it to parse right if * the group name contains a space */ @@ -204,9 +204,9 @@ parse_rules(void) p = strstr(p, " "); while (p[0] == ' ') ++p; } - + group->description = eina_stringshare_add(p); - + optgroups = eina_list_append(optgroups, group); } else @@ -218,7 +218,7 @@ parse_rules(void) option); } } - + free(tmp); } else @@ -227,7 +227,7 @@ parse_rules(void) err: fclose(f); - + /* Sort layouts */ layouts = eina_list_sort(layouts, eina_list_count(layouts), layout_sort_cb); @@ -242,46 +242,46 @@ clear_rules(void) E_XKB_Option *o; E_XKB_Layout *la; E_XKB_Model *m; - + EINA_LIST_FREE(layouts, la) { eina_stringshare_del(la->name); eina_stringshare_del(la->description); - + EINA_LIST_FREE(la->variants, v) { eina_stringshare_del(v->name); eina_stringshare_del(v->description); - + E_FREE(v); } - + E_FREE(la); } - + EINA_LIST_FREE(models, m) { eina_stringshare_del(m->name); eina_stringshare_del(m->description); - + E_FREE(m); } - + EINA_LIST_FREE(optgroups, og) { eina_stringshare_del(og->description); - + EINA_LIST_FREE(og->options, o) { eina_stringshare_del(o->name); eina_stringshare_del(o->description); - + E_FREE(o); } - + E_FREE(og); } - + optgroups = NULL; layouts = NULL; models = NULL; @@ -291,12 +291,12 @@ int layout_sort_cb(const void *data1, const void *data2) { const E_XKB_Layout *l1, *l2; - + if (!(l1 = data1)) return 1; if (!l1->name) return 1; if (!(l2 = data2)) return -1; if (!l2->name) return -1; - + return strcmp(l1->name, l2->name); } @@ -305,10 +305,10 @@ layout_sort_by_name_cb(const void *data1, const void *data2) { const E_XKB_Layout *l1 = NULL; const char *l2 = NULL; - + if (!(l1 = data1)) return 1; if (!l1->name) return 1; if (!(l2 = data2)) return -1; - + return strcmp(l1->name, l2); }