use list functions for rules
This commit is contained in:
parent
572f409a29
commit
66507b0401
18
config.c
18
config.c
|
@ -738,8 +738,7 @@ config_parse(const char *confpatharg)
|
|||
CFG_END()
|
||||
};
|
||||
cfg_t *cfg, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp;
|
||||
int ret, screen;
|
||||
unsigned int i = 0;
|
||||
int ret, screen, i;
|
||||
const char *homedir;
|
||||
char *confpath;
|
||||
ssize_t confpath_len;
|
||||
|
@ -788,11 +787,10 @@ config_parse(const char *confpatharg)
|
|||
cfg_mouse = cfg_getsec(cfg, "mouse");
|
||||
|
||||
/* Rules */
|
||||
if(cfg_size(cfg_rules, "rule"))
|
||||
{
|
||||
globalconf.rules = rule = p_new(Rule, 1);
|
||||
for(i = 0; i < cfg_size(cfg_rules, "rule"); i++)
|
||||
rule_list_init(&globalconf.rules);
|
||||
for(i = cfg_size(cfg_rules, "rule") - 1; i >= 0; i--)
|
||||
{
|
||||
rule = p_new(Rule, 1);
|
||||
cfgsectmp = cfg_getnsec(cfg_rules, "rule", i);
|
||||
rule->prop_r = rules_compile_regex(cfg_getstr(cfgsectmp, "name"));
|
||||
rule->tags_r = rules_compile_regex(cfg_getstr(cfgsectmp, "tags"));
|
||||
|
@ -805,14 +803,8 @@ config_parse(const char *confpatharg)
|
|||
if(rule->screen >= globalconf.nscreens)
|
||||
rule->screen = 0;
|
||||
|
||||
if(i < cfg_size(cfg_rules, "rule") - 1)
|
||||
rule = rule->next = p_new(Rule, 1);
|
||||
else
|
||||
rule->next = NULL;
|
||||
rule_list_push(&globalconf.rules, rule);
|
||||
}
|
||||
}
|
||||
else
|
||||
globalconf.rules = NULL;
|
||||
|
||||
/* Mouse: root window click bindings */
|
||||
globalconf.buttons.root = parse_mouse_bindings(cfg_mouse, "root", True);
|
||||
|
|
Loading…
Reference in New Issue