change signatures of cxPropertiesLoad()

Sun, 14 Dec 2025 16:15:57 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 14 Dec 2025 16:15:57 +0100
changeset 1603
ffea41207599
parent 1602
7329821fd768
child 1604
68b75c091028

change signatures of cxPropertiesLoad()

relates to #780

docs/Writerside/topics/properties.h.md file | annotate | diff | comparison | revisions
src/cx/properties.h file | annotate | diff | comparison | revisions
src/properties.c file | annotate | diff | comparison | revisions
--- a/docs/Writerside/topics/properties.h.md	Sun Dec 14 15:45:01 2025 +0100
+++ b/docs/Writerside/topics/properties.h.md	Sun Dec 14 16:15:57 2025 +0100
@@ -65,9 +65,10 @@
 void cxPropertiesUseStack(CxProperties *prop,
         char *buf, size_t capacity);
 
-CxPropertiesStatus cxPropertiesLoad(CxPropertiesConfig config,
+CxPropertiesStatus cxPropertiesLoad(
         const CxAllocator *allocator,
-        AnyStr filename, CxMap *target);
+        AnyStr filename, CxMap *target,
+        CxPropertiesConfig config);
 
 CxPropertiesStatus cxPropertiesLoadDefault(
         const CxAllocator *allocator,
--- a/src/cx/properties.h	Sun Dec 14 15:45:01 2025 +0100
+++ b/src/cx/properties.h	Sun Dec 14 16:15:57 2025 +0100
@@ -336,15 +336,15 @@
 /**
  * Internal function - use cxPropertiesLoad() instead.
  *
- * @param config the parser config
  * @param allocator the allocator for the values
  * @param filename the file name
  * @param target the target map
+ * @param config the parser config
  * @return status code
  */
-cx_attr_nonnull_arg(4)
-CX_EXPORT CxPropertiesStatus cx_properties_load(CxPropertiesConfig config,
-        const CxAllocator *allocator, cxstring filename, CxMap *target);
+cx_attr_nonnull_arg(3)
+CX_EXPORT CxPropertiesStatus cx_properties_load(const CxAllocator *allocator,
+        cxstring filename, CxMap *target, CxPropertiesConfig config);
 
 /**
  * Loads properties from a file and inserts them into a map.
@@ -357,10 +357,10 @@
  * @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
  * @param target (@c CxMap*) the map where the properties shall be added
+ * @param config the parser config
  * @retval CX_PROPERTIES_NO_ERROR (zero) at least one key/value pair was found
  * @retval CX_PROPERTIES_NO_DATA the file is syntactically OK, but does not contain properties
  * @retval CX_PROPERTIES_INCOMPLETE_DATA unexpected end of file
@@ -371,8 +371,8 @@
  * @retval CX_PROPERTIES_MAP_ERROR storing a key/value pair in the map failed
  * @see cxPropertiesLoadDefault()
  */
-#define cxPropertiesLoad(config, allocator, filename, target) \
-    cx_properties_load(config, allocator, cx_strcast(filename), target)
+#define cxPropertiesLoad(allocator, filename, target, config) \
+    cx_properties_load(allocator, cx_strcast(filename), target, config)
 
 /**
  * Loads properties from a file and inserts them into a map with a default config.
@@ -399,7 +399,7 @@
  * @see cxPropertiesLoad()
  */
 #define cxPropertiesLoadDefault(allocator, filename, target) \
-    cx_properties_load(cx_properties_config_default, allocator, cx_strcast(filename), target)
+    cx_properties_load(allocator, cx_strcast(filename), target, cx_properties_config_default)
 
 
 #ifdef __cplusplus
--- a/src/properties.c	Sun Dec 14 15:45:01 2025 +0100
+++ b/src/properties.c	Sun Dec 14 16:15:57 2025 +0100
@@ -312,8 +312,8 @@
 #endif
 const unsigned cx_properties_load_buf_size = CX_PROPERTIES_LOAD_BUF_SIZE;
 
-CxPropertiesStatus cx_properties_load(CxPropertiesConfig config,
-        const CxAllocator *allocator, cxstring filename, CxMap *target) {
+CxPropertiesStatus cx_properties_load(const CxAllocator *allocator,
+                                      cxstring filename, CxMap *target, CxPropertiesConfig config) {
     if (allocator == NULL) {
         allocator = cxDefaultAllocator;
     }

mercurial