add note that cxPropertiesLoad() does not roll back the changes to the map on error

Tue, 09 Dec 2025 18:55:14 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 09 Dec 2025 18:55:14 +0100
changeset 1560
f060ecd65575
parent 1559
9e50f45f8736
child 1561
fcebf53de51c

add note that cxPropertiesLoad() does not roll back the changes to the map on error

docs/Writerside/topics/properties.h.md file | annotate | diff | comparison | revisions
src/cx/properties.h file | annotate | diff | comparison | revisions
--- a/docs/Writerside/topics/properties.h.md	Tue Dec 09 18:51:11 2025 +0100
+++ b/docs/Writerside/topics/properties.h.md	Tue Dec 09 18:55:14 2025 +0100
@@ -117,7 +117,8 @@
 which opens the file designated by the `filename` and loads all properties from that file into the specified `CxMap`.
 The convenience macro `cxPropertiesLoadDefault()` uses the default parser configuration for this.
 The target map must either store pointers of type `char*` or elements of type `cxmutstr`.
-In either case, the specified `allocator` is used to allocate the memory for the value. 
+In either case, the specified `allocator` is used to allocate the memory for the value.
+If the function encounters an error, all properties that have been added to the map so far stay in the map; there is no rollback. 
 
 > The stack buffers used by `cxPropertiesLoad()` can be changed when building UCX from sources
 > by setting the `CX_PROPERTIES_LOAD_FILL_SIZE` and `CX_PROPERTIES_LOAD_BUF_SIZE` macros
--- a/src/cx/properties.h	Tue Dec 09 18:51:11 2025 +0100
+++ b/src/cx/properties.h	Tue Dec 09 18:55:14 2025 +0100
@@ -357,6 +357,9 @@
  * The map must either store pointers of type @c char*, or elements of type cxmutstr.
  * Any other configuration is not supported.
  *
+ * @note When the parser finds an error, all successfully parsed keys before the error
+ * are added to the map nonetheless.
+ *
  * @param config the parser config
  * @param allocator the allocator for the values that will be stored in the map
  * @param filename (any string) the absolute or relative path to the file
@@ -382,6 +385,9 @@
  * The map must either store pointers of type @c char*, or elements of type cxmutstr.
  * Any other configuration is not supported.
  *
+ * @note When the parser finds an error, all successfully parsed keys before the error
+ * are added to the map nonetheless.
+ *
  * @param allocator the allocator for the values that will be stored in the map
  * @param filename (any string) the absolute or relative path to the file
  * @param target (@c CxMap*) the map where the properties shall be added

mercurial