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/radio/presets.c | 4 ++-- apps/radio/radioart.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'apps/radio') diff --git a/apps/radio/presets.c b/apps/radio/presets.c index 6966f7e591..1cd85637e8 100644 --- a/apps/radio/presets.c +++ b/apps/radio/presets.c @@ -225,7 +225,7 @@ void radio_load_presets(char *filename) } /* Temporary preset, loaded until player shuts down. */ else if(filename[0] == '/') - strlcpy(filepreset, filename, sizeof(filepreset)); + strmemccpy(filepreset, filename, sizeof(filepreset)); /* Preset from default directory. */ else snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", @@ -246,7 +246,7 @@ void radio_load_presets(char *filename) { struct fmstation * const fms = &presets[num_presets]; fms->frequency = f; - strlcpy(fms->name, name, MAX_FMPRESET_LEN+1); + strmemccpy(fms->name, name, MAX_FMPRESET_LEN+1); num_presets++; } } diff --git a/apps/radio/radioart.c b/apps/radio/radioart.c index 34efdea0da..230948c051 100644 --- a/apps/radio/radioart.c +++ b/apps/radio/radioart.c @@ -82,7 +82,7 @@ static int load_radioart_image(struct radioart *ra, const char* preset_name, #endif return -1; } - strlcpy(ra->name, preset_name, MAX_FMPRESET_LEN+1); + strmemccpy(ra->name, preset_name, MAX_FMPRESET_LEN+1); ra->dim.height = dim->height; ra->dim.width = dim->width; ra->last_tick = current_tick; -- cgit v1.2.3