[前][次][番号順一覧][スレッド一覧]

ruby-changes:36796

From: nobu <ko1@a...>
Date: Wed, 17 Dec 2014 17:18:00 +0900 (JST)
Subject: [ruby-changes:36796] nobu:r48877 (trunk): console.c: dead code

nobu	2014-12-17 17:17:46 +0900 (Wed, 17 Dec 2014)

  New Revision: 48877

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48877

  Log:
    console.c: dead code
    
    * ext/io/console/console.c: remove dead code for old versions.

  Modified files:
    trunk/ext/io/console/console.c
    trunk/ext/io/console/extconf.rb
Index: ext/io/console/console.c
===================================================================
--- ext/io/console/console.c	(revision 48876)
+++ ext/io/console/console.c	(revision 48877)
@@ -3,17 +3,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L3
  * console IO module
  */
 #include "ruby.h"
-#ifdef HAVE_RUBY_IO_H
 #include "ruby/io.h"
-#else
-#include "rubyio.h"
-/* assumes rb_io_t doesn't have pathv */
-#include "util.h"		/* for ruby_strdup() */
-#endif
-
-#ifndef HAVE_RB_IO_T
-typedef OpenFile rb_io_t;
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -25,10 +15,6 @@ typedef OpenFile rb_io_t; https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L15
 #include <sys/ioctl.h>
 #endif
 
-#ifndef RB_TYPE_P
-#define RB_TYPE_P(obj, type) (TYPE(obj) == type)
-#endif
-
 #if defined HAVE_TERMIOS_H
 # include <termios.h>
 typedef struct termios conmode;
@@ -91,10 +77,6 @@ getattr(int fd, conmode *t) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L77
 #define SET_LAST_ERROR (0)
 #endif
 
-#ifndef InitVM
-#define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();}
-#endif
-
 static ID id_getc, id_console;
 
 typedef struct {
@@ -107,23 +89,7 @@ rawmode_opt(int argc, VALUE *argv, rawmo https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L89
 {
     rawmode_arg_t *optp = NULL;
     VALUE vopts;
-#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH
     rb_scan_args(argc, argv, "0:", &vopts);
-#else
-    vopts = Qnil;
-    if (argc > 0) {
-	vopts = argv[--argc];
-	if (!NIL_P(vopts)) {
-# ifdef HAVE_RB_CHECK_HASH_TYPE
-	    vopts = rb_check_hash_type(vopts);
-	    if (NIL_P(vopts)) ++argc;
-# else
-	    Check_Type(vopts, T_HASH);
-# endif
-	}
-    }
-    rb_scan_args(argc, argv, "0");
-#endif
     if (!NIL_P(vopts)) {
 	VALUE vmin = rb_hash_aref(vopts, ID2SYM(rb_intern("min")));
 	VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
@@ -232,15 +198,8 @@ set_ttymode(int fd, conmode *t, void (*s https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L198
     return setattr(fd, &r);
 }
 
-#ifdef GetReadFile
-#define GetReadFD(fptr) fileno(GetReadFile(fptr))
-#else
 #define GetReadFD(fptr) ((fptr)->fd)
-#endif
 
-#ifdef GetWriteFile
-#define GetWriteFD(fptr) fileno(GetWriteFile(fptr))
-#else
 static inline int
 get_write_fd(const rb_io_t *fptr)
 {
@@ -251,7 +210,6 @@ get_write_fd(const rb_io_t *fptr) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L210
     return ofptr->fd;
 }
 #define GetWriteFD(fptr) get_write_fd(fptr)
-#endif
 
 #define FD_PER_IO 2
 
@@ -729,20 +687,11 @@ console_dev(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L687
 	args[0] = INT2NUM(fd);
 	con = rb_class_new_instance(2, args, klass);
 	GetOpenFile(con, fptr);
-#ifdef HAVE_RUBY_IO_H
 	fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE));
-#else
-	fptr->path = ruby_strdup(CONSOLE_DEVICE);
-#endif
 #ifdef CONSOLE_DEVICE_FOR_WRITING
 	GetOpenFile(out, ofptr);
-# ifdef HAVE_RB_IO_GET_WRITE_IO
 	ofptr->pathv = fptr->pathv;
 	fptr->tied_io_for_writing = out;
-# else
-	fptr->f2 = ofptr->f;
-	ofptr->f = 0;
-# endif
 	ofptr->mode |= FMODE_SYNC;
 #endif
 	fptr->mode |= FMODE_SYNC;
Index: ext/io/console/extconf.rb
===================================================================
--- ext/io/console/extconf.rb	(revision 48876)
+++ ext/io/console/extconf.rb	(revision 48877)
@@ -12,15 +12,10 @@ when have_header(hdr = "sgtty.h") https://github.com/ruby/ruby/blob/trunk/ext/io/console/extconf.rb#L12
 else
   ok = false
 end
-ok &&= enable_config("io-console-force-compatible-with-1.8") ||
-  macro_defined?("HAVE_RUBY_IO_H", cpp_include("ruby.h"))
 if ok
   have_header("sys/ioctl.h")
   have_func("rb_check_hash_type", "ruby.h")
   have_func("rb_io_get_write_io", "ruby/io.h")
   have_func("rb_cloexec_open", "ruby/io.h")
-  if enable_config("io-console-rb_scan_args-optional-hash", true)
-    $defs << "-DHAVE_RB_SCAN_ARGS_OPTIONAL_HASH=1"
-  end
   create_makefile("io/console")
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]