commit 6634d54e814f8772c28b1bbee5bfe4460a142afd
parent 30201d443128e974504495226ecd48d47ae006cf
Author: Frederic Cambus <fred@statdns.com>
Date: Fri, 22 Jul 2016 12:20:32 +0200
Get rid of intermediate variables
Diffstat:
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -290,12 +290,10 @@ int main(int argc, char *argv[]) {
}
// get the file size (bytes)
- size_t get_file_size = filesize(input);
- int32_t input_file_size = (int32_t)get_file_size;
+ size_t input_file_size = filesize(input);
// next up is loading our file into a dynamically allocated memory buffer
unsigned char *input_file_buffer;
- int32_t result;
// allocate memory to contain the whole file
input_file_buffer = (unsigned char *) malloc(sizeof(unsigned char)*input_file_size);
@@ -304,8 +302,7 @@ int main(int argc, char *argv[]) {
}
// copy the file into the buffer
- result = fread(input_file_buffer, 1, input_file_size, input_file);
- if (result != input_file_size) {
+ if (fread(input_file_buffer, 1, input_file_size, input_file) != input_file_size) {
fputs ("\nReading error.\n\n", stderr); exit (3);
} // whole file is now loaded into input_file_buffer