Checkpoint file split.
This commit is contained in:
22
abuf.c
22
abuf.c
@@ -3,10 +3,11 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "abuf.h"
|
||||
#include "core.h"
|
||||
|
||||
|
||||
void
|
||||
abuf_init(abuf *buf)
|
||||
ab_init(abuf *buf)
|
||||
{
|
||||
assert(buf != NULL);
|
||||
|
||||
@@ -15,6 +16,25 @@ abuf_init(abuf *buf)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ab_init_cap(abuf *buf, const size_t cap)
|
||||
{
|
||||
buf->b = calloc(cap, 1);
|
||||
buf->size = 0;
|
||||
buf->cap = cap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ab_resize(abuf *buf, size_t cap)
|
||||
{
|
||||
cap = cap_growth(buf->cap, cap);
|
||||
buf->b = realloc(buf->b, cap);
|
||||
assert(buf->b != NULL);
|
||||
buf->cap = cap;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ab_appendch(abuf *buf, char c)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user