diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-07 02:46:01 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-07 02:46:01 -0400 |
| commit | 5927ba86e342201f0f4feda90dc6836b7fd52176 (patch) | |
| tree | 3bf811195a16ba235a47af0babaa59685e2ebb27 | |
| parent | b0d806a1f06d89785f47ab72ee60a42495200995 (diff) | |
Optimize text matching
| -rw-r--r-- | builtins/text.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/builtins/text.c b/builtins/text.c index b1e4ce14..f322deb3 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -1752,9 +1752,8 @@ public bool Text$has(Text_t text, Pattern_t pattern) public bool Text$matches(Text_t text, Pattern_t pattern) { - int64_t len = 0; - int64_t found = _find(text, pattern, 0, 0, &len); - return (found >= 0) && len == text.length; + int64_t m = match(text, 0, pattern, 0, NULL, 0); + return m == text.length; } public int printf_text_size(const struct printf_info *info, size_t n, int argtypes[n], int sizes[n]) |
