diff options
Diffstat (limited to 'src/common/showmsg.c')
-rw-r--r-- | src/common/showmsg.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 1c1d4ca8b..8ed8efc1d 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -244,13 +244,13 @@ int VFPRINTF(HANDLE handle, const char *fmt, va_list argptr) continue; } else if (*q == ';') { // delimiter - if (numpoint < sizeof(numbers)/sizeof(*numbers)) { + if (numpoint < ARRAYLENGTH(numbers)) { // go to next array position numpoint++; } else { // array is full, so we 'forget' the first value - memmove(numbers,numbers+1,sizeof(numbers)/sizeof(*numbers)-1); - numbers[sizeof(numbers)/sizeof(*numbers)-1]=0; + memmove(numbers, numbers+1, ARRAYLENGTH(numbers)-1); + numbers[ARRAYLENGTH(numbers)-1]=0; } ++q; // and next number @@ -605,9 +605,6 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap) { va_list apcopy; char prefix[100]; -#if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) - FILE *fp; -#endif if (!string || *string == '\0') { ShowError("Empty string passed to vShowMessage_().\n"); @@ -702,8 +699,8 @@ int vShowMessage_(enum msg_type flag, const char *string, va_list ap) } #if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN) - if(strlen(DEBUGLOGPATH) > 0) { - fp=fopen(DEBUGLOGPATH,"a"); + if (strlen(DEBUGLOGPATH) > 0) { + FILE *fp = fopen(DEBUGLOGPATH,"a"); if (fp == NULL) { FPRINTF(STDERR, CL_RED"[ERROR]"CL_RESET": Could not open '"CL_WHITE"%s"CL_RESET"', access denied.\n", DEBUGLOGPATH); FFLUSH(STDERR); |