diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-14 11:32:34 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-14 23:56:16 -0500 |
commit | f6c719d7ec71cc7771c46d3daa390924a3871ba3 (patch) | |
tree | e6209f23565db01809f75067247e667963092ff6 /apps/settings_list.c | |
parent | b25a9d8f99b75570d18ea64602de7fe48da612d6 (diff) | |
download | rockbox-f6c719d7ec71cc7771c46d3daa390924a3871ba3.tar.gz rockbox-f6c719d7ec71cc7771c46d3daa390924a3871ba3.zip |
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
Diffstat (limited to 'apps/settings_list.c')
-rw-r--r-- | apps/settings_list.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/settings_list.c b/apps/settings_list.c index f54738163a..f733ee4f69 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -624,11 +624,11 @@ static char* qs_write_to_cfg(void* setting, char*buf, int buf_len) | |||
624 | int index = *(int*)setting; | 624 | int index = *(int*)setting; |
625 | if (index < 0 || index >= nb_settings) | 625 | if (index < 0 || index >= nb_settings) |
626 | { | 626 | { |
627 | strlcpy(buf, "-", buf_len); | 627 | strmemccpy(buf, "-", buf_len); |
628 | return buf; | 628 | return buf; |
629 | } | 629 | } |
630 | const struct settings_list *var = &settings[index]; | 630 | const struct settings_list *var = &settings[index]; |
631 | strlcpy(buf, var->cfg_name, buf_len); | 631 | strmemccpy(buf, var->cfg_name, buf_len); |
632 | return buf; | 632 | return buf; |
633 | } | 633 | } |
634 | static bool qs_is_changed(void* setting, void* defaultval) | 634 | static bool qs_is_changed(void* setting, void* defaultval) |