From c4e6964141ef8ec7f42cc8ded29434b3a235c0ae Mon Sep 17 00:00:00 2001 From: duerst Date: Sat, 27 Feb 2016 08:06:17 +0000 Subject: * enc/unicode/case-folding.rb, casefold.h: Reducing size of TitleCase table by eliminating duplicates. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enc/unicode/case-folding.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'enc/unicode/case-folding.rb') diff --git a/enc/unicode/case-folding.rb b/enc/unicode/case-folding.rb index dfb5f47314..cd14b6e6f1 100755 --- a/enc/unicode/case-folding.rb +++ b/enc/unicode/case-folding.rb @@ -238,8 +238,11 @@ class CaseMapping flags += '|U' if to==item.upper flags += '|D' if to==item.lower unless item.upper == item.title - flags += "|T(#{@titlecase.length})" - @titlecase << item + unless title_index = @titlecase.find_index { |i| i.title==item.title } + title_index = @titlecase.length + @titlecase << item + end + flags += "|T(#{title_index})" end end flags -- cgit v1.2.3