PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ fallbackSplit()

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

Definition at line 1354 of file gserialized_gist_2d.c.

References adjustBox(), and rtgdalraster::cur.

Referenced by gserialized_gist_picksplit_2d().

1355 {
1356  OffsetNumber i,
1357  maxoff;
1358  BOX2DF *unionL = NULL,
1359  *unionR = NULL;
1360  int nbytes;
1361 
1362  maxoff = entryvec->n - 1;
1363 
1364  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1365  v->spl_left = (OffsetNumber *) palloc(nbytes);
1366  v->spl_right = (OffsetNumber *) palloc(nbytes);
1367  v->spl_nleft = v->spl_nright = 0;
1368 
1369  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1370  {
1371  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1372 
1373  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1374  {
1375  v->spl_left[v->spl_nleft] = i;
1376  if (unionL == NULL)
1377  {
1378  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1379  *unionL = *cur;
1380  }
1381  else
1382  adjustBox(unionL, cur);
1383 
1384  v->spl_nleft++;
1385  }
1386  else
1387  {
1388  v->spl_right[v->spl_nright] = i;
1389  if (unionR == NULL)
1390  {
1391  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1392  *unionR = *cur;
1393  }
1394  else
1395  adjustBox(unionR, cur);
1396 
1397  v->spl_nright++;
1398  }
1399  }
1400 
1401  if (v->spl_ldatum_exists)
1402  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1403  v->spl_ldatum = BoxPGetDatum(unionL);
1404 
1405  if (v->spl_rdatum_exists)
1406  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1407  v->spl_rdatum = BoxPGetDatum(unionR);
1408 
1409  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1410 }
static void adjustBox(BOX2DF *b, BOX2DF *addon)
Here is the call graph for this function:
Here is the caller graph for this function: