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.
This commit is contained in:
parent
282a7ff1f3
commit
58256c917e
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <psx.h>
|
#include <psx.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.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)
|
if(strncmp(path, "cdromL:", 7) == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef PSXSDK_CDROML_ENABLED
|
||||||
s = malloc(1024);
|
s = malloc(1024);
|
||||||
|
|
||||||
if(libc_get_transtbl_fname(path+7, s, 1024) == 0)
|
if(libc_get_transtbl_fname(path+7, s, 1024) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
fd = open(s, fmode_to_desmode(mode));
|
fd = open(s, fmode_to_desmode(mode));
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fd = open(path, fmode_to_desmode(mode));
|
fd = open(path, fmode_to_desmode(mode));
|
||||||
|
|
Loading…
Reference in New Issue