summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authoroga <oga>2008-05-18 19:43:50 +0000
committeroga <oga>2008-05-18 19:43:50 +0000
commit27b023ebcbe1f4ec24c6044fee51c22c55d5993b (patch)
tree3f4af5ab604be9d376e99f1f781caf82834eb122 /conf.c
parent5c402536fa7dfe6805ab1cb9e1cd96feaaf69c41 (diff)
downloadcwm-27b023ebcbe1f4ec24c6044fee51c22c55d5993b.tar.gz
cwm-27b023ebcbe1f4ec24c6044fee51c22c55d5993b.tar.xz
cwm-27b023ebcbe1f4ec24c6044fee51c22c55d5993b.zip
Kill conf_get_int(), it was a silly function anyway.
Since it's only used once just put the (simplified) logic into
conf_client() instead. This  means we can kill an enum and
CONF_IGNORECASE, too.

ok okan@
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/conf.c b/conf.c
index fe14817..f595ff1 100644
--- a/conf.c
+++ b/conf.c
@@ -174,53 +174,27 @@ conf_setup(struct conf *c, const char *conffile)
 	(void)parse_config(c->conf_path, c);
 }
 
-int
-conf_get_int(struct client_ctx *cc, enum conftype ctype)
+void
+conf_client(struct client_ctx *cc)
 {
-	int val = -1, ignore = 0;
-	char *wname;
-	struct winmatch *wm;
-
-	wname = cc->name;
+	struct winmatch	*wm;
+	char		*wname = cc->name;
+	int		 ignore = 0;
 
 	/* Can wname be NULL? */
-
 	if (wname != NULL) {
 		TAILQ_FOREACH(wm, &Conf.ignoreq, entry) {
-			int (*cmpfun)(const char *, const char *, size_t) =
-			    wm->opts & CONF_IGNORECASE ? strncasecmp : strncmp;
-			if ((*cmpfun)(wm->title, wname, strlen(wm->title)) == 0) {
+			if (strncasecmp(wm->title, wname, strlen(wm->title))
+			    == 0) {
 				ignore = 1;
 				break;
 			}
 		}
-
 	} else
 		ignore = 1;
 
-	switch (ctype) {
-	case CONF_BWIDTH:
-		/*
-		 * XXX this will be a list, specified in the
-		 * configuration file.
-		 */
-		val = ignore ? 0 : 3;
-		break;
-	case CONF_IGNORE:
-		val = ignore;
-		break;
-	default:
-		break;
-	}
-
-	return (val);
-}
-
-void
-conf_client(struct client_ctx *cc)
-{
-	cc->bwidth = conf_get_int(cc, CONF_BWIDTH);
-	cc->flags |= conf_get_int(cc, CONF_IGNORE) ? CLIENT_IGNORE : 0;
+	cc->bwidth = ignore ? 0 : 3;
+	cc->flags |= ignore ? CLIENT_IGNORE : 0;
 }
 
 struct {