GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vector/diglib/update.c
Go to the documentation of this file.
1 
17 #include <stdlib.h>
18 #include <grass/gis.h>
19 #include <grass/Vect.h>
20 
26 void dig_line_reset_updated(struct Plus_head *Plus)
27 {
28  Plus->n_uplines = 0;
29 }
30 
37 void dig_line_add_updated(struct Plus_head *Plus, int line)
38 {
39  int i;
40 
41  G_debug(3, "dig_line_add_updated(): line = %d", line);
42 
43  /* Check if already in list */
44  for (i = 0; i < Plus->n_uplines; i++)
45  if (Plus->uplines[i] == line)
46  return;
47 
48  /* Alloc space if needed */
49  if (Plus->n_uplines == Plus->alloc_uplines) {
50  Plus->alloc_uplines += 1000;
51  Plus->uplines =
52  (int *)G_realloc(Plus->uplines,
53  Plus->alloc_uplines * sizeof(int));
54  }
55 
56  Plus->uplines[Plus->n_uplines] = line;
57  Plus->n_uplines++;
58 }
59 
65 void dig_node_reset_updated(struct Plus_head *Plus)
66 {
67  Plus->n_upnodes = 0;
68 }
69 
76 void dig_node_add_updated(struct Plus_head *Plus, int node)
77 {
78  int i;
79 
80  G_debug(3, "dig_node_add_updated(): node = %d", node);
81 
82  /* Check if already in list */
83  for (i = 0; i < Plus->n_upnodes; i++)
84  if (Plus->upnodes[i] == node)
85  return;
86 
87  /* Alloc space if needed */
88  if (Plus->n_upnodes == Plus->alloc_upnodes) {
89  Plus->alloc_upnodes += 1000;
90  Plus->upnodes =
91  (int *)G_realloc(Plus->upnodes,
92  Plus->alloc_upnodes * sizeof(int));
93  }
94 
95  Plus->upnodes[Plus->n_upnodes] = node;
96  Plus->n_upnodes++;
97 }
void dig_node_reset_updated(struct Plus_head *Plus)
Reset number of updated nodes.
void dig_node_add_updated(struct Plus_head *Plus, int node)
Add node to updated.
void dig_line_reset_updated(struct Plus_head *Plus)
Reset number of updated lines.
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
void dig_line_add_updated(struct Plus_head *Plus, int line)
Add new line to updated.