PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ array_range()

static int array_range ( int  min,
int  max,
int  step,
int **  range,
uint32_t len 
)
static

Definition at line 93 of file raster2pgsql.c.

93  {
94  int i = 0;
95  int j = 0;
96 
97  step = abs(step);
98  *len = (uint32_t) ((abs(max - min) + 1 + (step / 2)) / step);
99  *range = rtalloc(sizeof(int) * *len);
100 
101  if (min < max) {
102  for (i = min, j = 0; i <= max; i += step, j++)
103  (*range)[j] = i;
104  }
105  else if (max < min) {
106  if (step > 0) step *= -1;
107  for (i = min, j = 0; i >= max; i += step, j++)
108  (*range)[j] = i;
109  }
110  else if (min == max) {
111  (*range)[0] = min;
112  }
113  else {
114  *len = 0;
115  *range = NULL;
116  return 0;
117  }
118 
119  return 1;
120 }
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:171
unsigned int uint32_t
Definition: uthash.h:78

References rtalloc().

Here is the call graph for this function: