PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ fallbackSplit()

static void fallbackSplit ( GistEntryVector *  entryvec,
GIST_SPLITVEC *  v 
)
static

Definition at line 1502 of file gserialized_gist_2d.c.

References adjustBox(), and rtgdalraster::cur.

Referenced by gserialized_gist_picksplit_2d().

1503 {
1504  OffsetNumber i,
1505  maxoff;
1506  BOX2DF *unionL = NULL,
1507  *unionR = NULL;
1508  int nbytes;
1509 
1510  maxoff = entryvec->n - 1;
1511 
1512  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1513  v->spl_left = (OffsetNumber *) palloc(nbytes);
1514  v->spl_right = (OffsetNumber *) palloc(nbytes);
1515  v->spl_nleft = v->spl_nright = 0;
1516 
1517  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1518  {
1519  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1520 
1521  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1522  {
1523  v->spl_left[v->spl_nleft] = i;
1524  if (unionL == NULL)
1525  {
1526  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1527  *unionL = *cur;
1528  }
1529  else
1530  adjustBox(unionL, cur);
1531 
1532  v->spl_nleft++;
1533  }
1534  else
1535  {
1536  v->spl_right[v->spl_nright] = i;
1537  if (unionR == NULL)
1538  {
1539  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1540  *unionR = *cur;
1541  }
1542  else
1543  adjustBox(unionR, cur);
1544 
1545  v->spl_nright++;
1546  }
1547  }
1548 
1549  if (v->spl_ldatum_exists)
1550  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1551  v->spl_ldatum = BoxPGetDatum(unionL);
1552 
1553  if (v->spl_rdatum_exists)
1554  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1555  v->spl_rdatum = BoxPGetDatum(unionR);
1556 
1557  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1558 }
static void adjustBox(BOX2DF *b, BOX2DF *addon)
Here is the call graph for this function:
Here is the caller graph for this function: