mirror of
https://github.com/libretro/RetroArch
synced 2025-02-15 00:40:06 +00:00
(file_path.c) Do away with trivial strlen checks (checked if
return number was <= 2/>= 2, instead check first two characters of the string directly instead for NULL
This commit is contained in:
parent
7ff58265bf
commit
ba35f0de93
@ -526,8 +526,8 @@ void fill_str_dated_filename(char *out_filename,
|
||||
void path_basedir(char *path)
|
||||
{
|
||||
char *last = NULL;
|
||||
|
||||
if (strlen(path) < 2)
|
||||
/* was strlen(path) < 2 before */
|
||||
if (!path || path[0] == '\0' || path[1] == '\0')
|
||||
return;
|
||||
|
||||
if ((last = find_last_slash(path)))
|
||||
@ -805,8 +805,15 @@ size_t path_relative_to(char *out,
|
||||
|
||||
#ifdef _WIN32
|
||||
/* For different drives, return absolute path */
|
||||
if (strlen(path) >= 2 && strlen(base) >= 2
|
||||
&& path[1] == ':' && base[1] == ':'
|
||||
if (
|
||||
path
|
||||
&& base
|
||||
&& path[0] != '\0'
|
||||
&& path[1] != '\0' /* was strlen(path) >= 2 before */
|
||||
&& base[0] != '\0'
|
||||
&& base[1] != '\0' /* was strlen(base) >= 2 before */
|
||||
&& path[1] == ':'
|
||||
&& base[1] == ':'
|
||||
&& path[0] != base[0])
|
||||
return strlcpy(out, path, size);
|
||||
#endif
|
||||
@ -1151,7 +1158,8 @@ void fill_pathname_abbreviated_or_relative(char *out_path, const char *in_refpat
|
||||
void path_basedir_wrapper(char *path)
|
||||
{
|
||||
char *last = NULL;
|
||||
if (strlen(path) < 2)
|
||||
/* was strlen(path) < 2 before */
|
||||
if (!path || path[0] == '\0' || path[1] == '\0')
|
||||
return;
|
||||
|
||||
#ifdef HAVE_COMPRESSION
|
||||
|
Loading…
x
Reference in New Issue
Block a user