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

Definition at line 910 of file gserialized_gist_nd.c.

References rtgdalraster::cur, gidx_copy(), and gidx_merge().

Referenced by gserialized_gist_picksplit().

911 {
912  OffsetNumber i, maxoff;
913  GIDX *unionL = NULL;
914  GIDX *unionR = NULL;
915  int nbytes;
916 
917  POSTGIS_DEBUG(4, "[GIST] in fallback picksplit function");
918 
919  maxoff = entryvec->n - 1;
920 
921  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
922  v->spl_left = (OffsetNumber*) palloc(nbytes);
923  v->spl_right = (OffsetNumber*) palloc(nbytes);
924  v->spl_nleft = v->spl_nright = 0;
925 
926  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
927  {
928  GIDX *cur = (GIDX*)DatumGetPointer(entryvec->vector[i].key);
929 
930  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
931  {
932  v->spl_left[v->spl_nleft] = i;
933  if (unionL == NULL)
934  {
935  unionL = gidx_copy(cur);
936  }
937  else
938  {
939  gidx_merge(&unionL, cur);
940  }
941  v->spl_nleft++;
942  }
943  else
944  {
945  v->spl_right[v->spl_nright] = i;
946  if (unionR == NULL)
947  {
948  unionR = gidx_copy(cur);
949  }
950  else
951  {
952  gidx_merge(&unionR, cur);
953  }
954  v->spl_nright++;
955  }
956  }
957 
958  if (v->spl_ldatum_exists)
959  gidx_merge(&unionL, (GIDX*)DatumGetPointer(v->spl_ldatum));
960 
961  v->spl_ldatum = PointerGetDatum(unionL);
962 
963  if (v->spl_rdatum_exists)
964  gidx_merge(&unionR, (GIDX*)DatumGetPointer(v->spl_rdatum));
965 
966  v->spl_rdatum = PointerGetDatum(unionR);
967  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
968 }
static void gidx_merge(GIDX **b_union, GIDX *b_new)
static GIDX * gidx_copy(GIDX *b)

Here is the call graph for this function:

Here is the caller graph for this function: