diff options
| author | Bruce Hill <bruce@stainless.com> | 2025-08-22 13:06:08 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@stainless.com> | 2025-08-22 13:06:08 -0400 |
| commit | 2d81f92fbadb0d60243cbcad7c4a5236815fdbbc (patch) | |
| tree | 99284bfcc320c102941a4d885b195d182899821f /match.c | |
| parent | 20c11b29b3a63c221cac942a17bf9abcf8b9bafe (diff) | |
Mac platform fixes
Diffstat (limited to 'match.c')
| -rw-r--r-- | match.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -10,6 +10,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/param.h> #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)); |
