aboutsummaryrefslogtreecommitdiff
path: root/files.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-05-20 18:31:28 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-05-20 18:31:28 -0700
commit219f62ed3f51a1094e75d4bf8823db7608e70b0e (patch)
tree4fcfbb08525b61590086ba1494152721d9bbb221 /files.h
parentcc6e25a06fdebbabe4b170ca5f43c399cfa0f70e (diff)
Renamed file_t.contents -> file_t.start, added file_t.memory for
canonical tracking of memory for mmap, simplified json printing, and added support for initiating searches on a specific line (and/or column).
Diffstat (limited to 'files.h')
-rw-r--r--files.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/files.h b/files.h
index 447a52f..c3ee37d 100644
--- a/files.h
+++ b/files.h
@@ -15,7 +15,7 @@ struct allocated_pat_s; // declared in types.h
typedef struct file_s {
struct file_s *next;
const char *filename;
- char *contents, **lines, *end;
+ char *memory, **lines, *start, *end;
size_t nlines;
struct allocated_pat_s *pats;
bool mmapped:1;
@@ -25,6 +25,8 @@ __attribute__((nonnull(2)))
file_t *load_file(file_t **files, const char *filename);
__attribute__((format(printf,2,3)))
file_t *load_filef(file_t **files, const char *fmt, ...);
+__attribute__((nonnull))
+void slice_file(file_t *slice, file_t *src, const char *start, const char *end);
__attribute__((nonnull(3), returns_nonnull))
file_t *spoof_file(file_t **files, const char *filename, const char *text, ssize_t len);
__attribute__((nonnull))