[U-Boot-Users] [PATCH] Remove code duplication for setting the default environment

Wolfgang Denk wd at denx.de
Sun Jul 6 20:57:34 CEST 2008


In message <20080706170626.GH20299 at prithivi.gnumonks.org> you wrote:
> 
> +void default_env(void)
> +{
> +	if (sizeof(default_environment) > ENV_SIZE)
> +	{
> +		puts ("*** Error - default environment is too large\n\n");
> +		return;
> +	}

Incorrect brace style.



> +	memset (env_ptr, 0, sizeof(env_t));
> +	memcpy (env_ptr->data,
> +		default_environment,
> +		sizeof(default_environment));

Put on one line ?

> --- u-boot.orig/common/env_common.c
> +++ u-boot/common/env_common.c
...
> -		if (sizeof(default_environment) > ENV_SIZE)
...
> --- u-boot.orig/common/env_nand.c
> +++ u-boot/common/env_nand.c
...
> -	if (default_environment_size > CFG_ENV_SIZE){

Looks like a sleeping bug to me...


> +void default_env(void);

Please name "set_default_env()".


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
Genitiv ins Wasser, weil's Dativ ist!




More information about the U-Boot mailing list