[GRASS-SVN] r71785 - grass/trunk/lib/vector/diglib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 19 12:47:14 PST 2017
Author: mmetz
Date: 2017-11-19 12:47:14 -0800 (Sun, 19 Nov 2017)
New Revision: 71785
Modified:
grass/trunk/lib/vector/diglib/struct_alloc.c
Log:
diglib: reduce calls to G_realloc()
Modified: grass/trunk/lib/vector/diglib/struct_alloc.c
===================================================================
--- grass/trunk/lib/vector/diglib/struct_alloc.c 2017-11-19 20:46:40 UTC (rev 71784)
+++ grass/trunk/lib/vector/diglib/struct_alloc.c 2017-11-19 20:47:14 UTC (rev 71785)
@@ -73,8 +73,11 @@
G_debug(5, "dig_node_alloc_line(): add = %d", add);
- num = node->n_lines + add;
+ if (node->n_lines + add <= node->alloc_lines)
+ return 0;
+ num = node->alloc_lines + add;
+
p = G_realloc(node->lines, num * sizeof(plus_t));
if (p == NULL)
return -1;
More information about the grass-commit
mailing list