2 * Copyright (c) 1995, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1997-05-01 15:08:15 adam
8 * Added log_mask_str_x routine.
10 * Revision 1.2 1995/11/01 13:55:06 quinn
13 * Revision 1.1 1995/10/06 08:51:25 quinn
20 * Growing buffer for writing various stuff.
28 WRBUF wrbuf_alloc(void)
32 if (!(n = xmalloc(sizeof(*n))))
40 void wrbuf_free(WRBUF b, int free_buf)
42 if (free_buf && b->buf)
47 void wrbuf_rewind(WRBUF b)
52 int wrbuf_grow(WRBUF b, int minsize)
62 if (b->size && !(b->buf =xrealloc(b->buf, b->size += togrow)))
64 else if (!b->size && !(b->buf = xmalloc(b->size = togrow)))
69 int wrbuf_write(WRBUF b, char *buf, int size)
71 if (b->pos + size >= b->size)
73 memcpy(b->buf + b->pos, buf, size);