[PATCH] log: fix WITH_SYSTEMD_JOURNAL guards
Ben Chan
benchan at chromium.org
Thu Jun 22 06:59:28 UTC 2017
BTW, those WITH_* guards in ModemManager seem a bit inconsistent.
WITH_QMI, WITH_MBIM is only defined as 1 when enabled. The code has a mixed
use of `#if WITH_XXX` and `#if defined WITH_XXX` for them. Other WITH_* is
defined to be either 0 or 1, and the code uses `#if WITH_XXX`. Should we
settle with one style?
On Wed, Jun 21, 2017 at 11:53 PM, Ben Chan <benchan at chromium.org> wrote:
> Commit fd0bed1df ("log: Add support for journal logging") added a
> configure option --with-systemd-journal to enable journal logging.
> However, configure always defines WITH_SYSTEMD_JOURNAL, which is either
> 0 or 1. Thus, `#if WITH_SYSTEMD_JOURNAL` should be used instead of
> `#if defined WITH_SYSTEMD_JOURNAL` to properly guard the journal logging
> code.
> ---
> src/mm-log.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/mm-log.c b/src/mm-log.c
> index 5691b26f..8b1fa425 100644
> --- a/src/mm-log.c
> +++ b/src/mm-log.c
> @@ -35,7 +35,7 @@
> #include <libmbim-glib.h>
> #endif
>
> -#if defined WITH_SYSTEMD_JOURNAL
> +#if WITH_SYSTEMD_JOURNAL
> #define SD_JOURNAL_SUPPRESS_LOCATION
> #include <systemd/sd-journal.h>
> #endif
> @@ -153,7 +153,7 @@ log_backend_syslog (const char *loc,
> syslog (syslog_level, "%s", message);
> }
>
> -#if defined WITH_SYSTEMD_JOURNAL
> +#if WITH_SYSTEMD_JOURNAL
> static void
> log_backend_systemd_journal (const char *loc,
> const char *func,
> @@ -301,7 +301,7 @@ mm_log_setup (const char *level,
> /* Grab start time for relative timestamps */
> g_get_current_time (&rel_start);
>
> -#if defined WITH_SYSTEMD_JOURNAL
> +#if WITH_SYSTEMD_JOURNAL
> if (log_journal) {
> log_backend = log_backend_systemd_journal;
> append_log_level_text = FALSE;
> --
> 2.13.1.611.g7e3b11ae1-goog
>
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/modemmanager-devel/attachments/20170621/af66553c/attachment.html>
More information about the ModemManager-devel
mailing list