Use more generic variable names in read_files()
This commit is contained in:
parent
723155a2ce
commit
4bcbb69fc7
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user