Skip to content

Allocating variants of sprintf

Notifications You must be signed in to change notification settings

promsize/msprintf

Repository files navigation

Allocating versions of sprintf

A simple clib library providing variants of sprintf().

It aims to be compatible with libc conventions.

Features

  • Uses attributes for compile-time format string checking
  • Variants with returned results (M ~= malloc)
  • Variants with output parameters (A ~= allocating)
  • Variants with string length limit (N ~= limited)

Functions provided

#include <msprintf.h>
extern int vasnprintf(char **out, size_t limit, const char *fmt, va_list a);
extern int asnprintf(char **out, size_t limit, const char *fmt, ...);
#ifdef MISSING_ASPRINTF
extern int vasprintf(char **out, const char *fmt, va_list a);
extern int asprintf(char **out, const char *fmt, ...);
#endif
extern char *vmsnprintf(size_t limit, const char *fmt, va_list a);
extern char *msnprintf(size_t limit, const char *fmt, ...);
extern char *vmsprintf(const char *fmt, va_list a);
extern char *msprintf(const char *fmt, ...);

Releases

No releases published