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

Definition at line 1249 of file gserialized_gist_2d.c.

References adjustBox(), and rtgdalraster::cur.

Referenced by gserialized_gist_picksplit_2d().

1250 {
1251  OffsetNumber i,
1252  maxoff;
1253  BOX2DF *unionL = NULL,
1254  *unionR = NULL;
1255  int nbytes;
1256 
1257  maxoff = entryvec->n - 1;
1258 
1259  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1260  v->spl_left = (OffsetNumber *) palloc(nbytes);
1261  v->spl_right = (OffsetNumber *) palloc(nbytes);
1262  v->spl_nleft = v->spl_nright = 0;
1263 
1264  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1265  {
1266  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1267 
1268  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1269  {
1270  v->spl_left[v->spl_nleft] = i;
1271  if (unionL == NULL)
1272  {
1273  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1274  *unionL = *cur;
1275  }
1276  else
1277  adjustBox(unionL, cur);
1278 
1279  v->spl_nleft++;
1280  }
1281  else
1282  {
1283  v->spl_right[v->spl_nright] = i;
1284  if (unionR == NULL)
1285  {
1286  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1287  *unionR = *cur;
1288  }
1289  else
1290  adjustBox(unionR, cur);
1291 
1292  v->spl_nright++;
1293  }
1294  }
1295 
1296  if (v->spl_ldatum_exists)
1297  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1298  v->spl_ldatum = BoxPGetDatum(unionL);
1299 
1300  if (v->spl_rdatum_exists)
1301  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1302  v->spl_rdatum = BoxPGetDatum(unionR);
1303 
1304  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1305 }
static void adjustBox(BOX2DF *b, BOX2DF *addon)

Here is the call graph for this function:

Here is the caller graph for this function: