Mercurial > hg > th-libs
changeset 528:337118002dd6
Move printf altfmt functions to more logical place.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 28 Dec 2019 09:54:57 +0200 |
parents | d6b64ba5e6ea |
children | c44ebf5b08fd |
files | th_string.c |
diffstat | 1 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- 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;