src/ucx/cx/printf.h

changeset 490
d218607f5a7e
parent 415
d938228c382e
equal deleted inserted replaced
489:921f83a8943f 490:d218607f5a7e
53 * @param wfc the write function 53 * @param wfc the write function
54 * @param fmt format string 54 * @param fmt format string
55 * @param ... additional arguments 55 * @param ... additional arguments
56 * @return the total number of bytes written 56 * @return the total number of bytes written
57 */ 57 */
58 int cx_fprintf(void *stream, cx_write_func wfc, char const *fmt, ...); 58 __attribute__((__nonnull__(1, 2, 3), __format__(printf, 3, 4)))
59 int cx_fprintf(
60 void *stream,
61 cx_write_func wfc,
62 char const *fmt,
63 ...
64 );
59 65
60 /** 66 /**
61 * A \c vfprintf like function which writes the output to a stream by 67 * A \c vfprintf like function which writes the output to a stream by
62 * using a write_func. 68 * using a write_func.
63 * 69 *
66 * @param fmt format string 72 * @param fmt format string
67 * @param ap argument list 73 * @param ap argument list
68 * @return the total number of bytes written 74 * @return the total number of bytes written
69 * @see cx_fprintf() 75 * @see cx_fprintf()
70 */ 76 */
71 int cx_vfprintf(void *stream, cx_write_func wfc, char const *fmt, va_list ap); 77 __attribute__((__nonnull__))
78 int cx_vfprintf(
79 void *stream,
80 cx_write_func wfc,
81 char const *fmt,
82 va_list ap
83 );
72 84
73 /** 85 /**
74 * A \c asprintf like function which allocates space for a string 86 * A \c asprintf like function which allocates space for a string
75 * the result is written to. 87 * the result is written to.
76 * 88 *
80 * @param fmt format string 92 * @param fmt format string
81 * @param ... additional arguments 93 * @param ... additional arguments
82 * @return the formatted string 94 * @return the formatted string
83 * @see cx_strfree_a() 95 * @see cx_strfree_a()
84 */ 96 */
85 cxmutstr cx_asprintf_a(CxAllocator *allocator, char const *fmt, ...); 97 __attribute__((__nonnull__(1, 2), __format__(printf, 2, 3)))
98 cxmutstr cx_asprintf_a(
99 CxAllocator const *allocator,
100 char const *fmt,
101 ...
102 );
86 103
87 /** 104 /**
88 * A \c asprintf like function which allocates space for a string 105 * A \c asprintf like function which allocates space for a string
89 * the result is written to. 106 * the result is written to.
90 * 107 *
108 * @param fmt format string 125 * @param fmt format string
109 * @param ap argument list 126 * @param ap argument list
110 * @return the formatted string 127 * @return the formatted string
111 * @see cx_asprintf_a() 128 * @see cx_asprintf_a()
112 */ 129 */
113 cxmutstr cx_vasprintf_a(CxAllocator *allocator, char const *fmt, va_list ap); 130 __attribute__((__nonnull__))
131 cxmutstr cx_vasprintf_a(
132 CxAllocator const *allocator,
133 char const *fmt,
134 va_list ap
135 );
114 136
115 /** 137 /**
116 * A \c vasprintf like function which allocates space for a string 138 * A \c vasprintf like function which allocates space for a string
117 * the result is written to. 139 * the result is written to.
118 * 140 *
126 #define cx_vasprintf(fmt, ap) cx_vasprintf_a(cxDefaultAllocator, fmt, ap) 148 #define cx_vasprintf(fmt, ap) cx_vasprintf_a(cxDefaultAllocator, fmt, ap)
127 149
128 /** 150 /**
129 * A \c printf like function which writes the output to a CxBuffer. 151 * A \c printf like function which writes the output to a CxBuffer.
130 * 152 *
131 * @param buffer the buffer the data is written to 153 * @param buffer a pointer to the buffer the data is written to
132 * @param fmt the format string 154 * @param fmt the format string
133 * @param ... additional arguments 155 * @param ... additional arguments
134 * @return the total number of bytes written 156 * @return the total number of bytes written
135 * @see ucx_fprintf() 157 * @see ucx_fprintf()
136 */ 158 */

mercurial