summaryrefslogtreecommitdiff
path: root/enc/unicode/case-folding.rb
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-27 08:06:17 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-27 08:06:17 +0000
commitc4e6964141ef8ec7f42cc8ded29434b3a235c0ae (patch)
tree7c08517242778a5c48b85511a23c16ce9d370866 /enc/unicode/case-folding.rb
parentbafa7f90efe9138cf505776192603a49667c58a2 (diff)
* 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
Diffstat (limited to 'enc/unicode/case-folding.rb')
-rwxr-xr-xenc/unicode/case-folding.rb7
1 files changed, 5 insertions, 2 deletions
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