src/cx/properties.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
--- a/src/cx/properties.h	Wed Oct 15 22:45:21 2025 +0200
+++ b/src/cx/properties.h	Thu Oct 16 19:57:47 2025 +0200
@@ -94,8 +94,7 @@
 /**
  * Default properties configuration.
  */
-cx_attr_export
-extern const CxPropertiesConfig cx_properties_config_default;
+CX_EXPORT extern const CxPropertiesConfig cx_properties_config_default;
 
 /**
  * Status codes for the properties interface.
@@ -210,7 +209,6 @@
  * @retval zero success
  * @retval non-zero sinking the k/v-pair failed
  */
-cx_attr_nonnull
 typedef int(*cx_properties_sink_func)(
         CxProperties *prop,
         CxPropertiesSink *sink,
@@ -257,7 +255,6 @@
  * @retval zero success
  * @retval non-zero reading the data failed
  */
-cx_attr_nonnull
 typedef int(*cx_properties_read_func)(
         CxProperties *prop,
         CxPropertiesSource *src,
@@ -272,7 +269,6 @@
  * @retval zero initialization was successful
  * @retval non-zero otherwise
  */
-cx_attr_nonnull
 typedef int(*cx_properties_read_init_func)(
         CxProperties *prop,
         CxPropertiesSource *src
@@ -284,7 +280,6 @@
  * @param prop the properties interface that wants to read from the source
  * @param src the source
  */
-cx_attr_nonnull
 typedef void(*cx_properties_read_clean_func)(
         CxProperties *prop,
         CxPropertiesSource *src
@@ -331,8 +326,7 @@
  * @see cxPropertiesInitDefault()
  */
 cx_attr_nonnull
-cx_attr_export
-void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config);
+CX_EXPORT void cxPropertiesInit(CxProperties *prop, CxPropertiesConfig config);
 
 /**
  * Destroys the properties interface.
@@ -346,8 +340,7 @@
  * @param prop the properties interface
  */
 cx_attr_nonnull
-cx_attr_export
-void cxPropertiesDestroy(CxProperties *prop);
+CX_EXPORT void cxPropertiesDestroy(CxProperties *prop);
 
 /**
  * Destroys and re-initializes the properties interface.
@@ -358,11 +351,7 @@
  * @param prop the properties interface
  */
 cx_attr_nonnull
-static inline void cxPropertiesReset(CxProperties *prop) {
-    CxPropertiesConfig config = prop->config;
-    cxPropertiesDestroy(prop);
-    cxPropertiesInit(prop, config);
-}
+CX_EXPORT void cxPropertiesReset(CxProperties *prop);
 
 /**
  * Initialize a properties parser with the default configuration.
@@ -371,7 +360,7 @@
  * @see cxPropertiesInit()
  */
 #define cxPropertiesInitDefault(prop) \
-    cxPropertiesInit(prop, cx_properties_config_default)
+        cxPropertiesInit(prop, cx_properties_config_default)
 
 /**
  * Fills the input buffer with data.
@@ -394,14 +383,8 @@
  * @retval non-zero a memory allocation was necessary but failed
  * @see cxPropertiesFill()
  */
-cx_attr_nonnull
-cx_attr_access_r(2, 3)
-cx_attr_export
-int cxPropertiesFilln(
-        CxProperties *prop,
-        const char *buf,
-        size_t len
-);
+cx_attr_nonnull cx_attr_access_r(2, 3)
+CX_EXPORT int cxPropertiesFilln(CxProperties *prop, const char *buf, size_t len);
 
 /**
  * Internal function, do not use.
@@ -412,10 +395,7 @@
  * @retval non-zero a memory allocation was necessary but failed
  */
 cx_attr_nonnull
-static inline int cx_properties_fill(
-        CxProperties *prop,
-        cxstring str
-) {
+CX_INLINE int cx_properties_fill(CxProperties *prop, cxstring str) {
     return cxPropertiesFilln(prop, str.ptr, str.length);
 }
 
@@ -449,12 +429,7 @@
  * @param capacity the capacity of the stack memory
  */
 cx_attr_nonnull
-cx_attr_export
-void cxPropertiesUseStack(
-        CxProperties *prop,
-        char *buf,
-        size_t capacity
-);
+CX_EXPORT void cxPropertiesUseStack(CxProperties *prop, char *buf, size_t capacity);
 
 /**
  * Retrieves the next key/value-pair.
@@ -486,14 +461,8 @@
  * @retval CX_PROPERTIES_INVALID_MISSING_DELIMITER the properties data contains a line without delimiter
  * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_export
-CxPropertiesStatus cxPropertiesNext(
-        CxProperties *prop,
-        cxstring *key,
-        cxstring *value
-);
+cx_attr_nonnull cx_attr_nodiscard
+CX_EXPORT CxPropertiesStatus cxPropertiesNext(CxProperties *prop, cxstring *key, cxstring *value);
 
 /**
  * Creates a properties sink for an UCX map.
@@ -509,10 +478,8 @@
  * @return the sink
  * @see cxPropertiesLoad()
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_export
-CxPropertiesSink cxPropertiesMapSink(CxMap *map);
+cx_attr_nonnull cx_attr_nodiscard
+CX_EXPORT CxPropertiesSink cxPropertiesMapSink(CxMap *map);
 
 /**
  * Creates a properties source based on an UCX string.
@@ -522,8 +489,7 @@
  * @see cxPropertiesLoad()
  */
 cx_attr_nodiscard
-cx_attr_export
-CxPropertiesSource cxPropertiesStringSource(cxstring str);
+CX_EXPORT CxPropertiesSource cxPropertiesStringSource(cxstring str);
 
 /**
  * Creates a properties source based on C string with the specified length.
@@ -533,11 +499,8 @@
  * @return the properties source
  * @see cxPropertiesLoad()
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_access_r(1, 2)
-cx_attr_export
-CxPropertiesSource cxPropertiesCstrnSource(const char *str, size_t len);
+cx_attr_nonnull cx_attr_nodiscard cx_attr_access_r(1, 2)
+CX_EXPORT CxPropertiesSource cxPropertiesCstrnSource(const char *str, size_t len);
 
 /**
  * Creates a properties source based on a C string.
@@ -549,11 +512,8 @@
  * @return the properties source
  * @see cxPropertiesLoad()
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_cstr_arg(1)
-cx_attr_export
-CxPropertiesSource cxPropertiesCstrSource(const char *str);
+cx_attr_nonnull cx_attr_nodiscard cx_attr_cstr_arg(1)
+CX_EXPORT CxPropertiesSource cxPropertiesCstrSource(const char *str);
 
 /**
  * Creates a properties source based on an FILE.
@@ -564,11 +524,8 @@
  * @return the properties source
  * @see cxPropertiesLoad()
  */
-cx_attr_nonnull
-cx_attr_nodiscard
-cx_attr_access_r(1)
-cx_attr_export
-CxPropertiesSource cxPropertiesFileSource(FILE *file, size_t chunk_size);
+cx_attr_nonnull cx_attr_nodiscard cx_attr_access_r(1)
+CX_EXPORT CxPropertiesSource cxPropertiesFileSource(FILE *file, size_t chunk_size);
 
 
 /**
@@ -600,12 +557,8 @@
  * @retval CX_PROPERTIES_BUFFER_ALLOC_FAILED an internal allocation was necessary but failed
  */
 cx_attr_nonnull
-cx_attr_export
-CxPropertiesStatus cxPropertiesLoad(
-        CxProperties *prop,
-        CxPropertiesSink sink,
-        CxPropertiesSource source
-);
+CX_EXPORT CxPropertiesStatus cxPropertiesLoad(CxProperties *prop,
+        CxPropertiesSink sink, CxPropertiesSource source);
 
 #ifdef __cplusplus
 } // extern "C"

mercurial