Messages in this thread | | | Date | Thu, 26 Feb 2009 19:56:35 +0100 | From | Ingo Molnar <> | Subject | Re: [PATCH 1/3] add binary printf |
| |
* Frederic Weisbecker <fweisbec@gmail.com> wrote:
> Instead of calling the in/out helper from the decoder, why not > calling the decoder from these three functions and let them > take the appropriate actions for each decoded format token? > > Naive example: > > bstr_printf() { > while (decode_format(...)) > if (type == number) > read_number_from_buf() > str = number(....) > .... > } > > vsnprintf { > while (decode_format(...)) > if (type == number) > var_arg(...) > str = number(....) > .... > } > > vbin_printf { > while (decode_format(...)) > if (type == number) > var_arg(...) > write_number_to_buffer() > ... > } > > And the standard in/out pieces can be invoked through helpers.
ok, that looks rather clean too. And maybe vsnprintf() and bstr_printf() could be further unified?
I guess it depends on how it all looks like in the end. Only one way to find out ...
Ingo
| |