Exemple #1
0
void *ptree_FindSuccessor(pwr_tStatus *sts, ptree_sTable *tp, void *key)
{
  ptree_sNode *np;
  pool_tRef nr;

  nr = findNearNode(tp, key);
  if ( tp->last == tp->g->null)
    pwr_Return(NULL, sts, TREE__NOTFOUND);
  
  if ( nr != tp->g->null)
    nr = successorNode(tp, nr);
  else if ( tp->lastComp < 0)
    nr = tp->last;
  else
    nr = successorNode(tp, tp->last);

  if ( nr == tp->g->null)
    pwr_Return(NULL, sts, TREE__NOTFOUND);

  np = pool_Address(sts, tp->php, nr);
  pwr_Return((void *)np, sts, TREE__FOUND);
}
Exemple #2
0
void *
tree_FindSuccessor(pwr_tStatus *sts, tree_sTable *tp, void *key)
{
    tree_sNode *np;

    np = findNearNode(tp, key);
    if (tp->last == tp->null)
        pwr_Return(NULL, sts, TREE__NOTFOUND);
  
    if (np != tp->null) {
        np = successorNode(tp, np);
    } else if (tp->lastComp < 0) {
        np = tp->last;
    } else {
        np = successorNode(tp, tp->last);
    }

    if (np == tp->null) {
        pwr_Return(NULL, sts, TREE__NOTFOUND);
    } else {
        pwr_Return((void *)np, sts, TREE__FOUND);
    }

}