1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ruby.c: localize a variable

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-05-21 12:25:45 +00:00
parent 68b87aedde
commit 7cdc78e284

18
ruby.c
View file

@ -561,15 +561,6 @@ ruby_init_loadpath_safe(int safe_level)
#else #else
# define RUBY_ARCH_PATH "/"RUBY_PLATFORM # define RUBY_ARCH_PATH "/"RUBY_PLATFORM
#endif #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; char *libpath;
VALUE sopath; VALUE sopath;
size_t baselen; size_t baselen;
@ -580,6 +571,15 @@ ruby_init_loadpath_safe(int safe_level)
p = strrchr(libpath, '/'); p = strrchr(libpath, '/');
if (p) { 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"; static const char bindir[] = "/bin";
const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1; const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1;