Branch: Tag:

2012-06-19

2012-06-19 11:25:29 by Arne Goedeke <el@laramies.com>

ADT.CritBit: reserve allocator space to avoid relocations while pointers are on the stack

137:    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;    }    });
561:    }   }    - 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);   }