We are about to change the N_GNEW wrapper to exit on failure, so this preserves
the semantics of allowing these few locations to handle allocation failure
locally.
#include "render.h"
#include "pathplan.h"
#include <setjmp.h>
+#include <stdlib.h>
#ifdef UNUSED
static box *bs = NULL;
routesplinesinit()
{
if (++routeinit > 1) return 0;
- if (!(ps = N_GNEW(PINC, pointf))) {
+ if (!(ps = calloc(PINC, sizeof(pointf)))) {
agerr(AGERR, "routesplinesinit: cannot allocate ps\n");
return 1;
}
}
bp->prev = sp->curblk;
bp->next = NULL;
- bp->data = N_GNEW(BIGBUF, Agnode_t *);
+ bp->data = calloc(BIGBUF, sizeof(Agnode_t *));
if (bp->data == 0) {
agerr(AGERR, "gc: Out of memory\n");
longjmp(jbuf, 1);
#include <time.h>
#include <string.h>
#include <math.h>
+#include <stdlib.h>
#include "types.h"
#include "memory.h"
Lwdd = SparseMatrix_copy(Lwd);
m = Lw->m;
- x0 = N_GNEW(dim*m,real);
+ x0 = calloc(dim*m, sizeof(real));
if (!x0) goto RETURN;
memcpy(x0, x, sizeof(real)*dim*m);
- y = N_GNEW(dim*m,real);
+ y = calloc(dim*m, sizeof(real));
if (!y) goto RETURN;
id = Lwd->ia; jd = Lwd->ja;