diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-10-24 02:30:55 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-10-24 02:30:59 +0200 |
| commit | 58256c917ee50d19d3c4e352480193fb21eb67b1 (patch) | |
| tree | 17d0fd7555789e476739d17d723abeea1b29d00b | |
| parent | 282a7ff1f394c6d55265110f8e4b099a63a65a01 (diff) | |
fopen_internal: do not resolve cdromL by default
This avoids calling malloc(3) and thus allowing the linker to remove
the heap implementation from memory.c via --gc-sections.
| -rw-r--r-- | libpsx/src/libc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libpsx/src/libc.c b/libpsx/src/libc.c index 59866f4..6576149 100644 --- a/libpsx/src/libc.c +++ b/libpsx/src/libc.c @@ -11,6 +11,7 @@ #include <psx.h> #include <stdio.h> +#include <stddef.h> #include <string.h> #include <stdlib.h> #include <strings.h> @@ -164,12 +165,16 @@ static FILE *fopen_internal(const char *path, const char *mode, FILE *f) if(strncmp(path, "cdromL:", 7) == 0) { +#ifdef PSXSDK_CDROML_ENABLED s = malloc(1024); if(libc_get_transtbl_fname(path+7, s, 1024) == 0) return NULL; fd = open(s, fmode_to_desmode(mode)); +#else + return NULL; +#endif } else fd = open(path, fmode_to_desmode(mode)); |
