This commit is contained in:
Kelvin Sherlock 2019-09-01 23:33:19 -04:00
parent 5304ec5905
commit db84b13884

View File

@ -39,12 +39,14 @@ This will generate a function (`int match(const char *)`) which is essentially:
```
int match(const char *cp) {
if (!strncasecmp(cp, "abcd\x00", 5)) return (2 << 8) | 4;
if (!strncasecmp(cp, "abc\x00", 4)) return (1 << 8) | 3;
if (!strncasecmp(cp, "abcd", 4)) return (2 << 8) | 4;
if (!strncasecmp(cp, "abc", 3)) return (1 << 8) | 3;
return 0;
}
```
(without the `-c` flag it would be more akin to `memcmp` than `strcmp`)
But hopefully more efficient...
```