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

prelude.c.tmpl: strip prefix

* template/prelude.c.tmpl (Prelude#translate): strip VPATH prefix
  from prelude names, so that srcdir diffrences do not make the
  generated code diffrent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-11-19 01:08:00 +00:00
parent 56d8b8701d
commit 16ba360423
3 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Wed Nov 19 10:07:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* template/prelude.c.tmpl (Prelude#translate): strip VPATH prefix
from prelude names, so that srcdir diffrences do not make the
generated code diffrent.
Wed Nov 19 07:45:11 2014 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (rb_w32_write): should set the error of

View file

@ -41,7 +41,7 @@ class Prelude
idx = @preludes[filename]
return idx if idx
lines = []
result = [@preludes.size, filename, lines, sub]
result = [@preludes.size, @vpath.strip(filename), lines, sub]
@vpath.foreach(filename) do |line|
@preludes[filename] ||= result
line.sub!(/(?:^|\s+)\#(?:$|\s.*)/, '')

View file

@ -79,4 +79,9 @@ class VPath
end
@list
end
def strip(path)
prefix = list.map {|dir| Regexp.quote(dir)}
path.sub(/\A#{prefix.join('|')}(?:\/|\z)/, '')
end
end