# HG changeset patch # User Matti Hamalainen # Date 1578908487 -7200 # Node ID 31720ede4b50e888deb08ba1056c3e7890d9ca6e # Parent 1a33088e7fa901a482face5b7747aec0e50637ce Reorganize th_string.h header slightly. diff -r 1a33088e7fa9 -r 31720ede4b50 th_string.h --- a/th_string.h Mon Jan 13 11:41:06 2020 +0200 +++ b/th_string.h Mon Jan 13 11:41:27 2020 +0200 @@ -88,6 +88,20 @@ typedef int (*th_vprintf_putch)(th_vprintf_ctx *ctx, const char ch); +/** @def Internal *printf() implementation helper function typedef + * for alternative formatting, such as octal and hexadecimal + */ +typedef char * (*th_vprintf_altfmt_func)( + const char *buf, const size_t len, const int vret, int *prec, int *flags, int *outlen); + +#define TH_VPRINTF_ALTFMT_FUNC(fname) char * fname ( \ + const char *buf, const size_t len, const int vret, int *prec, int *flags, int *outlen) + + +TH_VPRINTF_ALTFMT_FUNC(th_vprintf_altfmt_oct); +TH_VPRINTF_ALTFMT_FUNC(th_vprintf_altfmt_hex); + + /* Normal NUL-terminated string functions */ char *th_strdup(const char *src); @@ -125,13 +139,6 @@ /* Internal printf() implementation. NOTICE! This API may be unstable. */ -#define TH_VPRINTF_ALTFMT_FUNC(fname) char * fname ( \ - const char *buf, const size_t len, const int vret, int *prec, int *flags, int *outlen) - -typedef char * (*th_vprintf_altfmt_func)( - const char *buf, const size_t len, const int vret, int *prec, int *flags, int *outlen); - - int th_vprintf_do(th_vprintf_ctx *ctx, th_vprintf_putch vputch, const char *fmt, va_list ap); int th_vprintf_put_str(th_vprintf_ctx *ctx, th_vprintf_putch vputch, @@ -146,10 +153,6 @@ BOOL f_neg, BOOL f_unsig, th_vprintf_altfmt_func f_alt); -TH_VPRINTF_ALTFMT_FUNC(th_vprintf_altfmt_oct); -TH_VPRINTF_ALTFMT_FUNC(th_vprintf_altfmt_hex); - - #define TH_PFUNC_NAME th_vprintf_buf_int #define TH_PFUNC_TYPE_S int #define TH_PFUNC_TYPE_U unsigned int