parent
f3716e45cf
commit
dc790cfa32
|
@ -148,7 +148,7 @@ struct Ignore_Event {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct regex {
|
struct regex {
|
||||||
const char *pattern;
|
char *pattern;
|
||||||
pcre *regex;
|
pcre *regex;
|
||||||
pcre_extra *extra;
|
pcre_extra *extra;
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,4 +28,10 @@ void match_copy(Match *dest, Match *src);
|
||||||
*/
|
*/
|
||||||
bool match_matches_window(Match *match, i3Window *window);
|
bool match_matches_window(Match *match, i3Window *window);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees the given match. It must not be used afterwards!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void match_free(Match *match);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
*/
|
*/
|
||||||
struct regex *regex_new(const char *pattern);
|
struct regex *regex_new(const char *pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Frees the given regular expression. It must not be used afterwards!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void regex_free(struct regex *regex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given regular expression matches the given input and returns
|
* Checks if the given regular expression matches the given input and returns
|
||||||
* true if it does. In either case, it logs the outcome using LOG(), so it will
|
* true if it does. In either case, it logs the outcome using LOG(), so it will
|
||||||
|
|
10
src/config.c
10
src/config.c
|
@ -280,15 +280,19 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
|
||||||
SLIST_REMOVE(&modes, mode, Mode, modes);
|
SLIST_REMOVE(&modes, mode, Mode, modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct Assignment *assign;
|
struct Assignment *assign;
|
||||||
while (!TAILQ_EMPTY(&assignments)) {
|
while (!TAILQ_EMPTY(&assignments)) {
|
||||||
assign = TAILQ_FIRST(&assignments);
|
assign = TAILQ_FIRST(&assignments);
|
||||||
FREE(assign->windowclass_title);
|
if (assign->type == A_TO_WORKSPACE)
|
||||||
|
FREE(assign->dest.workspace);
|
||||||
|
else if (assign->type == A_TO_OUTPUT)
|
||||||
|
FREE(assign->dest.output);
|
||||||
|
else if (assign->type == A_COMMAND)
|
||||||
|
FREE(assign->dest.command);
|
||||||
|
match_free(&(assign->match));
|
||||||
TAILQ_REMOVE(&assignments, assign, assignments);
|
TAILQ_REMOVE(&assignments, assign, assignments);
|
||||||
FREE(assign);
|
FREE(assign);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Clear workspace names */
|
/* Clear workspace names */
|
||||||
#if 0
|
#if 0
|
||||||
|
|
20
src/match.c
20
src/match.c
|
@ -136,3 +136,23 @@ bool match_matches_window(Match *match, i3Window *window) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Frees the given match. It must not be used afterwards!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void match_free(Match *match) {
|
||||||
|
/* First step: free the regex fields / patterns */
|
||||||
|
regex_free(match->title);
|
||||||
|
regex_free(match->application);
|
||||||
|
regex_free(match->class);
|
||||||
|
regex_free(match->instance);
|
||||||
|
regex_free(match->mark);
|
||||||
|
|
||||||
|
/* Second step: free the regex helper struct itself */
|
||||||
|
FREE(match->title);
|
||||||
|
FREE(match->application);
|
||||||
|
FREE(match->class);
|
||||||
|
FREE(match->instance);
|
||||||
|
FREE(match->mark);
|
||||||
|
}
|
||||||
|
|
12
src/regex.c
12
src/regex.c
|
@ -49,6 +49,18 @@ struct regex *regex_new(const char *pattern) {
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Frees the given regular expression. It must not be used afterwards!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void regex_free(struct regex *regex) {
|
||||||
|
if (!regex)
|
||||||
|
return;
|
||||||
|
FREE(regex->pattern);
|
||||||
|
FREE(regex->regex);
|
||||||
|
FREE(regex->extra);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks if the given regular expression matches the given input and returns
|
* Checks if the given regular expression matches the given input and returns
|
||||||
* true if it does. In either case, it logs the outcome using LOG(), so it will
|
* true if it does. In either case, it logs the outcome using LOG(), so it will
|
||||||
|
|
Loading…
Reference in New Issue