24 #include <sys/types.h>
27 #include <grass/Vect.h>
28 #include <grass/glocale.h>
30 static int clo_dummy()
38 G_fatal_error(_(
"Requested format is not compiled in this version"));
43 static int (*Close_array[][2]) () = {
66 struct Coor_info CInfo;
69 "Vect_close(): name = %s, mapset = %s, format = %d, level = %d",
70 Map->name, Map->mapset, Map->format, Map->level);
73 if (strcmp(Map->mapset,
G_mapset()) == 0 && Map->support_updated &&
74 Map->plus.built == GV_BUILD_ALL) {
76 char file_path[GPATH_MAX];
80 sprintf(buf,
"%s/%s", GRASS_VECT_DIRECTORY, Map->name);
83 if (stat(file_path, &info) == 0)
87 if (stat(file_path, &info) == 0)
91 if (stat(file_path, &info) == 0)
95 Map->plus.coor_size = CInfo.size;
96 Map->plus.coor_mtime = CInfo.mtime;
106 if (Map->format == GV_FORMAT_OGR)
111 if (Map->level == 2 && Map->plus.release_support) {
115 if (!Map->head_only) {
116 G_debug(1,
"free spatial index");
120 G_debug(1,
"free category index");
125 if (Map->format == GV_FORMAT_NATIVE) {
126 G_debug(1,
"close history file");
127 if (Map->hist_fp !=
NULL)
128 fclose(Map->hist_fp);
132 if (!Map->head_only) {
133 if (((*Close_array[Map->format][1]) (Map)) != 0) {
134 G_warning(_(
"Unable to close vector <%s>"),
140 G_free((
void *)Map->name);
142 G_free((
void *)Map->mapset);
145 Map->open = VECT_CLOSED_CODE;