diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-05-31 12:56:49 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-05-31 12:56:49 -0700 |
| commit | a67a25704406456cbd1d84115892c9cb5187b06c (patch) | |
| tree | 2e0eef9509d87b9a1c678dde6e78a49ba3e2788c /files.c | |
| parent | da6c8857d6bad131635a846e8177e7c00a4c224e (diff) | |
Fix compiler warning nits
Diffstat (limited to 'files.c')
| -rw-r--r-- | files.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -98,14 +98,16 @@ file_t *load_file(file_t **files, const char *filename) skip_mmap: f->mmapped = false; - size_t capacity = 1000; - length = 0; - f->memory = xcalloc(sizeof(char), capacity); - ssize_t just_read; - while ((just_read=read(fd, &f->memory[length], capacity - length)) > 0) { - length += (size_t)just_read; - if (length >= capacity) - f->memory = xrealloc(f->memory, sizeof(char)*(capacity *= 2) + 1); + { + size_t capacity = 1000; + length = 0; + f->memory = xcalloc(sizeof(char), capacity); + ssize_t just_read; + while ((just_read=read(fd, &f->memory[length], capacity - length)) > 0) { + length += (size_t)just_read; + if (length >= capacity) + f->memory = xrealloc(f->memory, sizeof(char)*(capacity *= 2) + 1); + } } finished_loading: |
