mirror of
https://github.com/libretro/RetroArch
synced 2025-03-14 01:19:01 +00:00
fill_pathname - one less string copy
This commit is contained in:
parent
2b94bccad2
commit
02bcbffbab
@ -329,14 +329,12 @@ bool path_is_compressed_file(const char* path)
|
||||
size_t fill_pathname(char *s, const char *in_path,
|
||||
const char *replace, size_t len)
|
||||
{
|
||||
size_t _len;
|
||||
char tmp_path[PATH_MAX_LENGTH];
|
||||
char *tok = NULL;
|
||||
strlcpy(tmp_path, in_path, sizeof(tmp_path));
|
||||
if ((tok = (char*)strrchr(path_basename(tmp_path), '.')))
|
||||
*tok = '\0';
|
||||
|
||||
_len = strlcpy(s, tmp_path, len);
|
||||
size_t _len = strlcpy(s, in_path, len);
|
||||
if ((tok = (char*)strrchr(path_basename(s), '.')))
|
||||
{
|
||||
*tok = '\0'; _len = tok - s;
|
||||
}
|
||||
_len += strlcpy(s + _len, replace, len - _len);
|
||||
return _len;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user