[U-Boot] [PATCH 05/17] stdio: remove useless strncpy

Wolfgang Denk wd at denx.de
Sat Nov 3 16:31:33 CET 2012


Dear Simon Glass,

In message <1351902453-27956-6-git-send-email-sjg at chromium.org> you wrote:
> From: Vincent Palatin <vpalatin at chromium.org>
> 
> The name is already copied when we memopy the whole structure.

memopy?

> --- a/common/stdio.c
> +++ b/common/stdio.c
> @@ -135,7 +135,6 @@ struct stdio_dev* stdio_clone(struct stdio_dev *dev)
>  		return NULL;
>  
>  	memcpy(_dev, dev, sizeof(struct stdio_dev));
> -	strncpy(_dev->name, dev->name, 16);

_dev contains just the pointer, not the data, so why can we omit
copying the data?

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 is better for civilization to be going down the drain than to  be
coming up it."                                          - Henry Allen


More information about the U-Boot mailing list