improve performance of case-insensitive matching
eb96af27
1 file(s) · +1 −12
| 102 | 102 | XCloseDisplay(dpy); |
|
| 103 | 103 | } |
|
| 104 | 104 | ||
| 105 | - | static char * |
|
| 106 | - | cistrstr(const char *s, const char *sub) |
|
| 107 | - | { |
|
| 108 | - | size_t len; |
|
| 109 | - | ||
| 110 | - | for (len = strlen(sub); *s; s++) |
|
| 111 | - | if (!strncasecmp(s, sub, len)) |
|
| 112 | - | return (char *)s; |
|
| 113 | - | return NULL; |
|
| 114 | - | } |
|
| 115 | - | ||
| 116 | 105 | static int |
|
| 117 | 106 | drawitem(struct item *item, int x, int y, int w) |
|
| 118 | 107 | { |
|
| 722 | 711 | fast = 1; |
|
| 723 | 712 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ |
|
| 724 | 713 | fstrncmp = strncasecmp; |
|
| 725 | - | fstrstr = cistrstr; |
|
| 714 | + | fstrstr = strcasestr; |
|
| 726 | 715 | } else if (i + 1 == argc) |
|
| 727 | 716 | usage(); |
|
| 728 | 717 | /* these options take one argument */ |
|