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.
This commit is contained in:
okan 2016-12-01 20:28:19 +00:00
parent b94f0748d8
commit 94f681fc90
4 changed files with 9 additions and 23 deletions

View File

@ -442,9 +442,7 @@ void search_match_client(struct menu_q *, struct menu_q *,
char *); char *);
void search_match_exec(struct menu_q *, struct menu_q *, void search_match_exec(struct menu_q *, struct menu_q *,
char *); char *);
void search_match_exec_path(struct menu_q *, void search_match_path(struct menu_q *, struct menu_q *,
struct menu_q *, char *);
void search_match_path_any(struct menu_q *, struct menu_q *,
char *); char *);
void search_match_text(struct menu_q *, struct menu_q *, void search_match_text(struct menu_q *, struct menu_q *,
char *); char *);

View File

@ -451,7 +451,7 @@ kbfunc_menu_exec(void *ctx, union arg *arg, enum xev xev)
if ((mi = menu_filter(sc, &menuq, label, NULL, if ((mi = menu_filter(sc, &menuq, label, NULL,
(CWM_MENU_DUMMY | CWM_MENU_FILE), (CWM_MENU_DUMMY | CWM_MENU_FILE),
search_match_exec_path, NULL)) != NULL) { search_match_exec, NULL)) != NULL) {
if (mi->text[0] == '\0') if (mi->text[0] == '\0')
goto out; goto out;
switch (cmd) { switch (cmd) {

2
menu.c
View File

@ -196,7 +196,7 @@ menu_complete_path(struct menu_ctx *mc)
TAILQ_INIT(&menuq); TAILQ_INIT(&menuq);
if ((mi = menu_filter(sc, &menuq, mc->searchstr, NULL, 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->abort = mi->abort;
mr->dummy = mi->dummy; mr->dummy = mi->dummy;
if (mi->text[0] != '\0') if (mi->text[0] != '\0')

View File

@ -36,10 +36,8 @@
#define PATH_ANY 0x0001 #define PATH_ANY 0x0001
#define PATH_EXEC 0x0002 #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); char *, int);
static void search_match_path_exec(struct menu_q *, struct menu_q *,
char *);
static int strsubmatch(char *, char *, int); static int strsubmatch(char *, char *, int);
void void
@ -141,7 +139,8 @@ search_print_client(struct menu *mi, int list)
} }
static void 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]; char pattern[PATH_MAX];
glob_t g; glob_t g;
@ -162,16 +161,10 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in
globfree(&g); 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 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 void
@ -208,14 +201,9 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
if (mj == NULL) if (mj == NULL)
TAILQ_INSERT_TAIL(resultq, mi, resultentry); 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)) if (TAILQ_EMPTY(resultq))
search_match_path_exec(menuq, resultq, search); search_match_path_type(menuq, resultq, search, PATH_EXEC);
} }
static int static int