fix(diff): use mmfile_t in linematch

Problem:

Linematch used to use strchr to navigate a string, however strchr does
not supoprt embedded NULs.

Solution:

Use `mmfile_t` instead of `char *` in linematch and introduce `strnchr()`.

Also remove heap allocations from `matching_char_iwhite()`

Fixes: #30505
This commit is contained in:
Lewis Russell
2024-09-26 16:10:11 +01:00
parent 20251be15a
commit c65646c247
9 changed files with 108 additions and 79 deletions

View File

@@ -3,6 +3,7 @@
#include <stddef.h> // IWYU pragma: keep
#include "nvim/pos_defs.h" // IWYU pragma: keep
#include "xdiff/xdiff.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "linematch.h.generated.h"