src/ucx/cx/printf.h

changeset 490
d218607f5a7e
parent 415
d938228c382e
--- a/src/ucx/cx/printf.h	Sat Mar 25 17:18:51 2023 +0100
+++ b/src/ucx/cx/printf.h	Fri May 05 18:02:11 2023 +0200
@@ -55,7 +55,13 @@
  * @param ... additional arguments
  * @return the total number of bytes written
  */
-int cx_fprintf(void *stream, cx_write_func wfc, char const *fmt, ...);
+__attribute__((__nonnull__(1, 2, 3), __format__(printf, 3, 4)))
+int cx_fprintf(
+        void *stream,
+        cx_write_func wfc,
+        char const *fmt,
+        ...
+);
 
 /**
  * A \c vfprintf like function which writes the output to a stream by
@@ -68,7 +74,13 @@
  * @return the total number of bytes written
  * @see cx_fprintf()
  */
-int cx_vfprintf(void *stream, cx_write_func wfc, char const *fmt, va_list ap);
+__attribute__((__nonnull__))
+int cx_vfprintf(
+        void *stream,
+        cx_write_func wfc,
+        char const *fmt,
+        va_list ap
+);
 
 /**
  * A \c asprintf like function which allocates space for a string
@@ -82,7 +94,12 @@
  * @return the formatted string
  * @see cx_strfree_a()
  */
-cxmutstr cx_asprintf_a(CxAllocator *allocator, char const *fmt, ...);
+__attribute__((__nonnull__(1, 2), __format__(printf, 2, 3)))
+cxmutstr cx_asprintf_a(
+        CxAllocator const *allocator,
+        char const *fmt,
+        ...
+);
 
 /**
  * A \c asprintf like function which allocates space for a string
@@ -110,7 +127,12 @@
  * @return the formatted string
  * @see cx_asprintf_a()
  */
-cxmutstr cx_vasprintf_a(CxAllocator *allocator, char const *fmt, va_list ap);
+__attribute__((__nonnull__))
+cxmutstr cx_vasprintf_a(
+        CxAllocator const *allocator,
+        char const *fmt,
+        va_list ap
+);
 
 /**
 * A \c vasprintf like function which allocates space for a string
@@ -128,7 +150,7 @@
 /**
  * A \c printf like function which writes the output to a CxBuffer.
  *
- * @param buffer the buffer the data is written to
+ * @param buffer a pointer to the buffer the data is written to
  * @param fmt the format string
  * @param ... additional arguments
  * @return the total number of bytes written

mercurial