PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void raster_destroy ( rt_raster  raster)

Definition at line 77 of file raster2pgsql.c.

References ovdump::band, rt_band_destroy(), rt_band_get_data(), rt_band_get_ownsdata_flag(), rt_band_is_offline(), rt_raster_destroy(), rt_raster_get_band(), rt_raster_get_num_bands(), and rtdealloc().

Referenced by build_overview(), and convert_raster().

77  {
78  uint16_t i;
79  uint16_t nbands = rt_raster_get_num_bands(raster);
80  for (i = 0; i < nbands; i++) {
81  rt_band band = rt_raster_get_band(raster, i);
82  if (band == NULL) continue;
84  if (!rt_band_is_offline(band) && !rt_band_get_ownsdata_flag(band)) {
85  void* mem = rt_band_get_data(band);
86  if (mem) rtdealloc(mem);
87  }
88  rt_band_destroy(band);
89  }
90  rt_raster_destroy(raster);
91 }
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
Definition: rt_api.c:1636
int rt_raster_get_num_bands(rt_raster raster)
Definition: rt_api.c:5677
void rtdealloc(void *mem)
Definition: rt_api.c:882
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
void * rt_band_get_data(rt_band band)
Get pointer to raster band data.
Definition: rt_api.c:1710
tuple band
int rt_band_get_ownsdata_flag(rt_band band)
Return 0 (FALSE) or non-zero (TRUE) indicating if rt_band is responsible for managing the memory for ...
Definition: rt_api.c:1928
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_api.c:1650
rt_band rt_raster_get_band(rt_raster raster, int n)
Return Nth band, or NULL if unavailable.
Definition: rt_api.c:5686

Here is the call graph for this function:

Here is the caller graph for this function: