summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authorokan <okan>2011-03-22 10:57:31 +0000
committerokan <okan>2011-03-22 10:57:31 +0000
commit2c706e60c7b9c7da4198fac2ca9bc01e7d26895a (patch)
tree975648c5b4aab6ae45e322d60f73506d8e4d6c2d /conf.c
parent8f88cd474a20772e72a7db5abe3013e2be223108 (diff)
downloadcwm-2c706e60c7b9c7da4198fac2ca9bc01e7d26895a.tar.gz
cwm-2c706e60c7b9c7da4198fac2ca9bc01e7d26895a.tar.xz
cwm-2c706e60c7b9c7da4198fac2ca9bc01e7d26895a.zip
introduce nitems macro, with the appropriate ifndef.
ok oga@
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/conf.c b/conf.c
index 10135a6..b453405 100644
--- a/conf.c
+++ b/conf.c
@@ -191,10 +191,10 @@ conf_init(struct conf *c)
 	TAILQ_INIT(&c->autogroupq);
 	TAILQ_INIT(&c->mousebindingq);
 
-	for (i = 0; i < sizeof(kb_binds) / sizeof(kb_binds[0]); i++)
+	for (i = 0; i < nitems(kb_binds); i++)
 		conf_bindname(c, kb_binds[i].key, kb_binds[i].func);
 
-	for (i = 0; i < sizeof(m_binds) / sizeof(m_binds[0]); i++)
+	for (i = 0; i < nitems(m_binds); i++)
 		conf_mousebind(c, m_binds[i].key, m_binds[i].func);
 
 	/* Default term/lock */
@@ -467,8 +467,7 @@ conf_bindname(struct conf *c, char *name, char *binding)
 	current_binding = xcalloc(1, sizeof(*current_binding));
 
 	if ((substring = strchr(name, '-')) != NULL) {
-		for (iter = 0; iter < (sizeof(bind_mods) /
-		    sizeof(bind_mods[0])); iter++) {
+		for (iter = 0; iter < nitems(bind_mods); iter++) {
 			if ((tmp = strchr(name, bind_mods[iter].chr)) !=
 			    NULL && tmp < substring) {
 				current_binding->modmask |=
@@ -573,8 +572,7 @@ conf_mousebind(struct conf *c, char *name, char *binding)
 	current_binding = xcalloc(1, sizeof(*current_binding));
 
 	if ((substring = strchr(name, '-')) != NULL) {
-		for (iter = 0; iter < (sizeof(bind_mods) /
-		    sizeof(bind_mods[0])); iter++) {
+		for (iter = 0; iter < nitems(bind_mods); iter++) {
 			if ((tmp = strchr(name, bind_mods[iter].chr)) !=
 			    NULL && tmp < substring) {
 				current_binding->modmask |=