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

ruby-changes:41919

From: nobu <ko1@a...>
Date: Fri, 4 Mar 2016 12:53:51 +0900 (JST)
Subject: [ruby-changes:41919] nobu:r53993 (trunk): ruby.c: remove a magic number

nobu	2016-03-04 12:53:43 +0900 (Fri, 04 Mar 2016)

  New Revision: 53993

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

  Log:
    ruby.c: remove a magic number
    
    * ruby.c (load_file_internal): remove a magic number, which means
      the length of ruby_engine but the value is unknown in this file
      since the variable is in a different file now.  instead, strstr
      should deal with it well, as far as ruby_engine does not contain
      a space and a hyphen.

  Modified files:
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 53992)
+++ ruby.c	(revision 53993)
@@ -1737,10 +1737,10 @@ load_file_internal(VALUE argp_v) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1737
 		}
 
 	      start_read:
-		p += 4;
 		RSTRING_PTR(line)[RSTRING_LEN(line) - 1] = '\0';
 		if (RSTRING_PTR(line)[RSTRING_LEN(line) - 2] == '\r')
 		    RSTRING_PTR(line)[RSTRING_LEN(line) - 2] = '\0';
+		/* ruby_engine should not contain a space */
 		if ((p = strstr(p, " -")) != 0) {
 		    opt->warning = 0;
 		    moreswitches(p + 1, opt, 0);

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

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