PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ array_range()

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

Definition at line 105 of file raster2pgsql.c.

105  {
106  int i = 0;
107  int j = 0;
108 
109  step = abs(step);
110  *len = (uint32_t) ((abs(max - min) + 1 + (step / 2)) / step);
111  *range = rtalloc(sizeof(int) * *len);
112 
113  if (min < max) {
114  for (i = min, j = 0; i <= max; i += step, j++)
115  (*range)[j] = i;
116  }
117  else if (max < min) {
118  if (step > 0) step *= -1;
119  for (i = min, j = 0; i >= max; i += step, j++)
120  (*range)[j] = i;
121  }
122  else if (min == max) {
123  (*range)[0] = min;
124  }
125  else {
126  *len = 0;
127  *range = NULL;
128  return 0;
129  }
130 
131  return 1;
132 }
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:191

References rtalloc().

Here is the call graph for this function: