diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-10-21 21:37:18 +0300 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-10-21 21:51:56 +0300 |
commit | 31d2ae8936d48976fcf3a4f017ace6410f27136f (patch) | |
tree | 7df92f0f34a076f3676d6e3673a76701b259b231 | |
parent | 04646db1bf7dee24d6063d61fc320e896ba36941 (diff) |
util.h: make step const
-rw-r--r-- | src/util.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -33,7 +33,8 @@ static inline void for_each_line_in_file(FILE *f, void (*cb)(const char *line, void *data), void *data) { char *buffer = NULL; - size_t step = 1024, allocated = 0, written = 0, read = 0; + const size_t step = 1024; + size_t allocated = 0, written = 0, read = 0; do { if (written + read >= allocated && !(buffer = realloc(buffer, (allocated += step) + 1))) err(EXIT_FAILURE, "realloc"); |