diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-03-15 18:29:04 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-03-15 18:29:04 -0700 |
| commit | f1499c9a6356269d0cbc96df52689a743e2d263c (patch) | |
| tree | 56f239586c70480c6d5d3813f0cb7e91a5664c82 /files.c | |
| parent | 00bb63d27708a9ba7f7e5abe04c88fa6e01149fa (diff) | |
Fix for being unable to match patterns on zero-length files (or at the
end of a file)
Diffstat (limited to 'files.c')
| -rw-r--r-- | files.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -164,6 +164,7 @@ void destroy_file(file_t **f) // size_t get_line_number(file_t *f, const char *p) { + if (f->nlines == 0) return 0; // Binary search: size_t lo = 0, hi = f->nlines-1; while (lo <= hi) { |
