PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ raster_destroy()

static void raster_destroy ( rt_raster  raster)
static

Definition at line 76 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().

76  {
77  uint16_t i;
78  uint16_t nbands = rt_raster_get_num_bands(raster);
79  for (i = 0; i < nbands; i++) {
80  rt_band band = rt_raster_get_band(raster, i);
81  if (band == NULL) continue;
82 
83  if (!rt_band_is_offline(band) && !rt_band_get_ownsdata_flag(band)) {
84  void* mem = rt_band_get_data(band);
85  if (mem) rtdealloc(mem);
86  }
87  rt_band_destroy(band);
88  }
89  rt_raster_destroy(raster);
90 }
int rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
band
Definition: ovdump.py:57
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
Definition: rt_band.c:228
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_band.c:242
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_band.c:526
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:381
void * rt_band_get_data(rt_band band)
Get pointer to raster band data.
Definition: rt_band.c:302
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
void rtdealloc(void *mem)
Definition: rt_context.c:186
Here is the call graph for this function:
Here is the caller graph for this function: