move compileregs() from tag.c to rules.c

This commit is contained in:
Julien Danjou 2007-11-13 22:45:46 +01:00
parent a07669c52c
commit a0ea5bf734
5 changed files with 27 additions and 30 deletions

View File

@ -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
View File

@ -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(&reg);
else
r->propregex = reg;
}
if(r->tags)
{
reg = p_new(regex_t, 1);
if(regcomp(reg, r->tags, REG_EXTENDED))
p_delete(&reg);
else
r->tagregex = reg;
}
}
}
Bool
client_match_rule(Client *c, Rule *r)
{

View File

@ -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
View File

@ -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(&reg);
else
r->propregex = reg;
}
if(r->tags)
{
reg = p_new(regex_t, 1);
if(regcomp(reg, r->tags, REG_EXTENDED))
p_delete(&reg);
else
r->tagregex = reg;
}
}
}
/** Returns True if a client is tagged
* with one of the tags
* \param c Client

1
tag.h
View File

@ -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);