48#define cx_attr_printf(fmt_idx, arg_idx) \
49 __attribute__((__format__(printf, fmt_idx, arg_idx)))
141#define cx_asprintf(fmt, ...) \
142 cx_asprintf_a(cxDefaultAllocator, fmt, __VA_ARGS__)
180#define cx_vasprintf(fmt, ap) cx_vasprintf_a(cxDefaultAllocator, fmt, ap)
192#define cx_bprintf(buffer, fmt, ...) cx_fprintf((void*)buffer, \
193 cxBufferWriteFunc, fmt, __VA_ARGS__)
209#define cx_sprintf(str, len, fmt, ...) cx_sprintf_a(cxDefaultAllocator, str, len, fmt, __VA_ARGS__)
253#define cx_vsprintf(str, len, fmt, ap) cx_vsprintf_a(cxDefaultAllocator, str, len, fmt, ap)
305#define cx_sprintf_s(buf, len, str, fmt, ...) cx_sprintf_sa(cxDefaultAllocator, buf, len, str, fmt, __VA_ARGS__)
364#define cx_vsprintf_s(buf, len, str, fmt, ap) cx_vsprintf_sa(cxDefaultAllocator, buf, len, str, fmt, ap)
Common definitions and feature checks.
#define cx_attr_export
Only used for building Windows DLLs.
Definition common.h:285
#define cx_attr_nonnull
All pointer arguments must be non-NULL.
Definition common.h:136
size_t(* cx_write_func)(const void *, size_t, size_t, void *)
Function pointer compatible with fwrite-like functions.
Definition common.h:295
#define cx_attr_access_rw(...)
Specifies that the function will read and write through the given pointer.
Definition common.h:233
#define cx_attr_nonnull_arg(...)
The specified pointer arguments must be non-NULL.
Definition common.h:141
#define cx_attr_cstr_arg(idx)
No support for null_terminated_string_arg in clang or GCC below 14.
Definition common.h:206
int cx_sprintf_a(CxAllocator *alloc, char **str, size_t *len, const char *fmt,...)
An sprintf like function which reallocates the string when the buffer is not large enough.
const unsigned cx_printf_sbo_size
The maximum string length that fits into stack memory.
int cx_vfprintf(void *stream, cx_write_func wfc, const char *fmt, va_list ap)
A vfprintf like function which writes the output to a stream by using a write_func.
cxmutstr cx_asprintf_a(const CxAllocator *allocator, const char *fmt,...)
A asprintf like function which allocates space for a string the result is written to.
cxmutstr cx_vasprintf_a(const CxAllocator *allocator, const char *fmt, va_list ap)
A vasprintf like function which allocates space for a string the result is written to.
int cx_vsprintf_a(CxAllocator *alloc, char **str, size_t *len, const char *fmt, va_list ap)
An sprintf like function which reallocates the string when the buffer is not large enough.
int cx_fprintf(void *stream, cx_write_func wfc, const char *fmt,...)
A fprintf like function which writes the output to a stream by using a write_func.
int cx_sprintf_sa(CxAllocator *alloc, char *buf, size_t *len, char **str, const char *fmt,...)
An sprintf like function which allocates a new string when the buffer is not large enough.
int cx_vsprintf_sa(CxAllocator *alloc, char *buf, size_t *len, char **str, const char *fmt, va_list ap)
An sprintf like function which allocates a new string when the buffer is not large enough.
#define cx_attr_printf(fmt_idx, arg_idx)
Attribute for printf-like functions.
Definition printf.h:48
Strings that know their length.
Structure holding the data for an allocator.
Definition allocator.h:84
The UCX string structure.
Definition string.h:51