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 SparseMatrix SparseMatrix_init(int m, int n, int type, size_t sz, int format){
- SparseMatrix A;
-
-
- A = MALLOC(sizeof(struct SparseMatrix_struct));
+ SparseMatrix A = gv_alloc(sizeof(struct SparseMatrix_struct));
A->m = m;
A->n = n;
A->nz = 0;
case FORMAT_CSC:
case FORMAT_CSR:
default:
- A->ia = MALLOC(sizeof(int)*((size_t)(m+1)));
+ A->ia = gv_calloc((size_t)(m + 1), sizeof(int));
}
A->ja = NULL;
A->a = NULL;