about summary refs log tree commit diff
path: root/kbfunc.c
diff options
context:
space:
mode:
authorokan <okan>2012-12-17 14:32:39 +0000
committerokan <okan>2012-12-17 14:32:39 +0000
commit3a3e0383b2b605ede516f4f58eef778bea7815e4 (patch)
tree9aa77f0f9c343b5caa6887d28283047cda0154bb /kbfunc.c
parentd651c1cc3b5b1f4c00cbefd6247083c5f3f0fce5 (diff)
downloadcwm-3a3e0383b2b605ede516f4f58eef778bea7815e4.tar.gz
cwm-3a3e0383b2b605ede516f4f58eef778bea7815e4.tar.xz
cwm-3a3e0383b2b605ede516f4f58eef778bea7815e4.zip
create and use menuq_clear() helper; from Tiago Cunha
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/kbfunc.c b/kbfunc.c
index e8ab152..023069d 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -168,10 +168,7 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg)
 		client_ptrwarp(cc);
 	}
 
-	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
-		TAILQ_REMOVE(&menuq, mi, entry);
-		free(mi);
-	}
+	menuq_clear(&menuq);
 }
 
 void
@@ -195,10 +192,7 @@ kbfunc_menu_search(struct client_ctx *cc, union arg *arg)
 	    search_match_text, NULL)) != NULL)
 		u_spawn(((struct cmd *)mi->ctx)->image);
 
-	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
-		TAILQ_REMOVE(&menuq, mi, entry);
-		free(mi);
-	}
+	menuq_clear(&menuq);
 }
 
 void
@@ -320,10 +314,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
 out:
 	if (mi != NULL && mi->dummy)
 		free(mi);
-	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
-		TAILQ_REMOVE(&menuq, mi, entry);
-		free(mi);
-	}
+	menuq_clear(&menuq);
 }
 
 void
@@ -390,10 +381,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
 out:
 	if (mi != NULL && mi->dummy)
 		free(mi);
-	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
-		TAILQ_REMOVE(&menuq, mi, entry);
-		free(mi);
-	}
+	menuq_clear(&menuq);
 }
 
 void