PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int array_range ( int  min,
int  max,
int  step,
int **  range,
int *  len 
)
static

Definition at line 94 of file raster2pgsql.c.

References rtalloc().

Referenced by main().

94  {
95  int i = 0;
96  int j = 0;
97 
98  step = abs(step);
99  *len = (abs(max - min) + 1 + (step / 2)) / step;
100  *range = rtalloc(sizeof(int) * *len);
101 
102  if (min < max) {
103  for (i = min, j = 0; i <= max; i += step, j++)
104  (*range)[j] = i;
105  }
106  else if (max < min) {
107  if (step > 0) step *= -1;
108  for (i = min, j = 0; i >= max; i += step, j++)
109  (*range)[j] = i;
110  }
111  else if (min == max) {
112  (*range)[0] = min;
113  }
114  else {
115  *len = 0;
116  *range = NULL;
117  return 0;
118  }
119 
120  return 1;
121 }
void * rtalloc(size_t size)
Raster core memory management functions.
Definition: rt_api.c:867

Here is the call graph for this function:

Here is the caller graph for this function: