Make the dss log facility C89 conform.
authorDaniel Richard G <skunk@iSKUNK.ORG>
Fri, 10 Aug 2012 12:41:22 +0000 (14:41 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 15 Aug 2012 09:39:26 +0000 (11:39 +0200)
commit66cdd5bc99a53d2b408a6cdc2d501fe27f9db13b
tree307c326d7a5cc4e8bfd6b414d8252e3ca31e3183
parentb3aca66350a1a4244cdad55fcd8cd64293336006
Make the dss log facility C89 conform.

Variadic macros were introduced in C99, so they are not supported on
ANSI C compilers. Since currently all DSS_*_LOG macros are variadic,
we need a replacement for these. Moreover, since not all compilers
support __func__ or an equivalent, we need to check for this feature
as well and provide a workaround if necessary.

This patch introduces the new public function dss_log_set_params()
which saves the given log level, filename, line number and the
function name in global variables. The DSS_*_LOG macros are changed
to receive a single argument only, which is the usual variadic list,
enclosed in additional parentheses.

The new DSS_*_LOG macros first set the log parameters by calling
dss_log_set_params(), then call dss_log() with the variadic list as
the argument. dss_log() is patched to print the function name only
if __func__ is supported and fall back to file name and the line
number otherwise.

All DSS_*_LOG() calls are changed to the new syntax.
daemon.c
df.c
dss.c
error.h
exec.c
ipc.c
log.h
signal.c
string.c
time.c