improve performance of case-insensitive matching
This commit is contained in:
parent
d78ff08d99
commit
eb96af27f4
13
dmenu.c
13
dmenu.c
@ -102,17 +102,6 @@ cleanup(void)
|
|||||||
XCloseDisplay(dpy);
|
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
|
static int
|
||||||
drawitem(struct item *item, int x, int y, int w)
|
drawitem(struct item *item, int x, int y, int w)
|
||||||
{
|
{
|
||||||
@ -722,7 +711,7 @@ main(int argc, char *argv[])
|
|||||||
fast = 1;
|
fast = 1;
|
||||||
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
|
||||||
fstrncmp = strncasecmp;
|
fstrncmp = strncasecmp;
|
||||||
fstrstr = cistrstr;
|
fstrstr = strcasestr;
|
||||||
} else if (i + 1 == argc)
|
} else if (i + 1 == argc)
|
||||||
usage();
|
usage();
|
||||||
/* these options take one argument */
|
/* these options take one argument */
|
||||||
|
Loading…
Reference in New Issue
Block a user