forked from github/server
do not use macros for va_copy, which is available from C99 on and with gcc >= 3.0.
this somehow eliminates bogus cppcheck warnings
This commit is contained in:
parent
14444915df
commit
4e9b4a35c3
2 changed files with 13 additions and 14 deletions
|
@ -205,15 +205,17 @@ log_t *log_to_file(int flags, FILE *out) {
|
||||||
return log_create(flags, out, log_stdio);
|
return log_create(flags, out, log_stdio);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
/*
|
||||||
/* https://social.msdn.microsoft.com/Forums/vstudio/en-US/53a4fd75-9f97-48b2-aa63-2e2e5a15efa3/stdcversion-problem?forum=vclanguage */
|
* Notes for va_copy compatibility:
|
||||||
#define VA_COPY(c, a) va_copy(c, a)
|
* MSVC: https://social.msdn.microsoft.com/Forums/vstudio/en-US/53a4fd75-9f97-48b2-aa63-2e2e5a15efa3/stdcversion-problem?forum=vclanguage
|
||||||
#elif !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
|
* GNU: https://www.gnu.org/software/libc/manual/html_node/Argument-Macros.html
|
||||||
/* GNU only: https://www.gnu.org/software/libc/manual/html_node/Argument-Macros.html */
|
*/
|
||||||
#define VA_COPY(c, a) __va_copy(c, a)
|
static void vlog(log_t *lg, int level, const char *format, va_list args) {
|
||||||
#else
|
va_list copy;
|
||||||
#define VA_COPY(c, a) va_copy(c, a)
|
va_copy(copy, args);
|
||||||
#endif
|
lg->log(lg->data, level, NULL, format, copy);
|
||||||
|
va_end(copy);
|
||||||
|
}
|
||||||
|
|
||||||
static void log_write(int flags, const char *module, const char *format, va_list args) {
|
static void log_write(int flags, const char *module, const char *format, va_list args) {
|
||||||
log_t *lg;
|
log_t *lg;
|
||||||
|
@ -225,10 +227,7 @@ static void log_write(int flags, const char *module, const char *format, va_list
|
||||||
dupe = check_dupe(format, level);
|
dupe = check_dupe(format, level);
|
||||||
}
|
}
|
||||||
if (dupe == 0) {
|
if (dupe == 0) {
|
||||||
va_list copy;
|
vlog(lg, level, format, args);
|
||||||
VA_COPY(copy, args);
|
|
||||||
lg->log(lg->data, level, NULL, format, copy);
|
|
||||||
va_end(copy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifndef PATH_MAX
|
||||||
/* @see https://insanecoding.blogspot.no/2007/11/pathmax-simply-isnt.html */
|
/* @see https://insanecoding.blogspot.no/2007/11/pathmax-simply-isnt.html */
|
||||||
#define PATH_MAX 260
|
#define PATH_MAX 260
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue