pike.git / src / rbtree.c

version» Context lines:

pike.git/src/rbtree.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: rbtree.c,v 1.14 2002/12/05 20:13:04 mast Exp $ + || $Id: rbtree.c,v 1.15 2002/12/07 13:34:28 grubba Exp $   */      /* An implementation of a threaded red/black balanced binary tree.    *    * Created 2001-04-27 by Martin Stjernholm <mast@lysator.liu.se>    */      #include "global.h"    - RCSID("$Id: rbtree.c,v 1.14 2002/12/05 20:13:04 mast Exp $"); + RCSID("$Id: rbtree.c,v 1.15 2002/12/07 13:34:28 grubba Exp $");      #include "interpret.h"   #include "pike_error.h"   #include "rbtree_low.h"      #include <assert.h>   #include <stdlib.h>      #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)   
pike.git/src/rbtree.c:208:    rbstack.slice->stack[rbstack.ssp - 1] =    (struct rb_node_hdr *) ((char *) node - (char *) oldbase + (char *) newbase);    RBSTACK_UP_IGNORE (rbstack);    }   }      /* Each of these step functions is O(log n), but when used to loop    * through a tree they still sum up to O(n) since every node is    * visited at most twice. */    - PMOD_EXPORT inline struct rb_node_hdr *rb_first (struct rb_node_hdr *root) + PMOD_EXPORT struct rb_node_hdr *rb_first (struct rb_node_hdr *root)   {    DO_IF_RB_STATS (rb_num_sidesteps++; rb_num_sidestep_ops++);    if (root)    while (root->prev) {    root = root->prev;    DO_IF_RB_STATS (rb_num_sidestep_ops++);    }    return root;   }    - PMOD_EXPORT inline struct rb_node_hdr *rb_last (struct rb_node_hdr *root) + PMOD_EXPORT struct rb_node_hdr *rb_last (struct rb_node_hdr *root)   {    DO_IF_RB_STATS (rb_num_sidesteps++; rb_num_sidestep_ops++);    if (root)    while (root->next) {    root = root->next;    DO_IF_RB_STATS (rb_num_sidestep_ops++);    }    return root;   }    - PMOD_EXPORT inline struct rb_node_hdr *rb_link_prev (struct rb_node_hdr *node) + PMOD_EXPORT struct rb_node_hdr *rb_link_prev (struct rb_node_hdr *node)   {    node = node->prev;    DO_IF_RB_STATS (rb_num_sidestep_ops++);    while (!(node->flags & RB_THREAD_NEXT)) {    node = node->next;    DO_IF_RB_STATS (rb_num_sidestep_ops++);    }    return node;   }    - PMOD_EXPORT inline struct rb_node_hdr *rb_link_next (struct rb_node_hdr *node) + PMOD_EXPORT struct rb_node_hdr *rb_link_next (struct rb_node_hdr *node)   {    node = node->next;    DO_IF_RB_STATS (rb_num_sidestep_ops++);    while (!(node->flags & RB_THREAD_PREV)) {    node = node->prev;    DO_IF_RB_STATS (rb_num_sidestep_ops++);    }    return node;   }