[U-Boot] [PATCH 02/31] environment, netconsole: reducing packages when printing environment variables

Stefan Roese sr at denx.de
Wed Jan 28 11:05:04 CET 2009


Hi Heiko,

On Wednesday 28 January 2009, Heiko Schocher wrote:
> Actual, do_printenv () uses putc () to print the Environment-
> variables. If using netconsole, this will result in a lot of
> packages with single characters in it. With the new config
> option CONFIG_ENV_BUFFER_PRINT do_printenv () uses now puts ()
> to print a complete Environmentvariable, so the number of
> packages when using netconsole are reduced.

Wouldn't it make sense to use this new code (in the CONFIG_ENV_BUFFER_PRINT 
sections) unconditionally instead of the old version? The source would look 
nicer and the resulting image probably smaller.

Some nitpicking comments below.

> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
>  common/cmd_nvedit.c      |    8 ++++++++
>  include/configs/mgcoge.h |    1 +
>  include/configs/mgsuvd.h |    1 +
>  3 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
> index 85025da..8f6310a 100644
> --- a/common/cmd_nvedit.c
> +++ b/common/cmd_nvedit.c
> @@ -89,8 +89,12 @@ int do_printenv (cmd_tbl_t *cmdtp, int flag, int argc,
> char *argv[]) for (i=0; env_get_char(i) != '\0'; i=nxt+1) {
>  			for (nxt=i; env_get_char(nxt) != '\0'; ++nxt)
>  				;
> +#if defined(CONFIG_ENV_BUFFER_PRINT)
> +			puts ((char *)( env_get_addr(nxt) + 1));

Please stick with one coding-style rule, either "func ()" or "func()". Since 
this file already uses the "func()" style I suggest to use this version.

> +#else
>  			for (k=i; k<nxt; ++k)
>  				putc(env_get_char(k));
> +#endif
>  			putc  ('\n');

Why not fold this "putc()" into the puts() above (replace it with printf)?

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================


More information about the U-Boot mailing list