mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(platform_linux) Get rid of alloca usage
This commit is contained in:
parent
87ece39443
commit
33d4612716
@ -39,12 +39,8 @@ static const char *proc_acpi_ac_adapter_path = "/proc/acpi/ac_adapter";
|
||||
|
||||
static int open_acpi_file(const char *base, const char *node, const char *key)
|
||||
{
|
||||
const size_t pathlen = strlen(base) + strlen(node) + strlen(key) + 3;
|
||||
char *path = (char *)alloca(pathlen);
|
||||
if (!path)
|
||||
return -1;
|
||||
|
||||
snprintf(path, pathlen, "%s/%s/%s", base, node, key);
|
||||
char path[1024];
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", base, node, key);
|
||||
return open(path, O_RDONLY);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user