aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Anderson <ascent12@hotmail.com>2017-04-07 00:19:14 +1200
committerScott Anderson <ascent12@hotmail.com>2017-04-07 00:34:33 +1200
commit3a32be67ed89bf667ec840eca3191ed5f207df70 (patch)
treef605c27b9b6b87dfbcf613969e0ee8fa77cdd716
parentfe54a6725ede65020dc8fb71e8d453c1c51dc3fe (diff)
downloadsway-3a32be67ed89bf667ec840eca3191ed5f207df70.zip
sway-3a32be67ed89bf667ec840eca3191ed5f207df70.tar.gz
sway-3a32be67ed89bf667ec840eca3191ed5f207df70.tar.bz2
Added designated initaliser, to prevent any possible problem with
ordering
-rw-r--r--sway/criteria.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index 706da04..ee6d4d1 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -23,17 +23,16 @@ enum criteria_type { // *must* keep in sync with criteria_strings[]
CRIT_LAST
};
-// this *must* match the ordering in criteria_type enum
-static const char * const criteria_strings[] = {
- "class",
- "con_mark",
- "id",
- "instance",
- "title",
- "urgent", // either "latest" or "oldest" ...
- "window_role",
- "window_type",
- "workspace"
+static const char * const criteria_strings[CRIT_LAST] = {
+ [CRIT_CLASS] = "class",
+ [CRIT_CON_MARK] = "con_mark",
+ [CRIT_ID] = "id",
+ [CRIT_INSTANCE] = "instance",
+ [CRIT_TITLE] = "title",
+ [CRIT_URGENT] = "urgent", // either "latest" or "oldest" ...
+ [CRIT_WINDOW_ROLE] = "window_role",
+ [CRIT_WINDOW_TYPE] = "window_type",
+ [CRIT_WORKSPACE] = "workspace"
};
/**
@@ -240,7 +239,7 @@ ect_cleanup:
}
static int regex_cmp(const char *item, const pcre *regex) {
- return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
+ return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0);
}
// test a single view if it matches list of criteria tokens (all of them).