mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-20 15:51:07 +01:00
io: Remove iodata->regular_file check.
It wasn't used, and causes an extra fstat().
This commit is contained in:
@@ -488,7 +488,6 @@ typedef struct IOStreamFDData
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
bool autoclose;
|
bool autoclose;
|
||||||
bool regular_file;
|
|
||||||
} IOStreamFDData;
|
} IOStreamFDData;
|
||||||
|
|
||||||
static int SDL_fdatasync(int fd)
|
static int SDL_fdatasync(int fd)
|
||||||
@@ -661,9 +660,6 @@ SDL_IOStream *SDL_IOFromFD(int fd, bool autoclose)
|
|||||||
iodata->fd = fd;
|
iodata->fd = fd;
|
||||||
iodata->autoclose = autoclose;
|
iodata->autoclose = autoclose;
|
||||||
|
|
||||||
struct stat st;
|
|
||||||
iodata->regular_file = ((fstat(fd, &st) == 0) && S_ISREG(st.st_mode));
|
|
||||||
|
|
||||||
SDL_IOStream *iostr = SDL_OpenIO(&iface, iodata);
|
SDL_IOStream *iostr = SDL_OpenIO(&iface, iodata);
|
||||||
if (!iostr) {
|
if (!iostr) {
|
||||||
iface.close(iodata);
|
iface.close(iodata);
|
||||||
@@ -686,7 +682,6 @@ typedef struct IOStreamStdioData
|
|||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
bool autoclose;
|
bool autoclose;
|
||||||
bool regular_file;
|
|
||||||
} IOStreamStdioData;
|
} IOStreamStdioData;
|
||||||
|
|
||||||
#ifdef HAVE_FOPEN64
|
#ifdef HAVE_FOPEN64
|
||||||
@@ -863,9 +858,6 @@ SDL_IOStream *SDL_IOFromFP(FILE *fp, bool autoclose)
|
|||||||
iodata->fp = fp;
|
iodata->fp = fp;
|
||||||
iodata->autoclose = autoclose;
|
iodata->autoclose = autoclose;
|
||||||
|
|
||||||
struct stat st;
|
|
||||||
iodata->regular_file = ((fstat(fileno(fp), &st) == 0) && S_ISREG(st.st_mode));
|
|
||||||
|
|
||||||
SDL_IOStream *iostr = SDL_OpenIO(&iface, iodata);
|
SDL_IOStream *iostr = SDL_OpenIO(&iface, iodata);
|
||||||
if (!iostr) {
|
if (!iostr) {
|
||||||
iface.close(iodata);
|
iface.close(iodata);
|
||||||
|
|||||||
Reference in New Issue
Block a user