changeset 594:31720ede4b50

Reorganize th_string.h header slightly.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 11:41:27 +0200
parents 1a33088e7fa9
children 308531ac74e7
files th_string.h
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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