aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c68
1 files changed, 32 insertions, 36 deletions
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;
+ }
}