From 5a1ee0e65bc8c59fe0f0f3580c50b3b0b90da5b0 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 4 Jun 2008 05:52:30 +0300 Subject: [PATCH] libdpkg: Switch log from a pointer to struct varbuf to just struct varbuf --- ChangeLog | 5 +++++ lib/log.c | 15 +++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 694ed8b2..2e937700 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-04 Guillem Jover + + * lib/log.c (log_message): Switch log from a pointer to struct varbuf + to just struct varbuf. + 2008-06-04 Guillem Jover * src/main.c (setpipe): Fix the setting of more than one pipef. diff --git a/lib/log.c b/lib/log.c index 23cd828b..a46afff4 100644 --- a/lib/log.c +++ b/lib/log.c @@ -36,7 +36,7 @@ const char *log_file = NULL; void log_message(const char *fmt, ...) { - static struct varbuf *log = NULL; + static struct varbuf log; static FILE *logfd = NULL; char time_str[20]; time_t now; @@ -57,21 +57,16 @@ log_message(const char *fmt, ...) setcloexec(fileno(logfd), log_file); } - if (!log) { - log = nfmalloc(sizeof(struct varbuf)); - varbufinit(log); - } else - varbufreset(log); - va_start(al, fmt); - varbufvprintf(log, fmt, al); - varbufaddc(log, 0); + varbufreset(&log); + varbufvprintf(&log, fmt, al); + varbufaddc(&log, 0); va_end(al); time(&now); strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S", localtime(&now)); - fprintf(logfd, "%s %s\n", time_str, log->buf); + fprintf(logfd, "%s %s\n", time_str, log.buf); } struct pipef *status_pipes = NULL; -- 2.39.5