PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void fallbackSplit ( GistEntryVector *  entryvec,
GIST_SPLITVEC *  v 
)
static

Definition at line 1223 of file gserialized_gist_2d.c.

References adjustBox(), and rtgdalraster::cur.

Referenced by gserialized_gist_picksplit_2d().

1224 {
1225  OffsetNumber i,
1226  maxoff;
1227  BOX2DF *unionL = NULL,
1228  *unionR = NULL;
1229  int nbytes;
1230 
1231  maxoff = entryvec->n - 1;
1232 
1233  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1234  v->spl_left = (OffsetNumber *) palloc(nbytes);
1235  v->spl_right = (OffsetNumber *) palloc(nbytes);
1236  v->spl_nleft = v->spl_nright = 0;
1237 
1238  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1239  {
1240  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1241 
1242  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1243  {
1244  v->spl_left[v->spl_nleft] = i;
1245  if (unionL == NULL)
1246  {
1247  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1248  *unionL = *cur;
1249  }
1250  else
1251  adjustBox(unionL, cur);
1252 
1253  v->spl_nleft++;
1254  }
1255  else
1256  {
1257  v->spl_right[v->spl_nright] = i;
1258  if (unionR == NULL)
1259  {
1260  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1261  *unionR = *cur;
1262  }
1263  else
1264  adjustBox(unionR, cur);
1265 
1266  v->spl_nright++;
1267  }
1268  }
1269 
1270  if (v->spl_ldatum_exists)
1271  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1272  v->spl_ldatum = BoxPGetDatum(unionL);
1273 
1274  if (v->spl_rdatum_exists)
1275  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1276  v->spl_rdatum = BoxPGetDatum(unionR);
1277 
1278  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1279 }
static void adjustBox(BOX2DF *b, BOX2DF *addon)

Here is the call graph for this function:

Here is the caller graph for this function: