src/cx/printf.h

changeset 1426
3a89b31f0724
parent 1424
563033aa998c
--- a/src/cx/printf.h	Wed Oct 15 22:45:21 2025 +0200
+++ b/src/cx/printf.h	Thu Oct 16 19:57:47 2025 +0200
@@ -56,8 +56,7 @@
 /**
  * The maximum string length that fits into stack memory.
  */
-cx_attr_export
-extern const unsigned cx_printf_sbo_size;
+CX_EXPORT extern const unsigned cx_printf_sbo_size;
 
 /**
  * A @c fprintf like function which writes the output to a stream by
@@ -69,16 +68,8 @@
  * @param ... additional arguments
  * @return the total number of bytes written or an error code from stdlib printf implementation
  */
-cx_attr_nonnull_arg(1, 2, 3)
-cx_attr_printf(3, 4)
-cx_attr_cstr_arg(3)
-cx_attr_export
-int cx_fprintf(
-        void *stream,
-        cx_write_func wfc,
-        const char *fmt,
-        ...
-);
+cx_attr_nonnull_arg(1, 2, 3) cx_attr_printf(3, 4) cx_attr_cstr_arg(3)
+CX_EXPORT int cx_fprintf(void *stream, cx_write_func wfc, const char *fmt, ...);
 
 /**
  * A @c vfprintf like function which writes the output to a stream by
@@ -91,15 +82,8 @@
  * @return the total number of bytes written or an error code from stdlib printf implementation
  * @see cx_fprintf()
  */
-cx_attr_nonnull
-cx_attr_cstr_arg(3)
-cx_attr_export
-int cx_vfprintf(
-        void *stream,
-        cx_write_func wfc,
-        const char *fmt,
-        va_list ap
-);
+cx_attr_nonnull cx_attr_cstr_arg(3)
+CX_EXPORT int cx_vfprintf(void *stream, cx_write_func wfc, const char *fmt, va_list ap);
 
 /**
  * An @c asprintf like function which allocates space for a string
@@ -115,15 +99,8 @@
  * @return the formatted string
  * @see cx_strfree_a()
  */
-cx_attr_nonnull_arg(1, 2)
-cx_attr_printf(2, 3)
-cx_attr_cstr_arg(2)
-cx_attr_export
-cxmutstr cx_asprintf_a(
-        const CxAllocator *allocator,
-        const char *fmt,
-        ...
-);
+cx_attr_nonnull_arg(1, 2) cx_attr_printf(2, 3) cx_attr_cstr_arg(2)
+CX_EXPORT cxmutstr cx_asprintf_a(const CxAllocator *allocator, const char *fmt, ...);
 
 /**
  * An @c asprintf like function which allocates space for a string
@@ -138,8 +115,7 @@
  * @return (@c cxmutstr) the formatted string
  * @see cx_strfree()
  */
-#define cx_asprintf(fmt, ...) \
-    cx_asprintf_a(cxDefaultAllocator, fmt, __VA_ARGS__)
+#define cx_asprintf(fmt, ...) cx_asprintf_a(cxDefaultAllocator, fmt, __VA_ARGS__)
 
 /**
 * A @c vasprintf like function which allocates space for a string
@@ -155,14 +131,8 @@
  * @return the formatted string
  * @see cx_asprintf_a()
  */
-cx_attr_nonnull
-cx_attr_cstr_arg(2)
-cx_attr_export
-cxmutstr cx_vasprintf_a(
-        const CxAllocator *allocator,
-        const char *fmt,
-        va_list ap
-);
+cx_attr_nonnull cx_attr_cstr_arg(2)
+CX_EXPORT cxmutstr cx_vasprintf_a(const CxAllocator *allocator, const char *fmt, va_list ap);
 
 /**
 * A @c vasprintf like function which allocates space for a string
@@ -189,8 +159,7 @@
  * @see cx_fprintf()
  * @see cxBufferWrite()
  */
-#define cx_bprintf(buffer, fmt, ...) cx_fprintf((void*)buffer, \
-    cxBufferWriteFunc, fmt, __VA_ARGS__)
+#define cx_bprintf(buffer, fmt, ...) cx_fprintf((void*)buffer, cxBufferWriteFunc, fmt, __VA_ARGS__)
 
 
 /**
@@ -224,17 +193,8 @@
  * @param ... additional arguments
  * @return the length of the produced string or an error code from stdlib printf implementation
  */
-cx_attr_nonnull_arg(1, 2, 3, 4)
-cx_attr_printf(4, 5)
-cx_attr_cstr_arg(4)
-cx_attr_export
-int cx_sprintf_a(
-        const CxAllocator *alloc,
-        char **str,
-        size_t *len,
-        const char *fmt,
-        ...
-);
+cx_attr_nonnull_arg(1, 2, 3, 4) cx_attr_printf(4, 5) cx_attr_cstr_arg(4)
+CX_EXPORT int cx_sprintf_a(const CxAllocator *alloc, char **str, size_t *len, const char *fmt, ...);
 
 
 /**
@@ -268,18 +228,8 @@
  * @param ap argument list
  * @return the length of the produced string or an error code from stdlib printf implementation
  */
-cx_attr_nonnull
-cx_attr_cstr_arg(4)
-cx_attr_access_rw(2)
-cx_attr_access_rw(3)
-cx_attr_export
-int cx_vsprintf_a(
-        const CxAllocator *alloc,
-        char **str,
-        size_t *len,
-        const char *fmt,
-        va_list ap
-);
+cx_attr_nonnull  cx_attr_cstr_arg(4) cx_attr_access_rw(2) cx_attr_access_rw(3)
+CX_EXPORT int cx_vsprintf_a(const CxAllocator *alloc, char **str, size_t *len, const char *fmt, va_list ap);
 
 
 /**
@@ -325,21 +275,9 @@
  * @param ... additional arguments
  * @return the length of the produced string or an error code from stdlib printf implementation
  */
-cx_attr_nonnull_arg(1, 2, 4, 5)
-cx_attr_printf(5, 6)
-cx_attr_cstr_arg(5)
-cx_attr_access_rw(2)
-cx_attr_access_rw(3)
-cx_attr_access_rw(4)
-cx_attr_export
-int cx_sprintf_sa(
-        const CxAllocator *alloc,
-        char *buf,
-        size_t *len,
-        char **str,
-        const char *fmt,
-        ...
-);
+cx_attr_nonnull_arg(1, 2, 4, 5) cx_attr_printf(5, 6) cx_attr_cstr_arg(5)
+cx_attr_access_rw(2) cx_attr_access_rw(3) cx_attr_access_rw(4)
+CX_EXPORT int cx_sprintf_sa(const CxAllocator *alloc, char *buf, size_t *len, char **str, const char *fmt, ...);
 
 /**
  * An @c sprintf like function which allocates a new string when the buffer is not large enough.
@@ -384,17 +322,8 @@
  * @param ap argument list
  * @return the length of the produced string or an error code from stdlib printf implementation
  */
-cx_attr_nonnull
-cx_attr_cstr_arg(5)
-cx_attr_export
-int cx_vsprintf_sa(
-        const CxAllocator *alloc,
-        char *buf,
-        size_t *len,
-        char **str,
-        const char *fmt,
-        va_list ap
-);
+cx_attr_nonnull cx_attr_cstr_arg(5)
+CX_EXPORT int cx_vsprintf_sa(const CxAllocator *alloc, char *buf, size_t *len, char **str, const char *fmt, va_list ap);
 
 
 #ifdef __cplusplus

mercurial