X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/059ec3d9952740285fb1ebf47961b8aca2eb1b4a..a310a8d09c56e6049714ae4e4070c16ecb6aa2b1:/src/src/dummies.c diff --git a/src/src/dummies.c b/src/src/dummies.c index c06202004..2e1ad11f5 100644 --- a/src/src/dummies.c +++ b/src/src/dummies.c @@ -1,10 +1,8 @@ -/* $Cambridge: exim/src/src/dummies.c,v 1.1 2004/10/07 10:39:01 ph10 Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2004 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ /* This file is not part of the main Exim code. There are little bits of test @@ -22,7 +20,7 @@ alternates. */ /* We don't have the full Exim headers dragged in, but this function is used for debugging output. */ -extern int string_vformat(char *, int, char *, va_list); +extern gstring * string_vformat(gstring *, BOOL, const char *, va_list); /************************************************* @@ -71,22 +69,24 @@ void debug_printf(char *format, ...) { va_list ap; -char buffer[1024]; +gstring * g = string_get(1024); +void * reset_point = g; va_start(ap, format); -if (!string_vformat(buffer, sizeof(buffer), format, ap)) +if (!string_vformat(g, FALSE, format, ap)) { - char *s = "**** debug string overflowed buffer ****\n"; - char *p = buffer + (int)strlen(buffer); - int maxlen = sizeof(buffer) - (int)strlen(s) - 3; - if (p > buffer + maxlen) p = buffer + maxlen; - if (p > buffer && p[-1] != '\n') *p++ = '\n'; + char * s = "**** debug string overflowed buffer ****\n"; + char * p = CS g->s + g->ptr; + int maxlen = g->size - (int)strlen(s) - 3; + if (p > g->s + maxlen) p = g->s + maxlen; + if (p > g->s && p[-1] != '\n') *p++ = '\n'; strcpy(p, s); } -fprintf(stderr, "%s", buffer); +fprintf(stderr, "%s", string_from_gstring(g)); fflush(stderr); +store_reset(reset_point); va_end(ap); } @@ -102,7 +102,7 @@ void sigalrm_handler(int sig) { sig = sig; /* Keep picky compilers happy */ -sigalrm_seen = 1; +sigalrm_seen = TRUE; }