Remove rarch_get_cpu_architecture_string - don't have two

functions that do more or less the same thing
This commit is contained in:
twinaphex 2020-01-27 22:51:20 +01:00
parent eb4e365820
commit 4d36f0d356
7 changed files with 29 additions and 63 deletions

View File

@ -400,47 +400,46 @@ enum frontend_architecture frontend_driver_get_cpu_architecture(void)
return frontend->get_architecture();
}
void frontend_driver_get_cpu_architecture_str(
char *frontend_architecture, size_t size)
const void *frontend_driver_get_cpu_architecture_str(
char *architecture, size_t size)
{
const frontend_ctx_driver_t
*frontend = frontend_get_ptr();
enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
char architecture[PATH_MAX_LENGTH];
switch (arch)
{
case FRONTEND_ARCH_X86:
strlcpy(architecture, "x86", sizeof(architecture));
strlcpy(architecture, "x86", size);
break;
case FRONTEND_ARCH_X86_64:
strlcpy(architecture, "x64", sizeof(architecture));
strlcpy(architecture, "x64", size);
break;
case FRONTEND_ARCH_PPC:
strlcpy(architecture, "PPC", sizeof(architecture));
strlcpy(architecture, "PPC", size);
break;
case FRONTEND_ARCH_ARM:
strlcpy(architecture, "ARM", sizeof(architecture));
strlcpy(architecture, "ARM", size);
break;
case FRONTEND_ARCH_ARMV7:
strlcpy(architecture, "ARMv7", sizeof(architecture));
strlcpy(architecture, "ARMv7", size);
break;
case FRONTEND_ARCH_ARMV8:
strlcpy(architecture, "ARMv8", sizeof(architecture));
strlcpy(architecture, "ARMv8", size);
break;
case FRONTEND_ARCH_MIPS:
strlcpy(architecture, "MIPS", sizeof(architecture));
strlcpy(architecture, "MIPS", size);
break;
case FRONTEND_ARCH_TILE:
strlcpy(architecture, "Tilera", sizeof(architecture));
strlcpy(architecture, "Tilera", size);
break;
case FRONTEND_ARCH_NONE:
default:
strlcpy(architecture, "N/A", sizeof(architecture));
strlcpy(architecture, "N/A", size);
break;
}
snprintf(frontend_architecture, size, "%s %s",
frontend->ident, architecture);
return frontend;
}
uint64_t frontend_driver_get_total_memory(void)

View File

@ -172,7 +172,7 @@ void frontend_driver_free(void);
enum frontend_architecture frontend_driver_get_cpu_architecture(void);
void frontend_driver_get_cpu_architecture_str(
const void *frontend_driver_get_cpu_architecture_str(
char *frontend_architecture, size_t size);
environment_get_t frontend_driver_environment_get_ptr(void);

View File

@ -460,7 +460,8 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CPU_ARCHITECTURE),
sizeof(cpu_text_str));
rarch_get_cpu_architecture_string(cpu_arch_str, sizeof(cpu_arch_str));
frontend_driver_get_cpu_architecture_str(
cpu_arch_str, sizeof(cpu_arch_str));
snprintf(cpu_str, sizeof(cpu_str), "%s %s", cpu_text_str, cpu_arch_str);

View File

@ -300,9 +300,14 @@ bool netplay_lan_ad_server(netplay_t *netplay)
{
char *p;
char sub[NETPLAY_HOST_STR_LEN];
char frontend_tmp[NETPLAY_HOST_STR_LEN];
char frontend[NETPLAY_HOST_STR_LEN];
const frontend_ctx_driver_t *frontend_drv =
(const frontend_ctx_driver_t*)
frontend_driver_get_cpu_architecture_str(
frontend, sizeof(frontend));
frontend_tmp, sizeof(frontend_tmp));
snprintf(frontend, sizeof(frontend), "%s %s",
frontend_drv->ident, frontend_tmp);
p=strrchr(reply_addr,'.');
if (p)

View File

@ -811,6 +811,8 @@ static void netplay_announce(void)
{
char buf[4600];
char frontend_architecture[PATH_MAX_LENGTH];
char frontend_architecture_tmp[PATH_MAX_LENGTH];
const frontend_ctx_driver_t *frontend_drv = NULL;
char url[2048] = "http://lobby.libretro.com/add/";
char *username = NULL;
char *corename = NULL;
@ -847,8 +849,11 @@ static void netplay_announce(void)
net_http_urlencode(&subsystemname, "N/A");
}
frontend_driver_get_cpu_architecture_str(
frontend_architecture, sizeof(frontend_architecture));
frontend_drv =
(const frontend_ctx_driver_t*)frontend_driver_get_cpu_architecture_str(
frontend_architecture_tmp, sizeof(frontend_architecture_tmp));
snprintf(frontend_architecture, sizeof(frontend_architecture), "%s %s",
frontend_drv->ident, frontend_architecture_tmp);
#ifdef HAVE_DISCORD
if(discord_is_ready())

View File

@ -27848,48 +27848,6 @@ void retroarch_force_video_driver_fallback(const char *driver)
exit(1);
}
void rarch_get_cpu_architecture_string(char *cpu_arch_str, size_t len)
{
enum frontend_architecture arch = frontend_driver_get_cpu_architecture();
if (!cpu_arch_str || !len)
return;
switch (arch)
{
case FRONTEND_ARCH_X86:
strlcpy(cpu_arch_str, "x86", len);
break;
case FRONTEND_ARCH_X86_64:
strlcpy(cpu_arch_str, "x64", len);
break;
case FRONTEND_ARCH_PPC:
strlcpy(cpu_arch_str, "PPC", len);
break;
case FRONTEND_ARCH_ARM:
strlcpy(cpu_arch_str, "ARM", len);
break;
case FRONTEND_ARCH_ARMV7:
strlcpy(cpu_arch_str, "ARMv7", len);
break;
case FRONTEND_ARCH_ARMV8:
strlcpy(cpu_arch_str, "ARMv8", len);
break;
case FRONTEND_ARCH_MIPS:
strlcpy(cpu_arch_str, "MIPS", len);
break;
case FRONTEND_ARCH_TILE:
strlcpy(cpu_arch_str, "Tilera", len);
break;
case FRONTEND_ARCH_NONE:
default:
strlcpy(cpu_arch_str,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE),
len);
break;
}
}
void rarch_log_file_init(void)
{
char log_directory[PATH_MAX_LENGTH];

View File

@ -386,8 +386,6 @@ struct retro_system_info *runloop_get_libretro_system_info(void);
void retroarch_force_video_driver_fallback(const char *driver);
void rarch_get_cpu_architecture_string(char *cpu_arch_str, size_t len);
void rarch_log_file_init(void);
void rarch_log_file_deinit(void);