From f98c3a0758f9cdcf11d50f6dafbf1807dd4b3b1b Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 20 Nov 2002 14:22:26 +0000 Subject: [PATCH] Use the POSIX file I/O functions instead of the high level C routines to save some overhead. Adapt to the new read conventions in modload. git-svn-id: svn://svn.cc65.org/cc65/trunk@1549 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/tgi/tgi_load.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/libsrc/tgi/tgi_load.c b/libsrc/tgi/tgi_load.c index 6446c5406..0aa57043f 100644 --- a/libsrc/tgi/tgi_load.c +++ b/libsrc/tgi/tgi_load.c @@ -33,21 +33,14 @@ -#include #include +#include #include #include #include -static unsigned char ReadInputBlock (struct mod_ctrl* C, void* Buf, unsigned Size) -{ - return (fread (Buf, 1, Size, C->callerdata) != Size); -} - - - void __fastcall__ tgi_load (unsigned char mode) /* Install the matching driver for the given mode. Will just load the driver * and check if loading was successul. Will not switch to gaphics mode. @@ -74,7 +67,7 @@ void __fastcall__ tgi_load_driver (const char* name) static const unsigned char marker[4] = { 0x74, 0x67, 0x69, 0x00 }; static struct mod_ctrl ctrl = { - ReadInputBlock /* read_block */ + read /* Read from disk */ }; unsigned Res; @@ -84,8 +77,8 @@ void __fastcall__ tgi_load_driver (const char* name) } /* Now open the file */ - ctrl.callerdata = fopen (name, "r"); - if (ctrl.callerdata == 0) { + ctrl.callerdata = open (name, O_RDONLY); + if (ctrl.callerdata < 0) { tgi_error = TGI_ERR_CANNOT_LOAD; return; } @@ -94,7 +87,7 @@ void __fastcall__ tgi_load_driver (const char* name) Res = mod_load (&ctrl); /* Close the input file */ - fclose (ctrl.callerdata); + close (ctrl.callerdata); /* Check the return code */ if (Res == MLOAD_OK) { -- 2.39.5