move compileregs() from tag.c to rules.c
This commit is contained in:
parent
a07669c52c
commit
a0ea5bf734
|
@ -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"
|
||||
|
|
26
rules.c
26
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)
|
||||
{
|
||||
|
|
1
rules.h
1
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 *);
|
||||
|
|
28
tag.c
28
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
|
||||
|
|
Loading…
Reference in New Issue