aboutsummaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);
+ }
+}