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

version» Context lines:

pike.git/src/post_modules/CritBit/tree_low.c:130:    if (_ == end) return NULL;    if (CB_HAS_VALUE(_)) break;    });    }    /* printf("start: %p, stop: %p in line %d\n", node, end, __LINE__); */    ntree = cb_node_from_string(node->key, &node->value);       if (node != end) WALK_FORWARD(node, {    if (CB_HAS_VALUE(_)) {    /* printf("adding %p\n", _); */ -  cb_insert(ntree, _->key, &node->value); +  cb_insert(&ntree, _->key, &node->value);    if (_ == end) break;    }    });       /* printf("new range has %d members.\n", ntree->size); */    return ntree;    }    return NULL;   }   
pike.git/src/post_modules/CritBit/tree_low.c:554:    node->key.len = size;    bit = CB_GET_BIT(key.str, size);    CB_SET_CHILD(node, bit, cb_node_from_string(key, val));    CB_SET_CHILD(node, !bit, new);    CB_RM_VALUE(node); /* do not free here, clone does take ref */       return 1;    }   }    - CB_STATIC CB_INLINE cb_node_t cb_insert(cb_node_t tree, const cb_key key, + CB_STATIC CB_INLINE void cb_insert(cb_node_t * tree, const cb_key key,    const cb_value *val) {    -  if (!tree) { -  return tree = cb_node_from_string(key, val); -  } +  cb_check_node(*tree);    -  cb_check_node(tree); +  if (!*tree) { +  *tree = cb_node_from_string(key, val); +  } else cb_low_insert(*tree, key, val);    -  cb_low_insert(tree, key, val); -  -  cb_check_node(tree); -  -  return tree; +  cb_check_node(*tree);   }