20 #include <grass/Vect.h>
44 Node = (P_NODE *) G_malloc(
sizeof(P_NODE));
49 Node->alloc_lines = 0;
68 G_debug(3,
"dig_node_alloc_line(): add = %d", add);
70 num = node->n_lines + add;
72 p = G_realloc(node->lines, num *
sizeof(plus_t));
75 node->lines = (plus_t *) p;
77 p = G_realloc(node->angles, num *
sizeof(
float));
80 node->angles = (
float *)p;
82 node->alloc_lines =
num;
98 size = Plus->alloc_nodes + 1 + add;
99 p = G_realloc(Plus->Node, size *
sizeof(P_NODE *));
103 Plus->Node = (P_NODE **) p;
104 Plus->alloc_nodes = size - 1;
114 Line = (P_LINE *) G_malloc(
sizeof(P_LINE));
132 size = Plus->alloc_lines + 1 + add;
133 p = G_realloc(Plus->Line, size *
sizeof(P_LINE *));
137 Plus->Line = (P_LINE **) p;
138 Plus->alloc_lines = size - 1;
154 size = Plus->alloc_areas + 1 + add;
155 p = G_realloc(Plus->Area, size *
sizeof(P_AREA *));
159 Plus->Area = (P_AREA **) p;
160 Plus->alloc_areas = size - 1;
176 G_debug(3,
"dig_alloc_isle():");
177 size = Plus->alloc_isles + 1 + add;
178 p = G_realloc(Plus->Isle, size *
sizeof(P_ISLE *));
182 Plus->Isle = (P_ISLE **) p;
183 Plus->alloc_isles = size - 1;
193 Area = (P_AREA *) G_malloc(
sizeof(P_AREA));
198 Area->alloc_lines = 0;
201 Area->alloc_isles = 0;
215 Isle = (P_ISLE *) G_malloc(
sizeof(P_ISLE));
220 Isle->alloc_lines = 0;
237 alloced = points->alloc_points;
244 points->x = (
double *)p;
246 alloced = points->alloc_points;
253 points->y = (
double *)p;
255 alloced = points->alloc_points;
262 points->z = (
double *)p;
264 points->alloc_points = alloced;
278 alloced = cats->alloc_cats;
284 cats->field = (
int *)p;
286 alloced = cats->alloc_cats;
292 cats->cat = (
int *)p;
294 cats->alloc_cats = alloced;
308 num = area->alloc_lines + add;
310 p = G_realloc(area->lines, num *
sizeof(plus_t));
313 area->lines = (plus_t *) p;
315 area->alloc_lines =
num;
330 G_debug(5,
"dig_area_alloc_isle(): add = %d", add);
331 num = area->alloc_isles + add;
333 p = G_realloc(area->isles, num *
sizeof(plus_t));
336 area->isles = (plus_t *) p;
338 area->alloc_isles =
num;
353 G_debug(3,
"dig_isle_alloc_line():");
354 num = isle->alloc_lines + add;
356 p = G_realloc(isle->lines, num *
sizeof(plus_t));
359 isle->lines = (plus_t *) p;
361 isle->alloc_lines =
num;
371 fprintf(stderr,
"OUT OF MEMORY!\n");
int dig_alloc_nodes(struct Plus_head *Plus, int add)
int dig_area_alloc_isle(P_AREA *area, int add)
P_NODE * dig_alloc_node()
int dig_alloc_areas(struct Plus_head *Plus, int add)
int dig_node_alloc_line(P_NODE *node, int add)
int dig_alloc_cats(struct line_cats *cats, int num)
P_ISLE * dig_alloc_isle()
int dig_area_alloc_line(P_AREA *area, int add)
int dig_alloc_isles(struct Plus_head *Plus, int add)
int dig_alloc_points(struct line_pnts *points, int num)
int dig_isle_alloc_line(P_ISLE *isle, int add)
P_LINE * dig_alloc_line()
P_AREA * dig_alloc_area()
int G_debug(int level, const char *msg,...)
Print debugging message.
int dig_alloc_lines(struct Plus_head *Plus, int add)
void * dig__alloc_space(int n_wanted, int *n_elements, int chunk_size, void *ptr, int element_size)