aboutsummaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
authorokan2012-12-17 14:32:39 +0000
committerokan2012-12-17 14:32:39 +0000
commitc41d09cb1ce845c96079c6bc1e204e62caf32b95 (patch)
treeb245825ac245104c8c5bf701e726234d9df75d46 /menu.c
parent43033f15ed112e90c2a62d9facdbfbf1ad5b61ee (diff)
downloadcwm-c41d09cb1ce845c96079c6bc1e204e62caf32b95.tar.gz
create and use menuq_clear() helper; from Tiago Cunha
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/menu.c b/menu.c
index 0023637..261e481 100644
--- a/menu.c
+++ b/menu.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: menu.c,v 1.47 2012/12/17 02:53:29 okan Exp $
+ * $OpenBSD: menu.c,v 1.48 2012/12/17 14:32:39 okan Exp $
*/
#include <sys/param.h>
@@ -215,10 +215,7 @@ menu_complete_path(struct menu_ctx *mc)
strlcpy(path, mi->text, sizeof(mi->text));
}
- while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
- TAILQ_REMOVE(&menuq, mi, entry);
- free(mi);
- }
+ menuq_clear(&menuq);
if (path[0] != '\0')
snprintf(mr->text, sizeof(mr->text), "%s \"%s\"",
@@ -632,3 +629,14 @@ menu_keycode(XKeyEvent *ev, enum ctltype *ctl, char *chr)
return (0);
}
+
+void
+menuq_clear(struct menu_q *mq)
+{
+ struct menu *mi;
+
+ while ((mi = TAILQ_FIRST(mq)) != NULL) {
+ TAILQ_REMOVE(mq, mi, entry);
+ free(mi);
+ }
+}