Patchwork [U-Boot,v2,05/23] stdio: remove useless strncpy

login
register
mail settings
Submitter Simon Glass
Date Nov. 22, 2012, 7:12 p.m.
Message ID <1353611587-18186-6-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/201151/
State Superseded, archived
Headers show

Comments

Simon Glass - Nov. 22, 2012, 7:12 p.m.
From: Vincent Palatin <vpalatin@chromium.org>

The name is already copied when we memcpy() the whole structure.

This is because struct stdio_dev has this field:

	char	name[16];		/* Device name				*/

So the data is inline, rather than being a pointer.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Add more comments to the stdio strncpy commit message

 common/stdio.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Patch

diff --git a/common/stdio.c b/common/stdio.c
index 605ff3f..c7a323f 100644
--- 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);
 
 	return _dev;
 }