GRASS 8 Programmer's Manual
8.5.0dev(2025)-52c8278fcf
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 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
int
Segment_release
(SEGMENT *SEG)
34
{
35
int
i;
36
37
if
(SEG->open != 1)
38
return
-1;
39
40
for
(i = 0; i < SEG->nseg; i++)
41
G_free
(SEG->scb[i].buf);
42
G_free
(SEG->scb);
43
44
G_free
(SEG->freeslot);
45
G_free
(SEG->agequeue);
46
G_free
(SEG->load_idx);
47
48
SEG->open = 0;
49
50
return
1;
51
}
G_free
void G_free(void *buf)
Free allocated memory.
Definition:
alloc.c:147
Segment_release
int Segment_release(SEGMENT *SEG)
Free memory allocated to segment.
Definition:
segment/release.c:33
segment
release.c
Generated on Fri Oct 3 2025 07:05:08 for GRASS 8 Programmer's Manual by
1.9.1