From a0ea5bf734df769edb5604993ba7bc588a0f19a8 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 13 Nov 2007 22:45:46 +0100 Subject: [PATCH] move compileregs() from tag.c to rules.c --- awesome.c | 1 - rules.c | 26 ++++++++++++++++++++++++++ rules.h | 1 + tag.c | 28 ---------------------------- tag.h | 1 - 5 files changed, 27 insertions(+), 30 deletions(-) diff --git a/awesome.c b/awesome.c index 7df557044..574b6a985 100644 --- a/awesome.c +++ b/awesome.c @@ -40,7 +40,6 @@ #include "awesome.h" #include "event.h" #include "layout.h" -#include "tag.h" #include "screen.h" #include "util.h" #include "statusbar.h" diff --git a/rules.c b/rules.c index 303419d89..490bf6961 100644 --- a/rules.c +++ b/rules.c @@ -22,6 +22,32 @@ #include "util.h" #include "rules.h" +void +compileregs(Rule *rules) +{ + Rule *r; + regex_t *reg; + for(r = rules; r; r = r->next) + { + if(r->prop) + { + reg = p_new(regex_t, 1); + if(regcomp(reg, r->prop, REG_EXTENDED)) + p_delete(®); + else + r->propregex = reg; + } + if(r->tags) + { + reg = p_new(regex_t, 1); + if(regcomp(reg, r->tags, REG_EXTENDED)) + p_delete(®); + else + r->tagregex = reg; + } + } +} + Bool client_match_rule(Client *c, Rule *r) { diff --git a/rules.h b/rules.h index da160672b..051456823 100644 --- a/rules.h +++ b/rules.h @@ -26,6 +26,7 @@ #define RULE_NOSCREEN -1 +void compileregs(Rule *); Bool client_match_rule(Client *, Rule *); int get_client_screen_from_rules(Client *, Rule *); Bool is_tag_match_rules(Tag *, Rule *); diff --git a/tag.c b/tag.c index 5467b366a..fd7a6c033 100644 --- a/tag.c +++ b/tag.c @@ -28,34 +28,6 @@ #include "util.h" #include "rules.h" -void -compileregs(Rule *rules) -{ - Rule *r; - regex_t *reg; - - for(r = rules; r; r = r->next) - { - if(r->prop) - { - reg = p_new(regex_t, 1); - if(regcomp(reg, r->prop, REG_EXTENDED)) - p_delete(®); - else - r->propregex = reg; - } - if(r->tags) - { - reg = p_new(regex_t, 1); - if(regcomp(reg, r->tags, REG_EXTENDED)) - p_delete(®); - else - r->tagregex = reg; - } - } -} - - /** Returns True if a client is tagged * with one of the tags * \param c Client diff --git a/tag.h b/tag.h index b3dd34874..4922b9da3 100644 --- a/tag.h +++ b/tag.h @@ -27,7 +27,6 @@ /** Check if a client is tiled */ #define IS_TILED(client, screen, tags, ntags) (client && !client->isfloating && isvisible(client, screen, tags, ntags)) -void compileregs(Rule *); Bool isvisible(Client *, int, Tag *, int); UICB_PROTO(uicb_tag);