diff options
author | james <> | 2008-03-02 10:38:18 +0000 |
---|---|---|
committer | james <> | 2008-03-02 10:38:18 +0000 |
commit | ef21e0368adf8ae0e557e9c02fe776f69818ace6 (patch) | |
tree | cdfceba6afd3c2570cfe6d3e0c4f8fb46f182d15 /src/log.c | |
parent | f23e17f2eac3f506afe9a1e44302112cc363b59f (diff) | |
download | sympathy-ef21e0368adf8ae0e557e9c02fe776f69818ace6.tar.gz sympathy-ef21e0368adf8ae0e557e9c02fe776f69818ace6.tar.bz2 sympathy-ef21e0368adf8ae0e557e9c02fe776f69818ace6.zip |
*** empty log message ***
Diffstat (limited to 'src/log.c')
-rw-r--r-- | src/log.c | 68 |
1 files changed, 32 insertions, 36 deletions
@@ -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; + } } |