From 3a3e0383b2b605ede516f4f58eef778bea7815e4 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 17 Dec 2012 14:32:39 +0000 Subject: create and use menuq_clear() helper; from Tiago Cunha --- kbfunc.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'kbfunc.c') 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 -- cgit 1.4.1