lkml.org 
[lkml]   [2009]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2009-02-26 19:59    [W:0.080 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site