> +static int format_decode(const char *fmt, enum format_type *type, int *flags,
> + int *field_width, int *base, int *precision,
> + int *qualifier)
To> + int *field_width, int *base, int *precision,
> + int *qualifier)
struct printf_spec {
enum format_type type;
int flags, field_width, base, precision, qualifier;
};
and then pass things around like
static int format_decode(const char *fmt, struct printf_spec *spec)
{
..
I suspect it would make the code look nicer too (instead of doing
"*base = x", you'd see "spec->base = x" and it would look less like
line noise in the callee, an the caller could justdo a single "struct
format_spec spec = { 0, }" to initialize that thing).
0 评论: (+add yours?)
Post a Comment