48#define CX_PRINTF_ARGS(fmt_idx, arg_idx) \
49 __attribute__((__format__(printf, fmt_idx, arg_idx)))
113#define cx_asprintf(fmt, ...) cx_asprintf_a(cxDefaultAllocator, fmt, __VA_ARGS__)
145#define cx_vasprintf(fmt, ap) cx_vasprintf_a(cxDefaultAllocator, fmt, ap)
157#define cx_bprintf(buffer, fmt, ...) cx_fprintf((void*)buffer, cxBufferWriteFunc, fmt, __VA_ARGS__)
173#define cx_sprintf(str, len, fmt, ...) cx_sprintf_a(cxDefaultAllocator, str, len, fmt, __VA_ARGS__)
208#define cx_vsprintf(str, len, fmt, ap) cx_vsprintf_a(cxDefaultAllocator, str, len, fmt, ap)
250#define cx_sprintf_s(buf, len, str, fmt, ...) cx_sprintf_sa(cxDefaultAllocator, buf, len, str, fmt, __VA_ARGS__)
297#define cx_vsprintf_s(buf, len, str, fmt, ap) cx_vsprintf_sa(cxDefaultAllocator, buf, len, str, fmt, ap)
struct cx_allocator_s CxAllocator
High-Level type alias for the allocator type.
Definition allocator.h:80
Common definitions and feature checks.
#define CX_CSTR_ARG(idx)
No support for null_terminated_string_arg in clang or GCC below 14.
Definition common.h:211
size_t(* cx_write_func)(const void *, size_t, size_t, void *)
Function pointer compatible with fwrite-like functions.
Definition common.h:325
#define CX_EXPORT
Only used for building Windows DLLs.
Definition common.h:289
#define CX_NONNULL
All pointer arguments must be non-NULL.
Definition common.h:141
#define CX_NONNULL_ARG(...)
The specified pointer arguments must be non-NULL.
Definition common.h:146
#define CX_EXTERN
Declares a function with external linkage.
Definition common.h:297
#define CX_ACCESS_RW(...)
Specifies that the function will read and write through the given pointer.
Definition common.h:238
#define CX_PRINTF_ARGS(fmt_idx, arg_idx)
Attribute for printf-like functions.
Definition printf.h:48
int cx_vsprintf_sa(const 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.
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,...)
An 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(const 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_a(const 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.
int cx_sprintf_sa(const 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.
Strings that know their length.
struct cx_mutstr_s cxmutstr
A mutable string.
Definition string.h:74