From 5f11a6119a2223fc7e3d81bc072fe64294fce39b Mon Sep 17 00:00:00 2001 From: kugel Date: Tue, 20 Oct 2009 00:09:16 +0000 Subject: [PATCH] Use strlcpy instead of a memset&strcpy combo. Guarantees \0-terminaltion and gives a 1-3% speed up. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23284 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-bitmap-common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index 3495e0496..26491e78e 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c @@ -262,8 +262,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, s->start_tick = current_tick + LCDFN(scroll_info).delay; s->style = style; - memset(s->line, 0, sizeof s->line); - strcpy(s->line, string); + strlcpy(s->line, string, sizeof s->line); /* get width */ s->width = LCDFN(getstringsize)(s->line, &w, &h); -- 2.11.4.GIT