diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-06-17 14:40:56 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-06-17 14:40:56 +0200 |
commit | 1d0442da72fc734f12767ad019010ccb7e0d12cd (patch) | |
tree | 770213ecbaa2e326b26a40ec15531fa4925b18c2 /ax25rtd/ax25rtctl.c | |
parent | 7cc473aed830db1395ed0d0701791889a6e96e4f (diff) |
ax25ipd: Make LOGx() macros bulletproof.
The LOGL1..LOGL4 macros were defined like:
Now consider an invocation like:
if (condition)
LOGL1(...);
else
something_different();
CPP will expand this like:
if (condition)
if (loglevel>0)
syslog(LOG_DAEMON | LOG_WARNING, ...);
else
something_different();
That is the else would now be considered associated with the wrong if.
Macro arguments may also not have been evaluated on every invocation
making the use of these function-like looking macros not function like.
For example:
LOGL1("%d", i++);
would be expanded to
if (loglevel>0)
syslog(LOG_DAEMON | LOG_WARNING, i++);
That is depending on the value of loglevel i++ would only be incremented if
syslog was actually being called.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25rtd/ax25rtctl.c')
0 files changed, 0 insertions, 0 deletions