UNIXworkcode

1 Version 4.0.2 - 2026-09-17 2 -------------------------- 3 4 * fixes missing const-qualifier in cx_strchr_ and cx_strrchr_ 5 * fixes bash-specific syntax in update-rules.sh 6 * fixes incorrect tracking of array capacity in high-level array list implementation 7 8 Version 4.0.1 - 2026-02-08 9 -------------------------- 10 11 * fixes compilation errors when using a C++ compiler and a high warning level 12 * fixes incorrect nonnull-attribute for various list.h functions 13 14 Version 4.0.0 - 2025-12-31 15 -------------------------- 16 17 * adds cx_system_page_size() to allocator.h 18 * adds cx_compare_func2 function pointer that supports compare functions with custom data 19 * adds a new (optional) capacity parameter to cxJsonCreateArr() and cxJsonObjPutArr() 20 * adds cxJsonFromString(), cxJsonToString(), and cxJsonToPrettyString() 21 * adds cxJsonClone() 22 * adds cxJsonCompare() 23 * adds cxMapCompare() 24 * adds line continuation support to CxProperties / CxPropertiesConfig 25 * adds cx_hash_key_as_string() 26 * adds support for CxHashKey pointers in CX_HASH_KEY() and all map functions 27 * adds CX_NULLSTR convenience macro 28 * adds cx_strcast_m() 29 * adds cx_strat() 30 * adds cx_bstr() and cx_bstr_m() 31 * adds cxBufferMaximumCapacity() 32 * adds cxBufferAppendString() 33 * adds CX_BUFFER_DO_NOT_FREE buffer flag 34 * changes the parameter order of cxBufferInit() and cxBufferCreate() 35 * changes cxBufferReserve() to allow reducing the capacity 36 * changes cxBufferTerminate() to automatically shrink the buffer 37 * changes cxBufferTerminate() so that position and size are equal after a successful operation 38 * changes cxBufferPutString() to accept any kind of string that cx_strcast() supports 39 * changes that multiple string.h functions now also automatically apply cx_strcast() where possible 40 * changes the names of cxDefineDestructor() and cxDefineAdvancedDestructor() to 41 cxSetDestructor() and cxSetdvancedDestructor() 42 * changes the name of cxCollectionCompareFunc() to cxSetCompareFunc() 43 * changes the entire low-level array-list API by making it much simpler 44 * changes the tree API towards a more simple design 45 * changes the members of CxJson and CxJsonValue 46 * changes the return value of cxJsonObjIter() to CxMapIterator 47 * changes CxTree structure so that it now inherits CX_COLLECTION_BASE 48 * changes cxPropertiesLoad() to directly load properties from a file to a CxMap 49 * changes cxFreeDefault() from a macro to a function so that it can be used as a simple destructor 50 * fixes cxJsonWrite() incorrectly returning non-zero when strings needed to be escaped 51 * fixes cxJsonNext() incorrectly returning CX_JSON_INCOMPLETE_DATA when the input ends with trailing spaces 52 * fixes critical memory leak when using cxMapFree() on a kv-list that is using destructors 53 * fixes critical use-after-free with keys stored in kv-lists 54 * fixes that overwriting items with cxMapPut() in a kv-list did not work 55 * fixes that cxReallocate(), cxReallocateArray(), cx_reallocate(), and cx_reallocatearray() 56 were not returning zero after freeing the memory when passed a size of zero 57 * fixes that cx_list_default_insert_array() has the wrong nonnull attribute when used for cxListEmplaceArray() 58 * removes the CX_STR() macro and instead makes the cx_str() inlinable 59 * removes the cx_str*_m() functions 60 * removes the sort_members feature from CxJsonWriter 61 * removes the source and sink API from properties.h 62 * removes the flush feature from CxBuffer 63 * removes the ability to remove elements from the iterators created with cxIterator() and cxIteratorPtr() 64 * removes several unnecessary convenience functions 65 * removes the complicated wrapping of pointer lists 66 * removes cxIteratorRef() 67 68 Version 3.2.0 - 2025-11-30 69 -------------------------- 70 71 * adds cxMempoolTransfer() and cxMempoolTransferObject() 72 * adds support for different destruction strategies in CxMempool 73 * adds new key-value-based list implementation 74 + adds support for integer keys to CxHashKey 75 * adds support for comparing arbitrary strings without explicit call to cx_strcast() 76 * adds clone, union, difference, and intersection functions for CxList and CxMap 77 * adds cxListContains() and cxMapContains() 78 * adds cxListReserve() and cxListShrink() 79 * adds cxListSet() 80 * adds cxListFirst() and cxListLast() 81 * adds cxListRemoveAndGetFirst() and cxListRemoveAndGetLast(), 82 and corresponding macro aliases cxListPopFront() and cxListPop() 83 * adds cxListEmplace(), cxListEmplaceAt(), cxListEmplaceArray(), cxListEmplaceArrayAt(), and cxMapEmplace() 84 * adds cxListInsertUnique() and cxListInsertUniqueArray() 85 * adds cx_array_insert_unique() and various convenience macros 86 * adds cx_linked_list_insert_unique() and cx_linked_list_insert_unique_chain() 87 * adds cxCollectionCompareFunc() to conveniently set a compare function for a collection 88 without needing to access the base struct manually 89 * adds cxBufferShrink() 90 * adds cxBufferPop() 91 * adds cxTreeSize() 92 * adds CX_PRIstr and CX_SFMT macros for formatting UCX strings 93 * adds cx_strcpy() and cx_strcpy_a() 94 * adds cxJsonArrRemove() and cxJsonObjRemove() 95 * adds cxStdlibAllocator and allows changes of cxDefaultAllocator 96 * improves performance of the CxList array list implementation 97 * changes over-aggressively declaring functions as static inline 98 * changes cx_str() and cx_mutstr() to allow NULL strings 99 * changes cx_strcast() to also accept C-strings as input 100 * changes grow strategy for the memory pool to reduce reallocations 101 * changes grow strategy for CxBuffer, which does now take the page size into account 102 * changes the implementation of cx_strreplacen() for improved efficiency 103 * changes all cxListIterator() and cxMapIterator() families of functions to also accept NULL as argument 104 * changes insert_element member function of CxList to accept NULL source and return a pointer to the inserted element 105 * changes the compare function wrapper for pointer lists so that it no longer invokes the actual compare function for NULL pointers 106 * changes struct cx_array_reallocator_s by replacing the four generic data members with two specifically named members 107 * changes cx_array_reserve() so that it reserves exactly the requested capacity (i.e., without overallocation) 108 * changes all other array functions to perform smart overallocation to avoid too many subsequent allocations 109 * changes that binary search and infimum always report the largest index, and supremum always reports the smallest index 110 when the found element appears more than once in the array 111 * fixes critical memory overflow in the stack-based array reallocator (this unfortunately breaks the function signature) 112 * fixes critical bug in cx_array_insert_sorted() that caused an infinite loop when inserting duplicates 113 * fixes mempool implementation not supporting NULL as argument for realloc 114 * fixes mempool implementation not supporting zero as size for realloc 115 * fixes that the elem_count member of an iterator was not updated after removing an element flagged by cxIteratorFlagRemoval() 116 * fixes that starting an iteration in a non-root node incorrectly continues iteration with the siblings of that node 117 * fixes unnecessary allocations in cx_strcat() family of functions 118 * fixes ineffective overflow check in cx_strcat() family of functions 119 * fixes errno value after failing cxBufferSeek() to be consistently EINVAL 120 * fixes implementation of cxBufferTerminate() 121 * fixes that cxBufferWrite() could auto-extend the buffer beyond the configured threshold 122 * fixes allocator arguments for some printf.h functions not being const 123 * fixes that cx_tree_search() did not investigate subtrees with equally good distance 124 * fixes that memory was freed by the wrong allocator in cx_vasprintf_a() when the underlying vsnprintf() failed 125 * removes all functions that create mutating iterators in favor of making all iterators possibly mutating 126 * removes the use of C23 attributes because they don't mix well with GNU attributes in GCC 15 127 128 Version 3.1.0 - 2025-02-11 129 -------------------------- 130 131 * adds properties.h 132 * adds tree.h 133 * adds json.h 134 * adds locale-independent string to number conversion functions 135 * adds reallocarray() like functions to allocator.h 136 * adds cxIterator() to create iterators over raw C arrays 137 * adds cxIteratorPtr() to create iterators over raw C pointer arrays 138 * adds cx_array_reallocator() and cx_array_default_reallocator 139 * adds several new array and list functions 140 * adds cxBufferReset() 141 * adds cxBufferAppend() 142 * adds cxBufferEnableFlushing() and cxBufferFlush() 143 * adds CX_BUFFER_COPY_ON_WRITE and CX_BUFFER_COPY_ON_EXTEND flags 144 * adds cxBufferWriteFunc and cxBufferReadFunc function pointers (for convenience) 145 * adds cx_cmp_ptr() 146 * adds cx_vcmp_* family of functions 147 * adds cx_sprintf() and several more variants 148 * adds runtime constants to read out the actual SBO sizes 149 * adds improved version of UCX 2 Test framework (now a self-contained header) 150 * adds cx_nmemb() utility function to common.h 151 * changes that CxMap returns own CxMapIterator to save memory in CxIterator 152 * changes name of cxBasicMempoolCreate() to cxMempoolCreateSimple() 153 * changes all functions, for which there is no dedicated xyz_a variant, 154 to accept NULL as allocator argument (in which case a default allocator will be used) 155 * changes the name of destroy functions that actually free the memory to better indicate their behavior 156 * changes cx_strcat variants to allow handling of ENOMEM 157 * changes cx_strcast() to also accept cxstring (and doing nothing in that case) 158 * changes the behavior of cxBufferSeek() to allow offset zero for SEEK_END 159 * moves cx_compare_func typedef to compare.h 160 * moves cx_szmul() to common.h 161 * moves stream copy functions to new streams.h 162 * removes cx_strupper() and cx_strlower() because they only do the right thing in special cases 163 * removes several *_m variants of functions in string.h in favor of automatic conversion 164 * removes utils.h 165 * removes flag_removal function from iterator 166 * removes cxMapDetach() and makes cxMapRemoveAndGet() compatible with both map variants 167 * removes the API for changing the store_pointer property of collections after their creation 168 * removes CMake 169 * removes GTest dependency 170 * removes flags to disable SBO in tests 171 * removes CX_LINKED_LIST_SWAP_SBO_SIZE (it's not really an optimization for linked lists) 172 * fixes cx_strcmp() and cx_strcasecmp() not being useful for lexicographic ordering 173 * fixes cx_hash_key_cxstr() evaluating the argument twice 174 * fixes critical bug that produced wrong results when comparing lists of different type but same size 175 * ends UCX 2.1 long term support 176 177 Version 3.0.0 - 2023-07-09 178 -------------------------- 179 180 * complete redesign from scratch 181 * collections can now store copies of objects and not just pointers 182 * collections are now dynamically implemented 183 * users of the library can specify own implementations of collections that work with the UCX API 184 * low level API for custom lists that do not use the UCX structures 185 * various fixes and improvements 186 * drops some other, rarely used, features 187 * removes testing implementation from the lib 188 189 190 Version 2.1.0 - 2019-12-30 191 -------------------------- 192 193 * adds string replace functions 194 * adds set operations for UcxList and UcxMap 195 * adds sstrcaseprefix() and sstrcasesuffix() 196 * improves Doxygen documentation in ucx/string.h 197 * adds UcxArray data type 198 * adds support for CMake builds, but main build system is still autotools 199 200 Version 2.0 - 2018-12-28 201 ------------------------ 202 203 * some uncritical bug fixes 204 * overflow of sstrnlen now returns SIZE_MAX instead of zero 205 * adds scstr_t - a const char* variant for sstr_t 206 * renames utility compare functions 207 208 Version 1.1.0 - 2018-05-14 209 -------------------------- 210 211 * adds missing 32 bit support to integer overflow checks 212 * adds ucx_buffer_to_sstr() macro 213 * adds ucx_avl_free_content() 214 * adds some more compare and distance functions in utils.h 215 * adds SFMT() and PRIsstr convenience macros 216 * destructor functions for *_free_content() functions are now optional 217 218 Version 1.0.1 - 2018-01-21 219 -------------------------- 220 221 * some bug fixes 222 * adds integer overflow checks 223 224 Version 1.0.0 - 2017-10-28 225 -------------------------- 226 227 * first stable version of UCX released 228