mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +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)
|
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[1024];
|
||||||
char *path = (char *)alloca(pathlen);
|
snprintf(path, sizeof(path), "%s/%s/%s", base, node, key);
|
||||||
if (!path)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
snprintf(path, pathlen, "%s/%s/%s", base, node, key);
|
|
||||||
return open(path, O_RDONLY);
|
return open(path, O_RDONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user