/* helper macro to destructively resize buffers; assumes that bufsiz
* is initialized to 0 if buf is unallocated! */
-#define allocbuf(buf, bufsiz, need) do { \
+#define allocbuf(buf, bufsiz, need, type) do { \
if (!buf || (need) > (bufsiz)) \
{ \
(bufsiz) = ((need) < 1024) ? 1024 : (need); \
xfree(buf); \
- (buf) = xmalloc(bufsiz); \
+ (buf) = (type)xmalloc(bufsiz); \
} \
} while (0);
static char *buf;
static size_t bufsiz;
- allocbuf(buf, bufsiz, len + 1);
+ allocbuf(buf, bufsiz, len + 1, char *);
for (i=0; i<len; ++i)
{
size_t l = strlen(p);
int i = 0;
- allocbuf(buf, bufsiz, l * 2);
+ allocbuf(buf, bufsiz, l * 2, unsigned char *);
while (l--)
{
static unsigned char *buf;
static size_t bufsiz;
- allocbuf(buf, bufsiz, len + 1);
+ allocbuf(buf, bufsiz, len + 1, unsigned char *);
memcpy(buf,p,len);
buf[len] = 0;