diff options
| -rw-r--r-- | include/mruby/ext/io.h | 19 | ||||
| -rw-r--r-- | src/file_test.c | 17 | ||||
| -rw-r--r-- | src/io.c | 18 |
3 files changed, 29 insertions, 25 deletions
diff --git a/include/mruby/ext/io.h b/include/mruby/ext/io.h index 25ca37d49..8cf2e90b0 100644 --- a/include/mruby/ext/io.h +++ b/include/mruby/ext/io.h @@ -9,22 +9,6 @@ extern "C" { #endif -#include <errno.h> - -#include <fcntl.h> - -#include <sys/types.h> -#include <sys/stat.h> -#if defined(_WIN32) || defined(_WIN64) - #include <winsock.h> -#else - #include <unistd.h> - #include <sys/wait.h> -#endif -#include <stdio.h> -#include <string.h> -#include <limits.h> - struct mrb_io { int fd; /* file descriptor */ int fd2; /* file descriptor */ @@ -43,9 +27,6 @@ struct mrb_io { #define E_IO_ERROR (mrb_class_get(mrb, "IOError")) #define E_EOF_ERROR (mrb_class_get(mrb, "EOFError")) -mrb_value mrb_open_file(mrb_state *mrb, int argc, mrb_value *argv, mrb_value io); -void fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int noraise); -mrb_value mrb_file_exist(mrb_state *mrb, mrb_value fname); mrb_value mrb_io_fileno(mrb_state *mrb, mrb_value io); #if defined(__cplusplus) diff --git a/src/file_test.c b/src/file_test.c index 37b139c78..d3dfb15ba 100644 --- a/src/file_test.c +++ b/src/file_test.c @@ -3,11 +3,10 @@ */ #include "mruby.h" - -#include "mruby/ext/io.h" #include "mruby/class.h" #include "mruby/data.h" #include "mruby/string.h" +#include "mruby/ext/io.h" #if MRUBY_RELEASE_NO < 10000 #include "error.h" @@ -15,16 +14,26 @@ #include "mruby/error.h" #endif +#include <sys/types.h> +#include <sys/stat.h> + #if defined(_WIN32) || defined(_WIN64) #define LSTAT stat + #include <winsock.h> #else #define LSTAT lstat #include <sys/file.h> + #include <sys/param.h> + #include <sys/wait.h> #include <libgen.h> #include <pwd.h> - #include <sys/param.h> + #include <unistd.h> #endif -#include <limits.h> + +#include <fcntl.h> + +#include <errno.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -3,10 +3,10 @@ */ #include "mruby.h" -#include "mruby/hash.h" #include "mruby/array.h" #include "mruby/class.h" #include "mruby/data.h" +#include "mruby/hash.h" #include "mruby/string.h" #include "mruby/variable.h" #include "mruby/ext/io.h" @@ -17,7 +17,11 @@ #include "mruby/error.h" #endif +#include <sys/types.h> +#include <sys/stat.h> + #if defined(_WIN32) || defined(_WIN64) + #include <winsock.h> #include <io.h> #define open _open #define close _close @@ -25,10 +29,20 @@ #define write _write #define lseek _lseek #else + #include <sys/wait.h> + #include <unistd.h> #endif +#include <fcntl.h> + +#include <errno.h> +#include <stdio.h> +#include <string.h> + + static int mrb_io_modestr_to_flags(mrb_state *mrb, const char *modestr); static int mrb_io_flags_to_modenum(mrb_state *mrb, int flags); +static void fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int noraise); #if MRUBY_RELEASE_NO < 10000 static struct RClass * @@ -318,7 +332,7 @@ mrb_io_initialize(mrb_state *mrb, mrb_value io) return io; } -void +static void fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int noraise) { int n = 0; |
