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.24 2004/09/18 20:50:55 nilsson Exp $ + || $Id: rbtree.c,v 1.25 2005/05/19 22:35:34 mast 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"      #include "interpret.h"
pike.git/src/rbtree.c:1704: Inside #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)
     #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)      void debug_dump_rb_tree (struct rb_node_hdr *root, dump_data_fn *dump_data,    void *extra)   {    if (root) {    struct rb_node_hdr *node = root;    struct rb_node_hdr *n, *n2;    struct rbstack_ptr p; -  size_t depth = 0; +  int depth = 0;    RBSTACK_INIT (rbstack);       LOW_RB_TRAVERSE (    1, rbstack, node,    { /* Push. */    depth++;    p = rbstack;    RBSTACK_UP (p, n);    while (n) {    if (n == node) {
pike.git/src/rbtree.c:1832: Inside #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)
   fputs ("Dumping tree:\n", stderr);    debug_dump_rb_tree (tree, dump_data, extra);    debug_fatal ("\r");   }      void debug_check_rb_tree (struct rb_node_hdr *root, dump_data_fn *dump_data, void *extra)   {    if (root) {    struct rb_node_hdr *node = root, *n, *n2;    struct rbstack_ptr p; -  size_t blacks = 1, max_blacks = 0, depth = 0; +  size_t blacks = 1, max_blacks = 0; +  int depth = 0;    RBSTACK_INIT (rbstack);       if (root->flags & RB_RED) custom_rb_fatal (root, dump_data, extra,    "Root node not black.\n");       LOW_RB_TRAVERSE (    1, rbstack, node,    { /* Push. */    depth++;    p = rbstack;
pike.git/src/rbtree.c:1855: Inside #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)
   if (n == node) custom_rb_fatal (root, dump_data, extra,    "Circular subtrees @ %p.\n", node);    RBSTACK_UP (p, n);    }       if (!(node->flags & RB_RED)) blacks++;    }, { /* prev is leaf. */    if (max_blacks) {    if (blacks != max_blacks)    custom_rb_fatal (root, dump_data, extra, -  "Unbalanced tree - leftmost branch is %d, " -  "prev @ %p is %d.\n", max_blacks, node, blacks); +  "Unbalanced tree - leftmost branch is %"PRINTSIZET"d, " +  "prev @ %p is %"PRINTSIZET"d.\n", +  max_blacks, node, blacks);    }    else max_blacks = blacks;       p = rbstack;    n2 = node;    RBSTACK_UP (p, n);    while (n && (n->flags & RB_THREAD_NEXT || n->next != n2)) {    n2 = n;    RBSTACK_UP (p, n);    }
pike.git/src/rbtree.c:1881: Inside #if defined (PIKE_DEBUG) || defined (TEST_MULTISET)
   }, { /* prev is subtree. */    if (!node->prev) custom_rb_fatal (root, dump_data, extra,    "Subtree prev is null @ %p.\n", node);    if (node->flags & RB_RED && node->prev->flags & RB_RED)    custom_rb_fatal (root, dump_data, extra,    "Red node got red subtree prev node @ %p.\n", node);    }, { /* Between nodes. */    }, { /* next is leaf. */    if (blacks != max_blacks)    custom_rb_fatal (root, dump_data, extra, -  "Unbalanced tree - leftmost branch is %d, " -  "next @ %p is %d.\n", max_blacks, node, blacks); +  "Unbalanced tree - leftmost branch is %"PRINTSIZET"d, " +  "next @ %p is %"PRINTSIZET"d.\n", +  max_blacks, node, blacks);       p = rbstack;    n2 = node;    RBSTACK_UP (p, n);    while (n && (n->flags & RB_THREAD_PREV || n->prev != n2)) {    n2 = n;    RBSTACK_UP (p, n);    }    if (node->next != n)    custom_rb_fatal (root, dump_data, extra,