Merge 4e3c93e failed: it should contain log.c from a1a296f, not a mix
between both varargs fix implementations (the other is f88dff0).
The resulting merge fails tests (on 64 bits architecture), while both
parents pass.
"man stdarg" says:
If ap is passed to a function that uses va_arg(ap,type) then the value
of ap is undefined after the return of that function.
va_start(…) and va_end(…) must be called at each iteration.
By chance, it worked in 32 bits, but it segfaulted in 64 bits.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31484
Refactor much of the new code in log.c
Add new functions: cf_load_strict() and cf_reload_strict() for use by the
server, which does not want to overwrite its in-memory config at all if there
is any defect in the config file. However, commands always want to overwrite
the default in-memory config, even with a defective config file, so that
logging has a chance to succeed.
Added `log_format.dump_config` boolean config option
Indepent configuration of show_pid, show_time and log level for each
destination
Update test scripts for new config options
Include xprintf.c in MDP client source files (now used by log.c)
Upgrade configuration schema macros to allow optional "default label"
argument to SUB_STRUCT and VALUE_SUB_STRUCT elements.
New STRUCT_DEFAULT section declares alternative STRUCT default values
with a label.
If configuration is bad, do not execute commands except those with the
PERMISSIVE_CONFIG property.
Flush log buffer immediately after clearing cf_limbo flag, in case there are no
further log messages that would cause the flush. (Fixes bug that an unrecognised
command produced no log output.)
More block comments in log.c.
Introduce __WHENCE__ macro and a block comment in log.h explaining it.
In "primitive" kinds of functions, rename 'whence' arguments to '__whence' and
use WHYF(), WARNF(), DEBUGF() macros instead of calling logMessage() directly.
Replace "..." quoting with `...` quoting in output, to avoid slosh-escaping the
common double-quote character (") in log output.
Introduce alloca_str_toprint() function that produces an entire null-terminated
string in printable form.
Change various toprint strbuf helper functions to take two optional quote chars
instead of one mandatory.
Replaces (const char *file, unsigned int line, const char *function) arguments
to all logging functions, simplifies malloc/free tracking code in
overlay_buffer.c and Rhizome manifest alloc/free tracking in rhizome_bundle.c.
Use __HERE__ macro instead of (__FILE__, __LINE__, __FUNCTION__) everywhere.
Special __NOWHERE__ macro is equivalent to (NULL, 0, NULL).
Declare net.c functions in new "net.h" header, so log.c doesn't have to pull
in the entire "serval.h" just to use write_str().
Facilitates progress on issue #2.
Replace DEBUG_SIMULATION with DEBUG_VOMP
Replace all printf(...) and fprintf(stderr,...) with WHYF(...) and DEBUGF(...)
Make all debug logging conditional on DEBUG_VOMP
Move DEBUG_ and LOG_LEVEL_ macro constants from constants.h into log.h.
Move dumpResponses() out of log.c, so that log.h is almost ready for re-use
(still depends on conf.h).
Remove unused and now obsolete catv() function -- replaced with toprint()
and alloca_toprint().
Add copyright/licence comments, fix up some copyright attributions.
Add #ifndef..#define..#endif __SERVALD_FOO_H to header files: log.h serval.h
constants.h