From: Hugo Villeneuve Date: Sun, 26 Jan 2014 20:28:36 +0000 (-0500) Subject: Move macro definition to top of file X-Git-Tag: v2.0.1~35 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=c2ac9fc48f2772a87164e0e432fc773debe47e89;p=emu8051.git Move macro definition to top of file --- diff --git a/src/common/hexfile.c b/src/common/hexfile.c index c879c89..80a0aac 100644 --- a/src/common/hexfile.c +++ b/src/common/hexfile.c @@ -36,6 +36,9 @@ #include "common.h" #include "memory.h" +/* Maximum of 75 digits with 32-bytes data records. */ +#define HEXFILE_LINE_BUFFER_LEN 128 + /* Convert integer to ASCII hex string. */ void int2asciihex(int val, char *str, int width) @@ -96,11 +99,9 @@ void LoadHexFile(const char *filename) { int i, j, RecLength, LoadOffset, RecType, Data, Checksum; - -#define LINE_BUFFER_LEN 256 FILE *fp; int status; - char line[LINE_BUFFER_LEN]; + char line[HEXFILE_LINE_BUFFER_LEN]; if (filename == NULL) log_fail("No file specified"); @@ -117,7 +118,7 @@ LoadHexFile(const char *filename) stored into the buffer. A '\0' is stored after the last character in the buffer. */ - while (fgets(line, LINE_BUFFER_LEN, fp) != NULL) { + while (fgets(line, HEXFILE_LINE_BUFFER_LEN, fp) != NULL) { i = 0; Checksum = 0;