From 29118bc5f2d3da806407827df4b689bd80838a6f Mon Sep 17 00:00:00 2001 From: okan Date: Thu, 1 Dec 2016 20:28:19 +0000 Subject: Tame the number of 'exec' and 'path' search_match wrappers. No functional change now, though more can likely go later, losing the (paritally complete or incomplete/broken) argument completion bits. --- calmwm.h | 6 ++---- kbfunc.c | 4 ++-- menu.c | 4 ++-- search.c | 26 +++++++------------------- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/calmwm.h b/calmwm.h index c6e0246..61079bc 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.334 2016/12/01 18:17:52 okan Exp $ + * $OpenBSD: calmwm.h,v 1.335 2016/12/01 20:28:19 okan Exp $ */ #ifndef _CALMWM_H_ @@ -442,9 +442,7 @@ void search_match_client(struct menu_q *, struct menu_q *, char *); void search_match_exec(struct menu_q *, struct menu_q *, char *); -void search_match_exec_path(struct menu_q *, - struct menu_q *, char *); -void search_match_path_any(struct menu_q *, struct menu_q *, +void search_match_path(struct menu_q *, struct menu_q *, char *); void search_match_text(struct menu_q *, struct menu_q *, char *); diff --git a/kbfunc.c b/kbfunc.c index 90d1307..b198efe 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.139 2016/12/01 18:44:09 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.140 2016/12/01 20:28:19 okan Exp $ */ #include @@ -451,7 +451,7 @@ kbfunc_menu_exec(void *ctx, union arg *arg, enum xev xev) if ((mi = menu_filter(sc, &menuq, label, NULL, (CWM_MENU_DUMMY | CWM_MENU_FILE), - search_match_exec_path, NULL)) != NULL) { + search_match_exec, NULL)) != NULL) { if (mi->text[0] == '\0') goto out; switch (cmd) { diff --git a/menu.c b/menu.c index b893101..c566304 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.98 2016/10/24 20:44:08 okan Exp $ + * $OpenBSD: menu.c,v 1.99 2016/12/01 20:28:19 okan Exp $ */ #include @@ -196,7 +196,7 @@ menu_complete_path(struct menu_ctx *mc) TAILQ_INIT(&menuq); if ((mi = menu_filter(sc, &menuq, mc->searchstr, NULL, - (CWM_MENU_DUMMY), search_match_path_any, NULL)) != NULL) { + (CWM_MENU_DUMMY), search_match_path, NULL)) != NULL) { mr->abort = mi->abort; mr->dummy = mi->dummy; if (mi->text[0] != '\0') diff --git a/search.c b/search.c index 616a9be..80d0b1a 100644 --- a/search.c +++ b/search.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: search.c,v 1.57 2016/10/24 18:57:12 okan Exp $ + * $OpenBSD: search.c,v 1.58 2016/12/01 20:28:19 okan Exp $ */ #include @@ -36,10 +36,8 @@ #define PATH_ANY 0x0001 #define PATH_EXEC 0x0002 -static void search_match_path(struct menu_q *, struct menu_q *, +static void search_match_path_type(struct menu_q *, struct menu_q *, char *, int); -static void search_match_path_exec(struct menu_q *, struct menu_q *, - char *); static int strsubmatch(char *, char *, int); void @@ -141,7 +139,8 @@ search_print_client(struct menu *mi, int list) } static void -search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag) +search_match_path_type(struct menu_q *menuq, struct menu_q *resultq, + char *search, int flag) { char pattern[PATH_MAX]; glob_t g; @@ -162,16 +161,10 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in globfree(&g); } -static void -search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) -{ - return(search_match_path(menuq, resultq, search, PATH_EXEC)); -} - void -search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search) +search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search) { - return(search_match_path(menuq, resultq, search, PATH_ANY)); + return(search_match_path_type(menuq, resultq, search, PATH_ANY)); } void @@ -208,14 +201,9 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) if (mj == NULL) TAILQ_INSERT_TAIL(resultq, mi, resultentry); } -} -void -search_match_exec_path(struct menu_q *menuq, struct menu_q *resultq, char *search) -{ - search_match_exec(menuq, resultq, search); if (TAILQ_EMPTY(resultq)) - search_match_path_exec(menuq, resultq, search); + search_match_path_type(menuq, resultq, search, PATH_EXEC); } static int -- cgit v1.2.3-2-gb3c3