From ca30474d6158fc5c81d963ca9d21ce4d9d964c28 Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 23 Jan 2018 13:51:39 +0000 Subject: Shrink tier[] by one after removing matchname in r1.55. --- search.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/search.c b/search.c index 2b58461..fde91af 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.67 2017/12/29 20:03:46 okan Exp $ + * $OpenBSD: search.c,v 1.68 2018/01/23 13:51:39 okan Exp $ */ #include @@ -69,7 +69,7 @@ match_substr(char *sub, char *str, int zeroidx) void search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) { - struct menu *mi, *tierp[4], *before = NULL; + struct menu *mi, *tierp[3], *before = NULL; struct client_ctx *cc; struct winname *wn; @@ -88,14 +88,14 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) if (tier < 0) { TAILQ_FOREACH_REVERSE(wn, &cc->nameq, name_q, entry) if (match_substr(search, wn->name, 0)) { - tier = 2; + tier = 1; break; } } /* Match on window resource class. */ if ((tier < 0) && match_substr(search, cc->ch.res_class, 0)) - tier = 3; + tier = 2; if (tier < 0) continue; @@ -108,9 +108,6 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) if ((tier > 0) && (cc->flags & CLIENT_HIDDEN)) tier--; - if (tier >= nitems(tierp)) - errx(1, "%s: invalid tier", __func__); - /* * If you have a tierp, insert after it, and make it * the new tierp. If you don't have a tierp, find the -- cgit v1.2.3-2-gb3c3