|
libdict 1.0.7
Data Structure C Library
|
Changes since 1.0.6. The public API and ABI are unchanged: existing code compiles as before, and abidiff against 1.0.6 reports no removed or changed functions. A few fixes do change behaviour that a program may have relied on; they are listed first.
dict_str_cmp now compares bytes as unsigned char, exactly as strcmp() does. On x86, x86_64 and i386, keys containing bytes >= 0x80 (for example UTF-8 text) therefore sort differently than before: "é" now sorts after "a". This affects iteration order, dict_select() positions and the neighbours found by the near searches; lookups are unaffected. Nothing changes on ARM, PowerPC or s390x, which already behaved this way.hb_itor_search() is an exact search. It used to find the first key greater than or equal to the target. dict_itor_search() on an hb_tree was already exact; use hb_itor_search_ge() for the old behaviour.dict_clear() (and, for hashtable2, after any removal), every iterator over the table reports itself invalid: dict_itor_valid() is false and dict_itor_next() returns false. Loops that modify a hash table while iterating now stop instead of silently skipping or repeating elements, or reading freed memory. Reposition with dict_itor_first() or dict_itor_search(). Inserting another key without a resize, and (for hashtable) removing another element, keep iterators valid as before. The rules for all containers are documented under "Iterator invalidation".dct->_vtable->insert == hashtable_insert) is now always false; compare the _vtable pointer with that of a dict of the known type instead.dict_traverse() on an hb_tree with two or more keys crashed.dict_select() with a NULL key or datum argument crashed on sp_tree and tr_tree.skiplist_new() with max_link 0 or 1 lost every element and leaked it; max_link is now raised to 2.*_path_length functions and sp_tree_verify/tr_tree_verify with a stack overflow; they are now iterative.__builtin_ctz(0) in the skip list, relational comparison of unrelated pointers in dict_ptr_cmp, and comparisons of pointers to freed nodes in several trees.dict_verify() now catches corruption it used to accept: wrong black height in rb_tree, a subtree on the wrong side of an ancestor (all trees), a wrong element count, and out-of-order skip list links. It prints the failed check to stderr.dict_itor_compare() on a hash table evaluates to 0 instead of calling a NULL function pointer; hashtable2_itor_valid() no longer aborts after a removal.rotation_count statistics of sp_tree and pr_tree count single and double rotations consistently.demo, anagram and benchmark: crashes on a bare search command and on blank or NUL-led input lines, an overlapping strcpy, negative <ctype.h> arguments, printf format mismatches, unchecked allocations, and memory leaks. benchmark now skips blank input lines; anagram skips words with ten or more of one letter.util.h could not be included by two translation units.dict_insert_result.inserted backwards; it is true when the key was inserted.-Weverything.LIBDICT_SLOW_TESTS=1.See the GitHub releases and the git history.