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

ruby-changes:51271

From: nobu <ko1@a...>
Date: Mon, 21 May 2018 21:25:51 +0900 (JST)
Subject: [ruby-changes:51271] nobu:r63477 (trunk): ruby.c: localize a variable

nobu	2018-05-21 21:25:45 +0900 (Mon, 21 May 2018)

  New Revision: 63477

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

  Log:
    ruby.c: localize a variable
    
    * ruby.c (ruby_init_loadpath_safe): moved libdir to the block
      where it is used.

  Modified files:
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 63476)
+++ ruby.c	(revision 63477)
@@ -561,15 +561,6 @@ ruby_init_loadpath_safe(int safe_level) https://github.com/ruby/ruby/blob/trunk/ruby.c#L561
 #else
 # define RUBY_ARCH_PATH "/"RUBY_PLATFORM
 #endif
-    static const char libdir[] = "/"
-#ifdef LIBDIR_BASENAME
-	LIBDIR_BASENAME
-#else
-	"lib"
-#endif
-	RUBY_ARCH_PATH;
-    const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir)
-	- rb_strlen_lit(RUBY_ARCH_PATH) - 1;
     char *libpath;
     VALUE sopath;
     size_t baselen;
@@ -580,6 +571,15 @@ ruby_init_loadpath_safe(int safe_level) https://github.com/ruby/ruby/blob/trunk/ruby.c#L571
 
     p = strrchr(libpath, '/');
     if (p) {
+	static const char libdir[] = "/"
+#ifdef LIBDIR_BASENAME
+	    LIBDIR_BASENAME
+#else
+	    "lib"
+#endif
+	    RUBY_ARCH_PATH;
+	const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir)
+	    - rb_strlen_lit(RUBY_ARCH_PATH) - 1;
 	static const char bindir[] = "/bin";
 	const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1;
 

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

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