public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC 0/2 v2] Remove CONFIG_SYS_MAXARGS
@ 2010-03-12 19:25 John Schmoller
  2010-03-12 19:25 ` [U-Boot] [RFC 1/2 v2] cmd: " John Schmoller
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: John Schmoller @ 2010-03-12 19:25 UTC (permalink / raw)
  To: u-boot

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.

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.

Changes since v1:
 - Made 2/2 a subset of the changes of the real patch so it can be submitted
 to the mailing list and isn't too large.
 - Found a change in 2/2 that should have been in 1/2.

John Schmoller (2):
  cmd: Remove CONFIG_SYS_MAXARGS
  command: Remove maxargs from command structure

 board/amcc/makalu/cmd_pll.c                   |    2 +-
 board/esd/du440/du440.c                       |    4 +-
 board/fads/fads.h                             |    1 -
 board/freescale/common/pixis.c                |    4 +-
 board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c |    2 +-
 board/pxa255_idp/pxa_idp.c                    |    2 +-
 common/cmd_boot.c                             |    2 +-
 common/cmd_bootm.c                            |    4 +-
 common/cmd_diag.c                             |    2 +-
 common/cmd_display.c                          |    2 +-
 common/cmd_echo.c                             |    2 +-
 common/cmd_eeprom.c                           |    7 +-
 common/cmd_elf.c                              |   18 ++++--
 common/cmd_help.c                             |    4 +-
 common/cmd_i2c.c                              |   75 +++++++++---------------
 common/cmd_mp.c                               |    2 +-
 common/cmd_nand.c                             |    2 +-
 common/cmd_nvedit.c                           |    8 +-
 common/cmd_onenand.c                          |    2 +-
 common/cmd_test.c                             |    6 +-
 common/command.c                              |   37 ++-----------
 common/hush.c                                 |   10 +--
 common/kgdb.c                                 |    2 +-
 common/lcd.c                                  |    5 +-
 common/main.c                                 |   58 ++++++++++++-------
 cpu/arm_cortexa8/mx51/clock.c                 |    2 +-
 cpu/mpc512x/diu.c                             |    2 +-
 cpu/mpc512x/iim.c                             |    2 +-
 include/command.h                             |   22 ++++---
 include/common.h                              |    4 +-
 30 files changed, 137 insertions(+), 158 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-04-09 22:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 19:25 [U-Boot] [RFC 0/2 v2] Remove CONFIG_SYS_MAXARGS John Schmoller
2010-03-12 19:25 ` [U-Boot] [RFC 1/2 v2] cmd: " John Schmoller
2010-03-12 19:25 ` [U-Boot] [RFC 2/2 v2] command: Remove maxargs from command structure John Schmoller
2010-03-12 20:58   ` Kim Phillips
2010-03-12 21:04     ` John Schmoller
2010-03-12 21:32       ` Kim Phillips
2010-04-09 21:04 ` [U-Boot] [RFC 0/2 v2] Remove CONFIG_SYS_MAXARGS Wolfgang Denk
2010-04-09 22:00   ` John Schmoller
2010-04-09 22:35     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox