From 2d81f92fbadb0d60243cbcad7c4a5236815fdbbc Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 22 Aug 2025 13:06:08 -0400 Subject: Mac platform fixes --- match.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'match.c') diff --git a/match.c b/match.c index e714a45..85cbccc 100644 --- a/match.c +++ b/match.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "match.h" #include "pattern.h" @@ -339,7 +340,7 @@ static bp_match_t *_next_match(match_ctx_t *ctx, const char *str, bp_pat_t *pat, if (!skip && first->type == BP_STRING && first->min_matchlen > 0) { char *found = ctx->ignorecase ? strcasestr(str, When(first, BP_STRING)->string) - : memmem(str, (size_t)(ctx->end - str), When(first, BP_STRING)->string, first->min_matchlen); + : strnstr(str, When(first, BP_STRING)->string, MIN((size_t)(ctx->end - str), first->min_matchlen)); str = found ? found : ctx->end; } else if (!skip && str > ctx->start && (first->type == BP_START_OF_LINE || first->type == BP_END_OF_LINE)) { char *found = memchr(str, '\n', (size_t)(ctx->end - str)); -- cgit v1.2.3