pike.git / src / post_modules / CritBit / tree_high.c

version» Context lines:

pike.git/src/post_modules/CritBit/tree_high.c:1:   static inline void cb_print_key(struct string_builder *, const cb_key);   static inline size_t _low_cb_check_node(cb_node_t node, const char *, int);      #ifdef DEBUG_CHECKS   # define cb_check_node(node) do { _low_cb_check_node(node, \    __FILE__, __LINE__); } while (0) + # define DEBUGCHECKUSED(X) X   #else   # define cb_check_node(node) do {} while(0) -  + # define DEBUGCHECKUSED(X) UNUSED(X)   #endif      #define CB_FATAL(x) Pike_error x      #include "tree_low.c"      #ifndef CB_FIRST_CHAR   #define CB_FIRST_CHAR(key) (0)   #endif      static inline void cb_debug_print_key(struct string_builder * buf, cb_key key) {    cb_size i;       for (i.chars = CB_FIRST_CHAR(key); i.chars < key.len.chars; i.chars++) {   #ifdef CB_PRINT_CHAR    CB_PRINT_CHAR(buf, key.str, i.chars);   #else -  string_builder_sprintf(buf, "(%d, %d) b: ", i.chars, CB_WIDTH(s)); +  string_builder_sprintf(buf, "(%d, %d) b: ", i.chars, CB_WIDTH(key.str));    -  for (i.bits = 0; i.bits < CB_WIDTH(s); i.bits++) { +  for (i.bits = 0; i.bits < CB_WIDTH(key.str); i.bits++) {    string_builder_sprintf(buf, "%d", CB_GET_BIT(key.str, i));    }    string_builder_putchar(buf, ' ');   #endif    }       /* string_builder_putchars(buf, ' ', 11-key.len.chars); */       if (key.len.bits) {    i.chars = key.len.chars;
pike.git/src/post_modules/CritBit/tree_high.c:44:    string_builder_sprintf(buf, "%d", CB_GET_BIT(key.str, i));    }    string_builder_sprintf(buf, " %d", CB_GET_BIT(key.str, key.len));    }   }      static inline void cb_print_key(struct string_builder * buf, const cb_key key) {    cb_size i;       for (i.chars = 0; i.chars < key.len.chars; i.chars++) { -  for (i.bits = 0; i.bits < CB_WIDTH(s); i.bits++) { +  for (i.bits = 0; i.bits < CB_WIDTH(key.str); i.bits++) {    string_builder_putchar(buf, CB_GET_BIT(key.str, i) ? '1' : '0');    }    }       /* string_builder_putchars(buf, ' ', 11-key.len.chars); */       if (key.len.bits) {    i.chars = key.len.chars;    i.bits = 0;       for (; CB_LT(i, key.len); CB_INC(i, 0, 1)) {    string_builder_putchar(buf, CB_GET_BIT(key.str, i) ? '1' : '0');    }    }   }      static inline void cb_print_node(struct string_builder * buf,    cb_node_t node, int depth) {    string_builder_putchars(buf, ' ', depth);    string_builder_sprintf(buf, "%x #%lu (%d) --> ", node, -  node->size, node->value.type); +  node->size, TYPEOF(node->value));    string_builder_putchars(buf, ' ', MAXIMUM(0, 15-depth));    cb_debug_print_key(buf, node->key);    if (CB_HAS_VALUE(node)) CB_PRINT_KEY(buf, node->key);    string_builder_putchar(buf, '\n');   }      static inline void cb_print_tree(struct string_builder *buf,    cb_node_t tree, int depth) {    cb_print_node(buf, tree, depth);   #if 0
pike.git/src/post_modules/CritBit/tree_high.c:135:    if (CB_S_EQ(size, node->key.len)) {    size_t bit = CB_GET_BIT(key.str, size);    if (CB_HAS_CHILD(node, bit))    return cb_print_path(buf, CB_CHILD(node, bit), key, size, depth+1,    end);    }       return 0;   }    - static inline void cb_check(cb_node_t node, cb_node_t last, char *issue) { + static inline void cb_check(cb_node_t node, +  cb_node_t DEBUGCHECKUSED(last), +  char *issue) {   #ifdef DEBUG_CHECKS    if (CB_LT(node->key.len, last->key.len)) {    struct string_builder buf;    init_string_builder(&buf, 0);    push_text("ERROR AT %s: %s\n[%d, %d] is shorter than [%d, %d]\n");    push_text(issue);    cb_print_tree(&buf, last, 0);    push_string(finish_string_builder(&buf));    push_int(node->key.len.chars);    push_int(node->key.len.bits);
pike.git/src/post_modules/CritBit/tree_high.c:179:    printf("Damaged 1.\n");    return 1;    }    if (cb_rec_check_parents(CB_CHILD(node, 1))) return 1;    }    return 0;   }      static inline void cb_aggregate_values(cb_node_t node,    struct array * a, size_t start, -  size_t len) { +  size_t UNUSED(len)) {    if (CB_HAS_VALUE(node))    CB_GET_VALUE(node, ITEM(a)+start++);    WALK_FORWARD(node, {    if (CB_HAS_VALUE(_)) CB_GET_VALUE(_, ITEM(a)+start++);    });   }      static inline size_t _low_cb_check_node(cb_node_t node,    const char *file, int line) {    size_t len = 0;
pike.git/src/post_modules/CritBit/tree_high.c:217:    }       if (len + CB_HAS_VALUE(node) != node->size) {    /* Pike_error("Found node with wrong size. is: %p\n", node); */    Pike_error("%s:%d Found node with wrong size. is: 0x%08X\n",    file, line, node);    }       return node->size;   } -  +