remove standard header files from io.h.

This commit is contained in:
Tomoyuki Sahara
2014-04-17 16:29:27 +09:00
parent a11780f4f1
commit 1c4f46f324
3 changed files with 29 additions and 25 deletions
-19
View File
@@ -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)
+13 -4
View File
@@ -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>
+16 -2
View File
@@ -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;