[U-Boot] [RFC 0/2] Remove CONFIG_SYS_MAXARGS

Wolfgang Denk wd at denx.de
Fri Mar 12 18:12:25 CET 2010


Dear John Schmoller,

In message <cover.1268408350.git.jschmoller at xes-inc.com> you wrote:
> The first patch removes CONFIG_SYS_MAXARGS, replacing the staticly defined
> array with a malloc'd array of the appropriate size. When a function has no
> upper argument limit (ie, was set to CONFIG_SYS_MAXARGS), it is now set to 0
> to indicate this fact.  Argument count is now unlimited, within reason and
> malloc buffer size.
> 
> The second patch removes cmdtp->maxargs and moves the checks to the individual
> command functions.  Since most functions do bounds checking anyway, it's a
> a fairly cheap task (sometimes free) to remove this bounds check in
> common/main.c.  In addition, it's more intuitive (in my opinion) if all bounds
> checking is done in only one place for each function.  The second patch also
> creates a CMD_ERR_USAGE return value, which prints usage when returned.  The
> overall effect of this patch is to reduce code size by an average of 200-250
> bytes and, I feel, make things a bit cleaner.

Hm... I would have expected that the code grows... Interesting...

> I'm looking for comments on these two patches as they are quite invasive, and
> will definitly cause problems for those people who maintain their own code
> out-of-tree.  They may also require an additional amount of testing.
> 
> John Schmoller (2):
>   cmd: Remove CONFIG_SYS_MAXARGS
>   command: Remove maxargs from command structure

This patch is way too big for the maximim list size. For the
purpose of discussing the implementation we probably don;t need to see
all changes to all affected iles - the interesting parts are the
header files, the common files like  common/command.c,  common/hush.c,
common/kgdb.c,  common/lcd.c, common/main.c,  and say a few (3...5) co
the commands (common/cmd_*.c).  That should give us enough context to
review the code.

Of course you can (additionally) put the full patch on some server so
we can actually test it...

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It all seemed, he thought, to be rather a lot of  trouble  to  go  to
just sharpen a razor blade.  - Terry Pratchett, _The Light Fantastic_


More information about the U-Boot mailing list