Skip to content

Commit

Permalink
improve performance of case-insensitive matching
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltjo committed Feb 6, 2022
1 parent d78ff08 commit eb96af2
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions dmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,6 @@ cleanup(void)
XCloseDisplay(dpy);
}

static char *
cistrstr(const char *s, const char *sub)
{
size_t len;

for (len = strlen(sub); *s; s++)
if (!strncasecmp(s, sub, len))
return (char *)s;
return NULL;
}

static int
drawitem(struct item *item, int x, int y, int w)
{
Expand Down Expand Up @@ -722,7 +711,7 @@ main(int argc, char *argv[])
fast = 1;
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
fstrncmp = strncasecmp;
fstrstr = cistrstr;
fstrstr = strcasestr;
} else if (i + 1 == argc)
usage();
/* these options take one argument */
Expand Down

0 comments on commit eb96af2

Please sign in to comment.