[U-Boot] [PATCH v4 06/13] Replace space and tab checks with isblank
Jason Hobbs
jason.hobbs at calxeda.com
Wed Aug 24 17:56:47 CEST 2011
On Tue, Aug 23, 2011 at 05:42:59PM -0400, Mike Frysinger wrote:
> On Tuesday, August 23, 2011 17:06:54 Jason Hobbs wrote:
> > - while (*nn == ' ' || *nn == '\t')
> > + while (isblank(*nn))
> > nn++;
>
> at least for these "walking forward" ones, they could be replaced with:
> nn += strspn(nn, " \t");
> -mike
Sure, and we'd pick up the use of a currently unused function which
might otherwise get optimized away with linker garbage collection. Even
without taking garbage collection of strspn into account, switching one
of the "walkahead while isblank" lines in my tree to the strspn pattern
inceases my binary size by 11 bytes - two of them inceases it by 31
bytes. There's also the extra overhead for the function call and
strspn's local variables. I'd consider it if strspn was more readable (I
don't think it is), or there was some cost to adding the isblank macro
(there isn't, as it's replacing existing code that was doing the same
thing).
Jason
More information about the U-Boot
mailing list