Re: [PATCH v3 5/5] mtdinfo: consolidate help as display_help()

Brian Norris
2011-08-16T17:12:40Z

On Tue, Aug 16, 2011 at 12:18 AM, Brian Foster
<brian.foster@maxim-ic.com> wrote:
> On Tuesday 16 August 2011 06:00:57 Mike Frysinger wrote:
>> On Mon, Aug 15, 2011 at 13:27, Brian Norris wrote:
>> > Yes, that's what I meant...of course "strlen" is better than writing
>> > your own ARRAY_SIZE() when you already have the full C library :)
>>
>> gcc optimizes strlen("constant") into a number

I was referring to the fact that the kernel does not provide all
standard C library functions, whereas user-space does. Even so, I
overlooked the fact that the kernel has a "strlen" function
(linux/kernel.h)

>  And ‘ARRAY_SIZE(...)’, in this case, is simply ‘sizeof(...)’
>  (or, actually, ‘sizeof(...)-1’ to be equivalent to ‘strlen’).
>
>  Albeit I won't worry about the case of  strlen > 80  here,
>  I am mildly curious what the output would be if that were
>  indeed true...?

Mike's example is a little different than my patch that was just
included in mtd-utils. I don't think my version would have a problem
with strlen > 80.

>  The other thing I won't worry about is the assumption every
>  output byte in PROGRAM_NAME is a printing glyph occupying
>  exactly one cell.  That is true (in this case) ....

Not sure how often anyone needs to worry about this one...really, this
particular discussion is mostly an exercise in frivolity IMO, as I
don't see us changing the PROGRAM_NAME for mtdinfo any time soon, and
even if we did, it's not that hard to edit some whitespace.

Brian