22 #include <grass/Vect.h>
23 #include <grass/gis.h>
38 p = (
struct ilist *)G_malloc(
sizeof(
struct ilist));
77 if (list->alloc_values) {
78 G_free((
void *)list->value);
104 for (i = 0; i < list->n_values; i++) {
105 if (val == list->value[i])
109 if (list->n_values == list->alloc_values) {
110 size = (list->n_values + 1000) *
sizeof(
int);
111 list->value = (
int *)G_realloc((
void *)list->value,
size);
112 list->alloc_values = list->n_values + 1000;
115 list->value[list->n_values] = val;
137 for (i = 0; i < blist->n_values; i++)
159 for (i = 0; i < list->n_values; i++) {
160 if (val == list->value[i]) {
161 for (j = i + 1; j < list->n_values; j++)
162 list->value[j - 1] = list->value[j];
188 for (i = 0; i < blist->n_values; i++)
210 for (i = 0; i < list->n_values; i++) {
211 if (val == list->value[i])
int Vect_destroy_list(struct ilist *list)
Frees all memory associated with a struct ilist, including the struct itself.
void G_free(void *buf)
Free allocated memory.
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_list_delete(struct ilist *list, int val)
Remove a given value (item) from list.
int Vect_reset_list(struct ilist *list)
Reset ilist structure.
int Vect_list_append_list(struct ilist *alist, struct ilist *blist)
Append new items to the end of list if not yet present.
int Vect_list_append(struct ilist *list, int val)
Append new item to the end of list if not yet present.
int Vect_list_delete_list(struct ilist *alist, struct ilist *blist)
Delete list from existing list.
int Vect_val_in_list(struct ilist *list, int val)
Find a given item in the list.