so many updates

This commit is contained in:
2020-02-12 17:37:28 -08:00
parent e55fef3a65
commit 23bda3f683
6 changed files with 464 additions and 432 deletions

27
abuf.c
View File

@@ -1,27 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include "defs.h"
void
ab_append(struct abuf *buf, const char *s, int len)
{
char *nc = realloc(buf->b, buf->len + len);
if (nc == NULL) {
abort();
}
memcpy(&nc[buf->len], s, len);
buf->b = nc;
buf->len += len; /* DANGER: overflow */
}
void
ab_free(struct abuf *buf)
{
free(buf->b);
buf->b = NULL;
}