From 4bcbb69fc75b4d4390c601fa0026f2d49f8513ec Mon Sep 17 00:00:00 2001 From: hasufell Date: Sat, 10 May 2014 20:25:24 +0200 Subject: [PATCH] Use more generic variable names in read_files() --- src/filereader.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/filereader.c b/src/filereader.c index a98fd81..409e2f3 100644 --- a/src/filereader.c +++ b/src/filereader.c @@ -68,15 +68,15 @@ char *read_file(char const * const filename) { char buf[STD_FILE_BUF], *string = NULL; - int objfile = 0; + int fd = 0; size_t str_size = 0; ssize_t n; - objfile = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY); - if (objfile != -1) { + if (fd != -1) { /* read and copy chunks */ - while ((n = read(objfile, buf, STD_FILE_BUF)) > 0) { + while ((n = read(fd, buf, STD_FILE_BUF)) > 0) { char *tmp_ptr = NULL; str_size += n; /* count total bytes read */ @@ -94,7 +94,7 @@ char *read_file(char const * const filename) /* add trailing NULL byte */ string[str_size] = '\0'; - close(objfile); + close(fd); return string; } else {