diff --git a/configuration.c b/configuration.c index 5382ab7337..fe670a54d8 100644 --- a/configuration.c +++ b/configuration.c @@ -2362,8 +2362,7 @@ static void save_keybind_joykey(config_file_t *conf, const char *prefix, { char key[64] = {0}; - fill_pathname_join_delim(key, prefix, base, '_', sizeof(key)); - strlcat(key, "_btn", sizeof(key)); + fill_pathname_join_delim_concat(key, prefix, base, '_', "_btn", sizeof(key)); if (bind->joykey == NO_BTN) { @@ -2383,8 +2382,10 @@ static void save_keybind_axis(config_file_t *conf, const char *prefix, unsigned axis = 0; char dir = '\0'; - fill_pathname_join_delim(key, prefix, base, '_', sizeof(key)); - strlcat(key, "_axis", sizeof(key)); + fill_pathname_join_delim_concat(key, + prefix, base, '_', + "_axis", + sizeof(key)); if (bind->joyaxis == AXIS_NONE) { diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 0df7d7a701..d89fe1d450 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -643,6 +643,14 @@ void fill_pathname_join_delim(char *out_path, const char *dir, retro_assert(strlcat(out_path, path, size) < size); } +void fill_pathname_join_delim_concat(char *out_path, const char *dir, + const char *path, const char delim, const char *concat, + size_t size) +{ + fill_pathname_join_delim(out_path, dir, path, delim, size); + strlcat(out_path, concat, size); +} + /** * fill_short_pathname_representation: * @out_rep : output representation diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index 8dfe333af2..ea97375285 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -349,6 +349,10 @@ void fill_string_concat(char *out_path, void fill_pathname_join_delim(char *out_path, const char *dir, const char *path, const char delim, size_t size); +void fill_pathname_join_delim_concat(char *out_path, const char *dir, + const char *path, const char delim, const char *concat, + size_t size); + /** * fill_short_pathname_representation: * @out_rep : output representation