Skip to content

Commit

Permalink
unicode.c: no initialization
Browse files Browse the repository at this point in the history
* enc/unicode.c (init_case_fold_table): no longer need to
  initialize tables at runtime.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed May 30, 2014
1 parent 7e67b39 commit dd20f90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Sat May 31 08:58:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat May 31 08:58:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>

* enc/unicode.c (init_case_fold_table): no longer need to
initialize tables at runtime.

* enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
lookup case unfolding table 3.
Expand Down
18 changes: 0 additions & 18 deletions enc/unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,6 @@ onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end
return ctype;
}


static int CaseFoldInited = 0;

static int init_case_fold_table(void)
{
THREAD_ATOMIC_START;

CaseFoldInited = 1;
THREAD_ATOMIC_END;
return 0;
}

#define onigenc_unicode_fold_lookup onigenc_unicode_CaseFold_11_lookup
#define onigenc_unicode_unfold1_lookup onigenc_unicode_CaseUnfold_11_lookup
#define onigenc_unicode_unfold2_lookup onigenc_unicode_CaseUnfold_12_lookup
Expand All @@ -246,8 +234,6 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
int i, len, rlen;
const UChar *p = *pp;

if (CaseFoldInited == 0) init_case_fold_table();

code = ONIGENC_MBC_TO_CODE(enc, p, end);
len = enclen(enc, p, end);
*pp += len;
Expand Down Expand Up @@ -299,8 +285,6 @@ onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
OnigCodePoint code;
int i, j, k, r;

/* if (CaseFoldInited == 0) init_case_fold_table(); */

for (i = 0; i < numberof(CaseUnfold_11); i++) {
p11 = &CaseUnfold_11[i];
for (j = 0; j < p11->to.n; j++) {
Expand Down Expand Up @@ -436,8 +420,6 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
const CodePointList3 *to, *z3;
const CodePointList2 *z2;

if (CaseFoldInited == 0) init_case_fold_table();

n = 0;

code = ONIGENC_MBC_TO_CODE(enc, p, end);
Expand Down

0 comments on commit dd20f90

Please sign in to comment.