aboutsummaryrefslogtreecommitdiff
path: root/files.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-18 09:15:25 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-18 09:15:25 -0800
commit3ededef53d0704f8b89c55f60bef52a64b86d62c (patch)
tree686fc67dcc174e4ae729408577c93a25fab2592b /files.c
parent65141b240218df4c40196db63429b90b1cb698a9 (diff)
Static analysis part 1
Diffstat (limited to 'files.c')
-rw-r--r--files.c4
1 files changed, 3 insertions, 1 deletions
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]);