Skip to content

Commit

Permalink
d.graph: Remove an always true condition (#2296)
Browse files Browse the repository at this point in the history
The function returns if `num < coors_allocated` and since `to_alloc` is assigned with `coors_allocated`, the removed condition is always true and thus useless. So, we can directly assign `to_alloc` with `num + CHUNK`.
  • Loading branch information
lbartoletti committed Apr 8, 2022
1 parent 4def144 commit 3c7e0c5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions display/d.graph/do_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ int check_alloc(int num)
if (num < coors_allocated)
return 0;

to_alloc = coors_allocated;
if (num >= to_alloc)
to_alloc = num + CHUNK;
to_alloc = num + CHUNK;

xarray = G_realloc(xarray, to_alloc * sizeof(double));
yarray = G_realloc(yarray, to_alloc * sizeof(double));
Expand Down

0 comments on commit 3c7e0c5

Please sign in to comment.