diff options
| author | David Lamparter <equinox@diac24.net> | 2021-03-20 09:02:04 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2021-03-30 22:32:55 +0200 |
| commit | 3ea794305960ed9fca230c3e0f8b1b73c2915101 (patch) | |
| tree | 3c964bf671b0d98839ef158a2eadfd51606e4dbe /lib/printf/glue.c | |
| parent | 487eefcfbec8a24d639e6b8c805540d5c1fe38e8 (diff) | |
lib: put printfrr extension args into struct
... for easier extensibility. Add width, # and - flags while at it.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/printf/glue.c')
| -rw-r--r-- | lib/printf/glue.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/printf/glue.c b/lib/printf/glue.c index 477fc0d384..389f503c33 100644 --- a/lib/printf/glue.c +++ b/lib/printf/glue.c @@ -210,10 +210,10 @@ void printfrr_ext_reg(const struct printfrr_ext *ext) exts[i] = ext; } -ssize_t printfrr_extp(struct fbuf *buf, const char **fmtp, int prec, +ssize_t printfrr_extp(struct fbuf *buf, struct printfrr_eargs *ea, const void *ptr) { - const char *fmt = *fmtp; + const char *fmt = ea->fmt; const struct printfrr_ext *ext; size_t i; @@ -227,16 +227,16 @@ ssize_t printfrr_extp(struct fbuf *buf, const char **fmtp, int prec, continue; if (strncmp(ext->match, fmt, strlen(ext->match))) continue; - *fmtp += strlen(ext->match); - return ext->print_ptr(buf, fmtp, prec, ptr); + ea->fmt += strlen(ext->match); + return ext->print_ptr(buf, ea, ptr); } return -1; } -ssize_t printfrr_exti(struct fbuf *buf, const char **fmtp, int prec, +ssize_t printfrr_exti(struct fbuf *buf, struct printfrr_eargs *ea, uintmax_t num) { - const char *fmt = *fmtp; + const char *fmt = ea->fmt; const struct printfrr_ext *ext; size_t i; @@ -250,8 +250,8 @@ ssize_t printfrr_exti(struct fbuf *buf, const char **fmtp, int prec, continue; if (strncmp(ext->match, fmt, strlen(ext->match))) continue; - *fmtp += strlen(ext->match); - return ext->print_int(buf, fmtp, prec, num); + ea->fmt += strlen(ext->match); + return ext->print_int(buf, ea, num); } return -1; } |
