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

ruby-changes:7313

From: nobu <ko1@a...>
Date: Mon, 25 Aug 2008 17:37:01 +0900 (JST)
Subject: [ruby-changes:7313] Ruby:r18832 (trunk): * include/ruby/intern.h (rb_io_ungetbyte): added prototype.

nobu	2008-08-25 17:36:46 +0900 (Mon, 25 Aug 2008)

  New Revision: 18832

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

  Log:
    * include/ruby/intern.h (rb_io_ungetbyte): added prototype.
    
    * io.c (rb_io_gets): use rb_io_getline_1 for unget buffer.
    
    * ruby.c (load_file): use rb_io_ungetbyte.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/intern.h
    trunk/io.c
    trunk/ruby.c

Index: include/ruby/intern.h
===================================================================
--- include/ruby/intern.h	(revision 18831)
+++ include/ruby/intern.h	(revision 18832)
@@ -374,6 +374,7 @@
 VALUE rb_io_gets(VALUE);
 VALUE rb_io_getbyte(VALUE);
 VALUE rb_io_ungetc(VALUE, VALUE);
+VALUE rb_io_ungetbyte(VALUE, VALUE);
 VALUE rb_io_close(VALUE);
 VALUE rb_io_flush(VALUE);
 VALUE rb_io_eof(VALUE);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18831)
+++ ChangeLog	(revision 18832)
@@ -1,5 +1,11 @@
-Mon Aug 25 17:35:23 2008  Nobuyoshi Nakada  <nobu@r...>
+Mon Aug 25 17:36:26 2008  Nobuyoshi Nakada  <nobu@r...>
 
+	* include/ruby/intern.h (rb_io_ungetbyte): added prototype.
+
+	* io.c (rb_io_gets): use rb_io_getline_1 for unget buffer.
+
+	* ruby.c (load_file): use rb_io_ungetbyte.
+
 	* transcode.c (rb_econv_substr_append): fix for buffer overrun.
 
 	* win32/enc-setup.mak (BUILTIN_TRANSOBJS): added.
Index: io.c
===================================================================
--- io.c	(revision 18831)
+++ io.c	(revision 18832)
@@ -2213,11 +2213,7 @@
 VALUE
 rb_io_gets(VALUE io)
 {
-    rb_io_t *fptr;
-
-    GetOpenFile(io, fptr);
-    rb_io_check_readable(fptr);
-    return rb_io_getline_fast(fptr, io_read_encoding(fptr));
+    return rb_io_getline_1(rb_default_rs, -1, io);
 }
 
 /*
Index: ruby.c
===================================================================
--- ruby.c	(revision 18831)
+++ ruby.c	(revision 18832)
@@ -1260,12 +1260,12 @@
 		}
 
 		/* push back shebang for pragma may exist in next line */
-		rb_io_ungetc(f, rb_str_new2("!\n"));
+		rb_io_ungetbyte(f, rb_str_new2("!\n"));
 	    }
 	    else if (!NIL_P(c)) {
-		rb_io_ungetc(f, c);
+		rb_io_ungetbyte(f, c);
 	    }
-	    rb_io_ungetc(f, INT2FIX('#'));
+	    rb_io_ungetbyte(f, INT2FIX('#'));
 	    if (no_src_enc && opt->src.enc.name) {
 		opt->src.enc.index = opt_enc_index(opt->src.enc.name);
 		src_encoding_index = opt->src.enc.index;
@@ -1275,7 +1275,7 @@
 	    }
 	}
 	else if (!NIL_P(c)) {
-	    rb_io_ungetc(f, c);
+	    rb_io_ungetbyte(f, c);
 	}
 	require_libraries(opt);	/* Why here? unnatural */
     }

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

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