GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-38f5cf43d1
segment/release.c
Go to the documentation of this file.
1
/**
2
* \file lib/segment/release.c
3
*
4
* \brief Segment release routines.
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 2005-2009
12
*/
13
14
#include <stdlib.h>
15
#include <
grass/gis.h
>
16
#include "local_proto.h"
17
18
/**
19
* \fn int Segment_release (SEGMENT *SEG)
20
*
21
* \brief Free memory allocated to segment.
22
*
23
* Releases the allocated memory associated with the segment file
24
* <b>seg</b>.
25
*
26
* <b>Note:</b> Does not close the file. Does not flush the data which
27
* may be pending from previous <i>Segment_put()</i> calls.
28
*
29
* \param[in,out] SEG segment
30
* \return 1 if successful
31
* \return -1 if SEGMENT is not available (not open)
32
*/
33
34
int
Segment_release
(
SEGMENT
*SEG)
35
{
36
int
i;
37
38
if
(SEG->
open
!= 1)
39
return
-1;
40
41
for
(i = 0; i < SEG->
nseg
; i++)
42
G_free
(SEG->
scb
[i].
buf
);
43
G_free
(SEG->
scb
);
44
45
G_free
(SEG->
freeslot
);
46
G_free
(SEG->
agequeue
);
47
G_free
(SEG->
load_idx
);
48
49
SEG->
open
= 0;
50
51
return
1;
52
}
G_free
void G_free(void *)
Free allocated memory.
Definition:
gis/alloc.c:150
gis.h
Segment_release
int Segment_release(SEGMENT *SEG)
Free memory allocated to segment.
Definition:
segment/release.c:34
SEGMENT::scb::buf
char * buf
Definition:
segment.h:46
SEGMENT
Definition:
segment.h:19
SEGMENT::freeslot
int * freeslot
Definition:
segment.h:53
SEGMENT::agequeue
struct aq * agequeue
Definition:
segment.h:54
SEGMENT::load_idx
int * load_idx
Definition:
segment.h:51
SEGMENT::scb
struct SEGMENT::scb * scb
SEGMENT::nseg
int nseg
Definition:
segment.h:57
SEGMENT::open
int open
Definition:
segment.h:20
lib
segment
release.c
Generated on Mon Nov 25 2024 07:38:45 for GRASS GIS 8 Programmer's Manual by
1.9.1