The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h
wrappers except (1) they are header-only and (2) they live in a directory
(cgraph) that is at the root of the dependency tree. The long term plan is to
replace all use of lib/common/memory.h with lib/cgraph/alloc.h.
static ex_vtx_data *cpExGraph(ex_vtx_data * graph, int n, int nedges)
{
- ex_vtx_data *cpGraph;
- int *edges;
int i, j;
if (graph == NULL || n == 0) {
return NULL;
}
- cpGraph = N_NEW(n, ex_vtx_data);
- edges = N_NEW(2 * nedges + n, int);
+ ex_vtx_data *cpGraph = gv_calloc(n, sizeof(ex_vtx_data));
+ int *edges = gv_calloc(2 * nedges + n, sizeof(int));
for (i = 0; i < n; i++) {
cpGraph[i] = graph[i];