Browse Source

d.graph: Remove an always true condition (#2296)

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`.
Loïc Bartoletti 2 years ago
parent
commit
3c7e0c5e8d
1 changed files with 1 additions and 3 deletions
  1. 1 3
      display/d.graph/do_graph.c

+ 1 - 3
display/d.graph/do_graph.c

@@ -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));