src/cx/properties.h

changeset 1417
b97faf8b7ab7
parent 1318
12fa1d37fe48
--- a/src/cx/properties.h	Wed Oct 08 20:09:32 2025 +0200
+++ b/src/cx/properties.h	Wed Oct 08 20:20:54 2025 +0200
@@ -403,35 +403,22 @@
         size_t len
 );
 
-#ifdef __cplusplus
-} // extern "C"
+/**
+ * Internal function, do not use.
+ *
+ * @param prop the properties interface
+ * @param str the text to fill in
+ * @retval zero success
+ * @retval non-zero a memory allocation was necessary but failed
+ */
 cx_attr_nonnull
-static inline int cxPropertiesFill(
+static inline int cx_properties_fill(
         CxProperties *prop,
         cxstring str
 ) {
     return cxPropertiesFilln(prop, str.ptr, str.length);
 }
 
-cx_attr_nonnull
-static inline int cxPropertiesFill(
-        CxProperties *prop,
-        cxmutstr str
-) {
-    return cxPropertiesFilln(prop, str.ptr, str.length);
-}
-
-cx_attr_nonnull
-cx_attr_cstr_arg(2)
-static inline int cxPropertiesFill(
-        CxProperties *prop,
-        const char *str
-) {
-    return cxPropertiesFilln(prop, str, strlen(str));
-}
-
-extern "C" {
-#else // __cplusplus
 /**
  * Fills the input buffer with data.
  *
@@ -452,47 +439,7 @@
  * @retval non-zero a memory allocation was necessary but failed
  * @see cxPropertiesFilln()
  */
-#define cxPropertiesFill(prop, str) _Generic((str), \
-    cxstring: cx_properties_fill_cxstr,             \
-    cxmutstr: cx_properties_fill_mutstr,            \
-    char*: cx_properties_fill_str,                  \
-    const char*: cx_properties_fill_str)            \
-    (prop, str)
-
-/**
- * @copydoc cxPropertiesFill()
- */
-cx_attr_nonnull
-static inline int cx_properties_fill_cxstr(
-        CxProperties *prop,
-        cxstring str
-) {
-    return cxPropertiesFilln(prop, str.ptr, str.length);
-}
-
-/**
- * @copydoc cxPropertiesFill()
- */
-cx_attr_nonnull
-static inline int cx_properties_fill_mutstr(
-        CxProperties *prop,
-        cxmutstr str
-) {
-    return cxPropertiesFilln(prop, str.ptr, str.length);
-}
-
-/**
- * @copydoc cxPropertiesFill()
- */
-cx_attr_nonnull
-cx_attr_cstr_arg(2)
-static inline int cx_properties_fill_str(
-        CxProperties *prop,
-        const char *str
-) {
-    return cxPropertiesFilln(prop, str, strlen(str));
-}
-#endif
+#define cxPropertiesFill(prop, str) cx_properties_fill(prop, cx_strcast(str))
 
 /**
  * Specifies stack memory that shall be used as internal buffer.

mercurial