Re: [PATCH 14/27] console: Consolidate DEBUG_LL and CONSOLE_* puts() implementations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 18, 2018 at 1:22 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
>
> On Thu, Jun 14, 2018 at 09:11:23PM -0700, Andrey Smirnov wrote:
> > Similar to previous commit, consolidate DEBUG_LL and CONSOLE_* puts()
> > implementations by putting them into a shared macro.
> >
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
> > ---
> >  include/debug_ll.h | 23 +++++++++++++++++++----
> >  lib/console.c      | 13 ++++++-------
> >  2 files changed, 25 insertions(+), 11 deletions(-)
> >
> > diff --git a/include/debug_ll.h b/include/debug_ll.h
> > index 4032ced95..4dcbd0434 100644
> > --- a/include/debug_ll.h
> > +++ b/include/debug_ll.h
> > @@ -54,6 +54,24 @@
> >               __n;                            \
> >       })
> >
> > +/**
> > + * __do_puts - Macro implementing puts()
> > + *
> > + * @__putc:  Single argument or a macro that implements putc()
> > + * @___s:    String to print
> > + *
> > + * Internal macro used to implement puts_ll() and __console_puts()
> > + */
> > +#define __do_puts(__putc, ___s)                      \
> > +     ({                                      \
> > +             const char *__s = (___s);       \
> > +             int __n = 0;                    \
> > +                                             \
> > +             while (*__s)                    \
> > +                     __n += __putc(*__s++);  \
> > +             __n;                            \
> > +     })
>
> I don't like this. It's a simple loop and there's nothing bad with it
> when the same loop is present twice in barebox. No need to dig into
> CPP here.
>

OK, will drop in v2.

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux