#include <stdlib.h>
#include <string.h>
#include <cgraph/agxbuf.h>
-
-#define N_GNEW(n,t) calloc((n),sizeof(t))
+#include <cgraph/alloc.h>
/* agxbinit:
* Assume if init is non-null, hint = sizeof(init[])
if (hint == 0)
hint = BUFSIZ;
xb->dyna = 1;
- xb->buf = N_GNEW(hint, unsigned char);
+ xb->buf = gv_calloc(hint, sizeof(unsigned char));
}
xb->eptr = xb->buf + hint;
xb->ptr = xb->buf;
nsize = size + ssz;
cnt = (size_t) (xb->ptr - xb->buf);
if (xb->dyna) {
- nbuf = realloc(xb->buf, nsize);
+ nbuf = gv_recalloc(xb->buf, size, nsize, sizeof(unsigned char));
} else {
- nbuf = N_GNEW(nsize, unsigned char);
+ nbuf = gv_calloc(nsize, sizeof(unsigned char));
memcpy(nbuf, xb->buf, cnt);
xb->dyna = 1;
}