mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 13:14:04 +00:00
Prefer to use string_starts_with_size/string_ends_with_size (less strlen
calls)
This commit is contained in:
parent
be9b4031d9
commit
c3a1c578b6
@ -215,8 +215,8 @@ static void frontend_gx_get_env(int *argc, char *argv[],
|
|||||||
/* When using external loaders (Wiiflow, etc),
|
/* When using external loaders (Wiiflow, etc),
|
||||||
getcwd doesn't return the path correctly and as a result,
|
getcwd doesn't return the path correctly and as a result,
|
||||||
the cfg file is not found. */
|
the cfg file is not found. */
|
||||||
if (string_starts_with(argv[0], "usb1") ||
|
if ( string_starts_with_size(argv[0], "usb1", STRLEN_CONST("usb1")) ||
|
||||||
string_starts_with(argv[0], "usb2"))
|
string_starts_with_size(argv[0], "usb2", STRLEN_CONST("usb2")))
|
||||||
{
|
{
|
||||||
strcpy_literal(g_defaults.dirs[DEFAULT_DIR_CORE], "usb");
|
strcpy_literal(g_defaults.dirs[DEFAULT_DIR_CORE], "usb");
|
||||||
strlcat(g_defaults.dirs[DEFAULT_DIR_CORE], argv[0] + 4,
|
strlcat(g_defaults.dirs[DEFAULT_DIR_CORE], argv[0] + 4,
|
||||||
|
@ -1246,7 +1246,7 @@ static enum frontend_architecture frontend_unix_get_arch(void)
|
|||||||
string_is_equal(val, "armv7b")
|
string_is_equal(val, "armv7b")
|
||||||
)
|
)
|
||||||
return FRONTEND_ARCH_ARMV7;
|
return FRONTEND_ARCH_ARMV7;
|
||||||
else if (string_starts_with(val, "arm"))
|
else if (string_starts_with_size(val, "arm", STRLEN_CONST("arm")))
|
||||||
return FRONTEND_ARCH_ARM;
|
return FRONTEND_ARCH_ARM;
|
||||||
else if (string_is_equal(val, "x86_64"))
|
else if (string_is_equal(val, "x86_64"))
|
||||||
return FRONTEND_ARCH_X86_64;
|
return FRONTEND_ARCH_X86_64;
|
||||||
|
@ -141,10 +141,10 @@ static void dol_copy_raw_argv(const char *dolpath,
|
|||||||
strlcpy(cmdline, __system_argv->argv[0],
|
strlcpy(cmdline, __system_argv->argv[0],
|
||||||
strchr(__system_argv->argv[0], ':') - __system_argv->argv[0] + 2);
|
strchr(__system_argv->argv[0], ':') - __system_argv->argv[0] + 2);
|
||||||
/* a relative path */
|
/* a relative path */
|
||||||
else if (!string_starts_with(dolpath, "sd:/") &&
|
else if ( !string_starts_with_size(dolpath, "sd:/", STRLEN_CONST("sd:/"))
|
||||||
!string_starts_with(dolpath, "usb:/") &&
|
&& !string_starts_with_size(dolpath, "usb:/", STRLEN_CONST("usb:/"))
|
||||||
!string_starts_with(dolpath, "carda:/") &&
|
&& !string_starts_with_size(dolpath, "carda:/", STRLEN_CONST("carda:/"))
|
||||||
!string_starts_with(dolpath, "cardb:/"))
|
&& !string_starts_with_size(dolpath, "cardb:/", STRLEN_CONST("cardb:/")))
|
||||||
fill_pathname_parent_dir(cmdline, __system_argv->argv[0],
|
fill_pathname_parent_dir(cmdline, __system_argv->argv[0],
|
||||||
PATH_MAX_LENGTH);
|
PATH_MAX_LENGTH);
|
||||||
/* fullpath */
|
/* fullpath */
|
||||||
|
@ -12213,8 +12213,8 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
|
|||||||
* a single instance where this case is met... */
|
* a single instance where this case is met... */
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
||||||
|
|
||||||
if ( string_starts_with(info->path, "content_")
|
if ( string_starts_with_size(info->path, "content_", STRLEN_CONST("content_"))
|
||||||
&& string_ends_with(info->path, ".lpl"))
|
&& string_ends_with_size(info->path, ".lpl", strlen(info->path), STRLEN_CONST(".lpl")))
|
||||||
{
|
{
|
||||||
if (string_is_equal(info->path,
|
if (string_is_equal(info->path,
|
||||||
FILE_PATH_CONTENT_HISTORY))
|
FILE_PATH_CONTENT_HISTORY))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user