Mercurial > ~dholland > hg > tradcpp > index.cgi
diff output.c @ 39:337110e7240a
Pass the size to free; it makes debug checking easier.
author | David A. Holland |
---|---|
date | Sat, 30 Mar 2013 21:17:47 -0400 |
parents | 76c114899f63 |
children | 4cc1c575951f |
line wrap: on
line diff
--- a/output.c Sat Mar 30 21:02:25 2013 -0400 +++ b/output.c Sat Mar 30 21:17:47 2013 -0400 @@ -149,14 +149,17 @@ void output(const struct place *p, const char *buf, size_t len) { + size_t oldmax; + if (linebufpos + len > linebufmax) { + oldmax = linebufmax; if (linebufmax == 0) { linebufmax = 64; } while (linebufpos + len > linebufmax) { linebufmax *= 2; } - linebuf = dorealloc(linebuf, linebufmax); + linebuf = dorealloc(linebuf, oldmax, linebufmax); } if (linebufpos == 0) { linebufplace = *p;