# HG changeset patch # User Matti Hamalainen # Date 1577519697 -7200 # Node ID 337118002dd672b02000a3dba91163e278db40e9 # Parent d6b64ba5e6ea4e1a2b96a0c63ec5545fd3980bc8 Move printf altfmt functions to more logical place. diff -r d6b64ba5e6ea -r 337118002dd6 th_string.c --- a/th_string.c Fri Dec 27 09:51:22 2019 +0200 +++ b/th_string.c Sat Dec 28 09:54:57 2019 +0200 @@ -223,6 +223,26 @@ #endif +char * th_vprintf_altfmt_oct(const char *buf, const size_t len, const int vret, const int flags) +{ + (void) vret; + (void) flags; + return (buf[len - 1] != '0') ? "0" : ""; +} + + +char * th_vprintf_altfmt_hex(const char *buf, const size_t len, const int vret, const int flags) +{ + (void) buf; + (void) vret; + (void) len; + if (vret != 0) + return (flags & TH_PF_UPCASE) ? "0X" : "0x"; + else + return ""; +} + + int th_vprintf_put_int_format(th_vprintf_ctx *ctx, th_vprintf_putch vputch, char *buf, int f_flags, int f_width, int f_prec, int f_len, int vret, BOOL f_neg, BOOL f_unsig, char *(f_alt)(const char *buf, const size_t blen, const int vret, const int flags)) @@ -398,27 +418,6 @@ #endif -char * th_vprintf_altfmt_oct(const char *buf, const size_t len, const int vret, const int flags) -{ - (void) vret; - (void) flags; - PP_PRINTF("BUF='%s', '%c'\n", buf, buf[len - 1]); - return (buf[len - 1] != '0') ? "0" : ""; -} - - -char * th_vprintf_altfmt_hex(const char *buf, const size_t len, const int vret, const int flags) -{ - (void) buf; - (void) vret; - (void) len; - if (vret != 0) - return (flags & TH_PF_UPCASE) ? "0X" : "0x"; - else - return ""; -} - - int th_vprintf_do(th_vprintf_ctx *ctx, th_vprintf_putch vputch, const char *fmt, va_list ap) { int ret = 0;