]> err.no Git - dpkg/commitdiff
libdpkg: Switch log from a pointer to struct varbuf to just struct varbuf
authorGuillem Jover <guillem@debian.org>
Wed, 4 Jun 2008 02:52:30 +0000 (05:52 +0300)
committerGuillem Jover <guillem@debian.org>
Wed, 4 Jun 2008 02:52:30 +0000 (05:52 +0300)
ChangeLog
lib/log.c

index 694ed8b210d40004c0c9d96992bf160d409ab00b..2e937700f7fb77921963b49a3f8ee3549d9250b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-04  Guillem Jover  <guillem@debian.org>
+
+       * lib/log.c (log_message): Switch log from a pointer to struct varbuf
+       to just struct varbuf.
+
 2008-06-04  Guillem Jover  <guillem@debian.org>
 
        * src/main.c (setpipe): Fix the setting of more than one pipef.
index 23cd828bb2c61a9dc721c31595e73cdb69f7e331..a46afff4cd8a8f7eb0721b0ff72e5578ce707045 100644 (file)
--- 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;