From e009f90c4b81898b66cb1b354cf1befb8a36092b Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 1 Sep 2019 23:48:42 -0400 Subject: [PATCH] tweak --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9919c1d..7ed32cd 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,15 @@ This will generate a function (`int match(const char *)`) which is essentially: ``` int match(const char *cp) { - if (!strncasecmp(cp, "abcd", 4)) return (2 << 8) | 4; - if (!strncasecmp(cp, "abc", 3)) return (1 << 8) | 3; + if (!strcasecmp(cp, "abcd")) return (2 << 8) | 4; + if (!strcasecmp(cp, "abc")) return (1 << 8) | 3; return 0; } ``` -(without the `-c` flag it would be more akin to `memcmp` than `strcmp`) +(without the `-c` flag it would be more akin to `memcmp` than `strcmp`. +Actual matching logic is based on the character count not a terminal character +so embedded `0`s match correctly.) But hopefully more efficient...