GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
Main Page
Related Pages
+
Data Structures
Data Structures
Class Hierarchy
+
Data Fields
+
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
x
y
+
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
y
z
+
Enumerations
a
c
d
e
h
l
m
n
o
p
r
s
t
v
y
+
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
+
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
▼
GRASS GIS 7 Programmer's Manual
Libraries
Core libraries
►
Further libraries
File structure of GRASS Location
►
Compiling and Installing GRASS Modules
Multiple-Architecture Conventions
►
Vector modules and their parameters/flags
►
GRASS Array Statistics Library
btree2 library
►
GRASS Cairo Display Driver
►
GRASS testing normality & exponentiality Library
►
GRASS Cluster analysis statistics Library
►
GRASS DataBase Management Interface
►
GRASS Display Library
►
CCMATH mathematics library source code
►
GRASS GIS General Library (aka GIS Library)
►
GRASS Numerical math interface
►
GRASS Partial differential equations Library (GPDE)
►
GRASS Imagery Library
►
GRASS Data Elements Manage Library
►
GRASS Nviz Library
►
GRASS GIS OGSF Library
GRASS GIS PNG Display Driver Library
►
GRASS and the PROJ projection library
GRASS Postscript Display Driver Library
►
GRASS Raster Library
►
GRASS 3D Raster Volume Library
GRASS Row Input/Output Library
GRASS Library for interpolation with regularized splines with tension
►
GRASS Segment Library
►
GRASS Directed Graph Library
►
GRASS Vector Library
Todo List
Deprecated List
Bug List
►
Data Structures
▼
Files
►
File List
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
segment/close.c
Go to the documentation of this file.
1
/**
2
* \file lib/segment/close.c
3
*
4
* \brief Segment closing routine.
5
*
6
* This program is free software under the GNU General Public License
7
* (>=v2). Read the file COPYING that comes with GRASS for details.
8
*
9
* \author GRASS GIS Development Team
10
*
11
* \date 2018
12
*/
13
14
#include <unistd.h>
15
#include <fcntl.h>
16
#include <
grass/gis.h
>
17
#include <
grass/glocale.h
>
18
#include "local_proto.h"
19
20
/**
21
* \fn int Segment_close (SEGMENT *SEG)
22
*
23
* \brief Free memory allocated to segment, delete temp file.
24
*
25
* Releases the allocated memory associated with the segment file
26
* <b>seg</b> and deletes the temporary file.
27
*
28
* \param[in,out] SEG segment
29
* \return 1 if successful
30
* \return -1 if SEGMENT is not available (not open)
31
*/
32
33
int
Segment_close
(
SEGMENT
*SEG)
34
{
35
if
(SEG->
open
!= 1)
36
return
-1;
37
38
if
(SEG->
cache
) {
39
G_free
(SEG->
cache
);
40
}
41
else
{
42
Segment_release
(SEG);
43
close(SEG->
fd
);
44
unlink(SEG->
fname
);
45
46
SEG->
fd
= -1;
47
SEG->
fname
=
NULL
;
48
}
49
50
SEG->
open
= 0;
51
52
return
1;
53
}
glocale.h
Segment_close
int Segment_close(SEGMENT *SEG)
Free memory allocated to segment, delete temp file.
Definition:
segment/close.c:33
SEGMENT::fd
int fd
Definition:
segment.h:44
Segment_release
int Segment_release(SEGMENT *)
Free memory allocated to segment.
Definition:
segment/release.c:36
SEGMENT::open
int open
Definition:
segment.h:21
G_free
void G_free(void *)
Free allocated memory.
Definition:
gis/alloc.c:149
NULL
#define NULL
Definition:
ccmath.h:32
gis.h
SEGMENT::fname
char * fname
Definition:
segment.h:43
SEGMENT::cache
char * cache
Definition:
segment.h:62
SEGMENT
Definition:
segment.h:19
lib
segment
close.c
Generated on Mon May 31 2021 05:21:28 for GRASS GIS 7 Programmer's Manual by
1.8.13