45 newb->endp = newb->mem + size;
46 newb->cur = newb->mem;
79 if (bp->cur == bp->endp) {
90static int ijcmpf(
void *point1,
void *point2) {
119 newp->
p.
i = cellp->
p.
i;
120 newp->
p.
j = cellp->
p.
j;
145 offsetof(
cell, link),
158 memset(g, 0,
sizeof(*g));
212 fprintf(stderr,
"grid(%d,%d): %s\n", i, j,
agnameof(n));
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
CDT_API int dtwalk(Dt_t *, int(*)(void *, void *), void *)
CDT_API int dtclose(Dt_t *)
CDT_API Dtmethod_t * Dtoset
ordered set (self-adjusting tree)
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
static double len(glCompPoint p)
static void freeBlock(block_t *b)
static void * newCell(void *obj, Dtdisc_t *disc)
void adjustGrid(Grid *g, int nnodes)
int gLength(cell *p)
return the number of nodes in a cell
void delGrid(Grid *g)
close and free all grid resources
void walkGrid(Grid *g, int(*walkf)(void *, void *))
static int ijcmpf(void *point1, void *point2)
static cell * getCell(Grid *g)
create a new cell using memory blocks
static node_list * newNode(Grid *g, Agnode_t *n, node_list *nxt)
void addGrid(Grid *g, int i, int j, Agnode_t *n)
add node n to cell (i,j) in grid g
static block_t * newBlock(int size)
create new block of size cells
cell * findGrid(Grid *g, int i, int j)
Grid * mkGrid(int cellHint)
char * agnameof(void *)
returns a string descriptor for the object.
result of partitioning available space, part of maze