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.
int i, j;
int nedges = 0;
- float *weights;
- int *vtx_vec = N_GNEW(n, int);
+ int *vtx_vec = gv_calloc(n, sizeof(int));
int deg_i, deg_j, neighbor;
for (i = 0; i < n; i++) {
nedges += graph[i].nedges;
}
- weights = N_GNEW(nedges, float);
+ float *weights = gv_calloc(nedges, sizeof(float));
for (i = 0; i < n; i++) {
vtx_vec[i] = 0;