From: Michael Stapelberg Date: Sat, 14 Dec 2013 09:41:44 +0000 (+0100) Subject: swallows: value needs to be loaded as regular expression X-Git-Tag: 4.8~200 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0302912b64dc50a4ee150dd21a63c2140a02c215;p=i3%2Fi3 swallows: value needs to be loaded as regular expression --- diff --git a/src/load_layout.c b/src/load_layout.c index dbd1f0df..0489c7f9 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -153,10 +153,13 @@ static int json_string(void *ctx, const unsigned char *val, unsigned int len) { if (parsing_swallows) { /* TODO: the other swallowing keys */ if (strcasecmp(last_key, "class") == 0) { - current_swallow->class = scalloc((len+1) * sizeof(char)); - memcpy(current_swallow->class, val, len); + char *sval; + sasprintf(&sval, "%.*s", len, val); + current_swallow->class = regex_new(sval); + free(sval); + } else { + ELOG("swallow key %s unknown\n", last_key); } - LOG("unhandled yet: swallow\n"); } else { if (strcasecmp(last_key, "name") == 0) { json_node->name = scalloc((len+1) * sizeof(char));