From 41b24947a9fecae8c251104523acb8abed5745a9 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 12 Jan 2022 20:06:36 -0800 Subject: [PATCH] lib/mingle/edge_bundling.c: explicitly cast the results of 'realloc' This has no effect in C, but this is pre-emptively squashing some warnings that appear when moving this file to C++. Gitlab: #2154 --- lib/mingle/edge_bundling.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/mingle/edge_bundling.c b/lib/mingle/edge_bundling.c index c3877e113..7f6016b43 100644 --- a/lib/mingle/edge_bundling.c +++ b/lib/mingle/edge_bundling.c @@ -409,8 +409,8 @@ static void pedge_print(char *comments, pedge e){ pedge pedge_realloc(pedge e, int n){ if (n <= e->npoints) return e; - e->x = REALLOC(e->x, e->dim*n*sizeof(double)); - if (e->wgts) e->wgts = REALLOC(e->wgts, (n-1)*sizeof(double)); + e->x = (double*)REALLOC(e->x, e->dim*n*sizeof(double)); + if (e->wgts) e->wgts = (double*)REALLOC(e->wgts, (n-1)*sizeof(double)); e->len = n; return e; } @@ -418,12 +418,12 @@ pedge pedge_wgts_realloc(pedge e, int n){ /* diff from pedge_alloc: allocate wgts if do not exist and initialize to wgt */ int i; if (n <= e->npoints) return e; - e->x = REALLOC(e->x, e->dim*n*sizeof(double)); + e->x = (double*)REALLOC(e->x, e->dim*n*sizeof(double)); if (!(e->wgts)){ - e->wgts = REALLOC(e->wgts, (n-1)*sizeof(double)); + e->wgts = (double*)REALLOC(e->wgts, (n-1)*sizeof(double)); for (i = 0; i < e->npoints; i++) e->wgts[i] = e->wgt; } else { - e->wgts = REALLOC(e->wgts, (n-1)*sizeof(double)); + e->wgts = (double*)REALLOC(e->wgts, (n-1)*sizeof(double)); } e->len = n; return e; @@ -439,7 +439,7 @@ pedge pedge_double(pedge e){ assert(npoints >= 2); if (npoints*2-1 > len){ len = 3*npoints; - e->x = REALLOC(e->x, dim*len*sizeof(double)); + e->x = (double*)REALLOC(e->x, dim*len*sizeof(double)); } x = e->x; -- 2.40.0