From ef21e0368adf8ae0e557e9c02fe776f69818ace6 Mon Sep 17 00:00:00 2001 From: james <> Date: Sun, 2 Mar 2008 10:38:18 +0000 Subject: *** empty log message *** --- src/log.c | 68 ++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 36 deletions(-) (limited to 'src/log.c') diff --git a/src/log.c b/src/log.c index 7c04f23..979489a 100644 --- a/src/log.c +++ b/src/log.c @@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.6 2008/03/02 10:37:56 james + * *** empty log message *** + * * Revision 1.5 2008/02/27 01:31:14 james * *** empty log message *** * @@ -29,8 +32,7 @@ static char rcsid[] = "$Id$"; #include "project.h" -typedef struct -{ +typedef struct { LOG_SIGNATURE; int do_close; FILE *fp; @@ -85,17 +87,14 @@ file_log_new (char *fn) FILE *f; int dc = 1; - if (fn && strcmp (fn, "-")) - { - f = fopen (fn, "a+"); - if (!f) - return NULL; - } - else - { - f = stderr; - dc = 0; - } + if (fn && strcmp (fn, "-")) { + f = fopen (fn, "a+"); + if (!f) + return NULL; + } else { + f = stderr; + dc = 0; + } l = malloc (sizeof (File_Log)); @@ -121,35 +120,32 @@ log_f (Log * log, char *fmt, ...) if (!log) return; - if (!size) - { - size = 128; - buf = malloc (size); - } + if (!size) { + size = 128; + buf = malloc (size); + } if (!buf) return; - while (1) - { - va_start (ap, fmt); - n = vsnprintf (buf, size, fmt, ap); - va_end (ap); + while (1) { + va_start (ap, fmt); + n = vsnprintf (buf, size, fmt, ap); + va_end (ap); - if (n > -1 && n < size) - { - log->log (log, buf); - return; - } + if (n > -1 && n < size) { + log->log (log, buf); + return; + } - if (n > -1) /* glibc 2.1 */ - size = n + 1; - else /* glibc 2.0 */ - size *= 2; /* twice the old size */ + if (n > -1) /* glibc 2.1 */ + size = n + 1; + else /* glibc 2.0 */ + size *= 2; /* twice the old size */ - buf = realloc (buf, size); + buf = realloc (buf, size); - if (!buf) - return; - } + if (!buf) + return; + } } -- cgit v1.2.3