]> git.sur5r.net Git - i3/i3/blobdiff - src/regex.c
Handle the EWMH atom _NET_WM_DESKTOP.
[i3/i3] / src / regex.c
index 64a2f3a4ffd4fd7a5cd73ad3a0037f37c714a2bc..24846981fbf16b945c5d7e90a9e4b62c26f2f66e 100644 (file)
@@ -1,12 +1,14 @@
+#undef I3__FILE__
+#define I3__FILE__ "regex.c"
 /*
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
+ * regex.c: Interface to libPCRE (perl compatible regular expressions).
  *
  */
-
 #include "all.h"
 
 /*
@@ -23,7 +25,7 @@ struct regex *regex_new(const char *pattern) {
     const char *error;
     int errorcode, offset;
 
-    struct regex *re = scalloc(sizeof(struct regex));
+    struct regex *re = scalloc(1, sizeof(struct regex));
     re->pattern = sstrdup(pattern);
     int options = PCRE_UTF8;
 #ifdef PCRE_HAS_UCP
@@ -62,12 +64,13 @@ void regex_free(struct regex *regex) {
     FREE(regex->pattern);
     FREE(regex->regex);
     FREE(regex->extra);
+    FREE(regex);
 }
 
 /*
  * 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
- * be visible without any debug loglevel.
+ * be visible without debug logging.
  *
  */
 bool regex_matches(struct regex *regex, const char *input) {