From e7f94bbf50e7d68c3294efc4d437598b8b56b92d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 13 Jan 2021 18:56:22 -0800 Subject: Working towards zero memory leakage --- file_loader.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'file_loader.h') diff --git a/file_loader.h b/file_loader.h index 2a47d40..85bb920 100644 --- a/file_loader.h +++ b/file_loader.h @@ -8,7 +8,8 @@ struct allocated_op_s; // declared in types.h -typedef struct { +typedef struct file_s { + struct file_s *next; const char *filename; char *contents, **lines, *end; size_t nlines; @@ -16,9 +17,9 @@ typedef struct { unsigned int mmapped:1; } file_t; -file_t *load_file(const char *filename); -__attribute__((nonnull(2), returns_nonnull)) -file_t *spoof_file(const char *filename, char *text); +file_t *load_file(file_t **files, const char *filename); +__attribute__((nonnull(3), returns_nonnull)) +file_t *spoof_file(file_t **files, const char *filename, char *text); __attribute__((nonnull)) void intern_file(file_t *f); __attribute__((nonnull)) -- cgit v1.2.3