GRASS GIS 8 Programmer's Manual
8.4.1(2025)-45ca3179ab
Loading...
Searching...
No Matches
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 *buf)
Free allocated memory.
Definition
alloc.c:150
Segment_release
int Segment_release(SEGMENT *SEG)
Free memory allocated to segment.
Definition
segment/release.c:34
segment
release.c
Generated on Sat Jun 21 2025 21:07:27 for GRASS GIS 8 Programmer's Manual by
1.13.2