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

version» Context lines:

pike.git/src/post_modules/CritBit/tree_high.c:5:   # define cb_check_node(node) do { _low_cb_check_node(node, \    __FILE__, __LINE__); } while (0)   #else   # define cb_check_node(node) do {} while(0)   #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 = 0; i.chars < key.len.chars; i.chars++) { +  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));       for (i.bits = 0; i.bits < CB_WIDTH(s); i.bits++) {    string_builder_sprintf(buf, "%d", CB_GET_BIT(key.str, i));    }    string_builder_putchar(buf, ' ');   #endif
pike.git/src/post_modules/CritBit/tree_high.c:134:    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) {   #ifdef DEBUG_CHECKS    if (CB_LT(node->key.len, last->key.len)) { -  printf("ERROR AT %s\n", issue); -  cb_print_tree(last, 0); -  printf("[%d, %d] is shorter than [%d, %d]\n", node->key.len.chars, -  node->key.len.bits, last->key.len.chars, last->key.len.bits); +  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); +  push_int(last->key.len.chars); +  push_int(last->key.len.bits); +  f_werror(7); +  pop_n_elems(1);    return;    }   #endif /* DEBUG_CHECKS */       if (CB_HAS_CHILD(node, 0)) cb_check(CB_CHILD(node, 0), node, issue);    if (CB_HAS_CHILD(node, 1)) cb_check(CB_CHILD(node, 1), node, issue);   }      static inline int cb_rec_check_parents(cb_node_t node) {    if (node == NULL) return 0;