X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/776d2da28318443431563b68c2807eb0c29c49fa..3618811496a6d131fd4bffa19e262c521d39e819:/struct/dstr-putf.c?ds=sidebyside diff --git a/struct/dstr-putf.c b/struct/dstr-putf.c index e097968..270f9a3 100644 --- a/struct/dstr-putf.c +++ b/struct/dstr-putf.c @@ -47,6 +47,7 @@ #include "darray.h" #include "dstr.h" +#include "macros.h" /*----- Tunable constants -------------------------------------------------*/ @@ -247,7 +248,7 @@ int dstr_vputf(dstr *d, const char *p, va_list *ap) done_flags: i = 0; - while (isdigit((unsigned char)*p)) i = 10*i + *p++ - '0'; + while (ISDIGIT(*p)) i = 10*i + *p++ - '0'; /* --- Snag: this might have been an argument position indicator --- */ @@ -269,11 +270,11 @@ int dstr_vputf(dstr *d, const char *p, va_list *ap) fs->wd = i; } else if (*p == '*') { p++; - if (!isdigit((unsigned char)*p)) + if (!ISDIGIT(*p)) i = anext++; else { i = *p++ - '0'; - while (isdigit((unsigned char)*p)) i = 10*i + *p++ - '0'; + while (ISDIGIT(*p)) i = 10*i + *p++ - '0'; assert(*p == '$'); p++; assert(i > 0); i--; } @@ -286,19 +287,19 @@ int dstr_vputf(dstr *d, const char *p, va_list *ap) if (*p == '.') { p++; f |= f_prec; - if (isdigit((unsigned char)*p)) { + if (ISDIGIT(*p)) { i = *p++ - '0'; - while (isdigit((unsigned char)*p)) i = 10*i + *p++ - '0'; + while (ISDIGIT(*p)) i = 10*i + *p++ - '0'; fs->prec = i; } else if (*p != '*') fs->prec = 0; else { p++; - if (!isdigit((unsigned char)*p)) + if (!ISDIGIT(*p)) i = anext++; else { i = *p++ - '0'; - while (isdigit((unsigned char)*p)) i = 10*i + *p++ - '0'; + while (ISDIGIT(*p)) i = 10*i + *p++ - '0'; assert(*p == '$'); p++; assert(i > 0); i--; }