From f6c719d7ec71cc7771c46d3daa390924a3871ba3 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 14 Nov 2022 11:32:34 -0500 Subject: replace strlcpy with strmemccpy replace applicable calls to strlcpy with calls to strmemccpy which null terminates on truncation in theory the strmemccpy calls should be slightly faster since they don't traverse the rest of the source string on truncation but I seriously doubt there is too much of that going on in the code base Change-Id: Ia0251514e36a6242bbf3f03c5e0df123aba60ed2 --- apps/screens.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'apps/screens.c') diff --git a/apps/screens.c b/apps/screens.c index 9191922c31..db24e534c1 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -20,7 +20,7 @@ ****************************************************************************/ #include -#include +#include #include #include #include "backlight.h" @@ -562,8 +562,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, if (!id3->comment) return NULL; - if (!memccpy (buffer, id3->comment, '\0', buffer_len)) - buffer[buffer_len - 1] = '\0'; + strmemccpy(buffer, id3->comment, buffer_len); val=buffer; if(say_it && val) @@ -612,8 +611,7 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, if (id3->codectype >= AFMT_NUM_CODECS) return NULL; - if (!memccpy (buffer, audio_formats[id3->codectype].label, '\0', buffer_len)) - buffer[buffer_len - 1] = '\0'; + strmemccpy(buffer, audio_formats[id3->codectype].label, buffer_len); val=buffer; if(say_it) -- cgit v1.2.3