diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-06-26 20:26:17 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-06-26 20:45:28 +0200 |
commit | 2ec05306daf63e44c844ef4030c98e20f958f672 (patch) | |
tree | 9ad329deefe9ae5a2bc2cab838b8100602dc99cc /src/z-form.c | |
parent | 63e481780855d2d6469840d9ba853d91c6bb8c28 (diff) |
Avoid use of z-virt.h macros in z-form.c
Diffstat (limited to 'src/z-form.c')
-rw-r--r-- | src/z-form.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/z-form.c b/src/z-form.c index ab195c76..7fec68e8 100644 --- a/src/z-form.c +++ b/src/z-form.c @@ -5,8 +5,8 @@ #include "z-form.h" #include "z-util.h" -#include "z-virt.h" +#include <stdlib.h> /* * Here is some information about the routines in this file. @@ -561,13 +561,17 @@ uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp) static char *vformat(cptr fmt, va_list vp) { static char *format_buf = NULL; - static huge format_len = 0; + static size_t format_len = 0; /* Initial allocation */ if (!format_buf) { format_len = 1024; - C_MAKE(format_buf, format_len, char); + format_buf = calloc(format_len, sizeof(char)); + if (format_buf == NULL) + { + abort(); // Nothing sensible we can do + } } /* Null format yields last result */ @@ -585,9 +589,13 @@ static char *vformat(cptr fmt, va_list vp) if (len < format_len - 1) break; /* Grow the buffer */ - C_KILL(format_buf, format_len, char); + free(format_buf); format_len = format_len * 2; - C_MAKE(format_buf, format_len, char); + format_buf = calloc(format_len, sizeof(char)); + if (format_buf == NULL) + { + abort(); // Nothing sensible we can do + } } /* Return the new buffer */ |