From 3ededef53d0704f8b89c55f60bef52a64b86d62c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 18 Jan 2021 09:15:25 -0800 Subject: Static analysis part 1 --- files.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'files.c') diff --git a/files.c b/files.c index 145d1c1..0296a35 100644 --- a/files.c +++ b/files.c @@ -18,6 +18,8 @@ __attribute__((nonnull)) static void populate_lines(file_t *f); +__attribute__((pure, nonnull)) +static size_t get_char_number(file_t *f, const char *p); // // In the file object, populate the `lines` array with pointers to the @@ -185,7 +187,7 @@ size_t get_line_number(file_t *f, const char *p) // // Given a pointer, determine which character offset within the line it points to. // -size_t get_char_number(file_t *f, const char *p) +static size_t get_char_number(file_t *f, const char *p) { size_t linenum = get_line_number(f, p); return 1 + (size_t)(p - f->lines[linenum-1]); -- cgit v1.2.3