mirror of
https://github.com/libretro/RetroArch
synced 2025-02-10 21:40:22 +00:00
(core_info.c) Use fill_pathname where we can
This commit is contained in:
parent
bd413de842
commit
e081bde064
50
core_info.c
50
core_info.c
@ -1497,18 +1497,15 @@ static bool core_info_path_is_locked(
|
||||
core_aux_file_path_list_t *lock_list,
|
||||
const char *core_file_name)
|
||||
{
|
||||
size_t i, len;
|
||||
size_t i;
|
||||
uint32_t hash;
|
||||
char lock_filename[NAME_MAX_LENGTH];
|
||||
|
||||
if (lock_list->size < 1)
|
||||
return false;
|
||||
|
||||
len = strlcpy(lock_filename, core_file_name,
|
||||
sizeof(lock_filename));
|
||||
strlcpy(lock_filename + len,
|
||||
".lck",
|
||||
sizeof(lock_filename) - len);
|
||||
fill_pathname(lock_filename, core_file_name,
|
||||
".lck", sizeof(lock_filename));
|
||||
|
||||
hash = core_info_hash_string(lock_filename);
|
||||
|
||||
@ -1528,18 +1525,15 @@ static bool core_info_path_is_standalone_exempt(
|
||||
core_aux_file_path_list_t *exempt_list,
|
||||
const char *core_file_name)
|
||||
{
|
||||
size_t i, len;
|
||||
size_t i;
|
||||
uint32_t hash;
|
||||
char exempt_filename[NAME_MAX_LENGTH];
|
||||
|
||||
if (exempt_list->size < 1)
|
||||
return false;
|
||||
|
||||
len = strlcpy(exempt_filename, core_file_name,
|
||||
sizeof(exempt_filename));
|
||||
strlcpy(exempt_filename + len,
|
||||
".lsae",
|
||||
sizeof(exempt_filename) - len);
|
||||
fill_pathname(exempt_filename, core_file_name,
|
||||
".lsae", sizeof(exempt_filename));
|
||||
|
||||
hash = core_info_hash_string(exempt_filename);
|
||||
|
||||
@ -2912,7 +2906,6 @@ static bool core_info_update_core_aux_file(const char *path, bool create)
|
||||
* core info list this is *not* thread safe */
|
||||
bool core_info_set_core_lock(const char *core_path, bool lock)
|
||||
{
|
||||
size_t _len;
|
||||
core_info_t *core_info = NULL;
|
||||
char lock_file_path[PATH_MAX_LENGTH];
|
||||
|
||||
@ -2931,11 +2924,8 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
|
||||
return false;
|
||||
|
||||
/* Get lock file path */
|
||||
_len = strlcpy(lock_file_path, core_info->path,
|
||||
sizeof(lock_file_path));
|
||||
strlcpy(lock_file_path + _len,
|
||||
".lck",
|
||||
sizeof(lock_file_path) - _len);
|
||||
fill_pathname(lock_file_path, core_info->path,
|
||||
".lck", sizeof(lock_file_path));
|
||||
|
||||
/* Create or delete lock file, as required */
|
||||
if (!core_info_update_core_aux_file(lock_file_path, lock))
|
||||
@ -2959,7 +2949,6 @@ bool core_info_set_core_lock(const char *core_path, bool lock)
|
||||
* must be checked externally */
|
||||
bool core_info_get_core_lock(const char *core_path, bool validate_path)
|
||||
{
|
||||
size_t _len;
|
||||
core_info_t *core_info = NULL;
|
||||
const char *core_file_path = NULL;
|
||||
bool is_locked = false;
|
||||
@ -2990,11 +2979,8 @@ bool core_info_get_core_lock(const char *core_path, bool validate_path)
|
||||
return false;
|
||||
|
||||
/* Get lock file path */
|
||||
_len = strlcpy(lock_file_path, core_file_path,
|
||||
sizeof(lock_file_path));
|
||||
strlcpy(lock_file_path + _len,
|
||||
".lck",
|
||||
sizeof(lock_file_path) - _len);
|
||||
fill_pathname(lock_file_path, core_file_path,
|
||||
".lck", sizeof(lock_file_path));
|
||||
|
||||
/* Check whether lock file exists */
|
||||
is_locked = path_is_valid(lock_file_path);
|
||||
@ -3022,7 +3008,6 @@ bool core_info_set_core_standalone_exempt(const char *core_path, bool exempt)
|
||||
/* Static platforms do not support the contentless
|
||||
* cores menu */
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
size_t _len;
|
||||
core_info_t *core_info = NULL;
|
||||
char exempt_file_path[PATH_MAX_LENGTH];
|
||||
|
||||
@ -3034,11 +3019,8 @@ bool core_info_set_core_standalone_exempt(const char *core_path, bool exempt)
|
||||
return false;
|
||||
|
||||
/* Get 'standalone exempt' file path */
|
||||
_len = strlcpy(exempt_file_path, core_info->path,
|
||||
sizeof(exempt_file_path));
|
||||
strlcpy(exempt_file_path + _len,
|
||||
".lsae",
|
||||
sizeof(exempt_file_path) - _len);
|
||||
fill_pathname(exempt_file_path, core_info->path,
|
||||
".lsae", sizeof(exempt_file_path));
|
||||
|
||||
/* Create or delete 'standalone exempt' file, as required */
|
||||
if (core_info_update_core_aux_file(exempt_file_path, exempt))
|
||||
@ -3062,7 +3044,6 @@ bool core_info_get_core_standalone_exempt(const char *core_path)
|
||||
/* Static platforms do not support the contentless
|
||||
* cores menu */
|
||||
#if defined(HAVE_DYNAMIC)
|
||||
size_t _len;
|
||||
core_info_t *core_info = NULL;
|
||||
char exempt_file_path[PATH_MAX_LENGTH];
|
||||
|
||||
@ -3074,11 +3055,8 @@ bool core_info_get_core_standalone_exempt(const char *core_path)
|
||||
return false;
|
||||
|
||||
/* Get 'standalone exempt' file path */
|
||||
_len = strlcpy(exempt_file_path, core_info->path,
|
||||
sizeof(exempt_file_path));
|
||||
strlcpy(exempt_file_path + _len,
|
||||
".lsae",
|
||||
sizeof(exempt_file_path) - _len);
|
||||
fill_pathname(exempt_file_path, core_info->path,
|
||||
".lsae", sizeof(exempt_file_path));
|
||||
|
||||
/* Check whether 'standalone exempt' file exists */
|
||||
if (path_is_valid(exempt_file_path))
|
||||
|
Loading…
x
Reference in New Issue
Block a user