diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-11-23 10:14:47 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-11-23 10:14:47 +0000 |
commit | 2bb31a4caf977669602b10353d8f4d5814cb5f71 (patch) | |
tree | 546479142690589918028a665e1310d34fa08ef0 /report.c | |
parent | 8af8e5038a6126fbd3c3dae3a7acf82e5728f647 (diff) | |
download | fetchmail-2bb31a4caf977669602b10353d8f4d5814cb5f71.tar.gz fetchmail-2bb31a4caf977669602b10353d8f4d5814cb5f71.tar.bz2 fetchmail-2bb31a4caf977669602b10353d8f4d5814cb5f71.zip |
Factor out common code from report_build/report_complete.
svn path=/trunk/; revision=4473
Diffstat (limited to 'report.c')
-rw-r--r-- | report.c | 44 |
1 files changed, 18 insertions, 26 deletions
@@ -205,6 +205,22 @@ void report_init(int mode) newline) before report() prints its message. */ /* VARARGS */ +static void rep_ensuresize(void) { + /* Make an initial guess for the size of any single message fragment. */ + if (partial_message_size == 0) + { + partial_message_size_used = 0; + partial_message_size = 2048; + partial_message = MALLOC (partial_message_size); + } + else + if (partial_message_size - partial_message_size_used < 1024) + { + partial_message_size += 2048; + partial_message = REALLOC (partial_message, partial_message_size); + } +} + void #ifdef HAVE_STDARG_H report_build (FILE *errfp, const char *message, ...) @@ -219,19 +235,7 @@ report_build (FILE *errfp, message, va_alist) int n; #endif - /* Make an initial guess for the size of any single message fragment. */ - if (partial_message_size == 0) - { - partial_message_size_used = 0; - partial_message_size = 2048; - partial_message = MALLOC (partial_message_size); - } - else - if (partial_message_size - partial_message_size_used < 1024) - { - partial_message_size += 2048; - partial_message = REALLOC (partial_message, partial_message_size); - } + rep_ensuresize(); #if defined(VA_START) VA_START (args, message); @@ -296,19 +300,7 @@ report_complete (FILE *errfp, message, va_alist) int n; #endif - /* Make an initial guess for the size of any single message fragment. */ - if (partial_message_size == 0) - { - partial_message_size_used = 0; - partial_message_size = 2048; - partial_message = MALLOC (partial_message_size); - } - else - if (partial_message_size - partial_message_size_used < 1024) - { - partial_message_size += 2048; - partial_message = REALLOC (partial_message, partial_message_size); - } + rep_ensuresize(); #if defined(VA_START) VA_START (args, message); |