diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-23 04:37:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-23 04:37:02 +0000 |
commit | dcaf699ee9cecab846637489cae5ec2f184e4cdb (patch) | |
tree | 46f5f49faf558355396a4822d3f522ec1b558400 /enc | |
parent | 688b4cb74cced97f3fe42d0bc61e4cc045a22000 (diff) | |
download | bundler-dcaf699ee9cecab846637489cae5ec2f184e4cdb.tar.gz |
enc/unicode.c: constify
* enc/unicode.c (code{2,3}_{cmp,hash}): constify and adjust
argument types.
* enc/unicode.c (onigenc_unicode_fold_lookup): constify.
* enc/unicode.c (onigenc_unicode_apply_all_case_fold): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enc')
-rw-r--r-- | enc/unicode.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/enc/unicode.c b/enc/unicode.c index 20990c1e54..43b8e52a91 100644 --- a/enc/unicode.c +++ b/enc/unicode.c @@ -186,15 +186,18 @@ onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end static int -code2_cmp(OnigCodePoint* x, OnigCodePoint* y) +code2_cmp(st_data_t x0, st_data_t y0) { + const OnigCodePoint *x = (const OnigCodePoint *)x0; + const OnigCodePoint *y = (const OnigCodePoint *)y0; if (x[0] == y[0] && x[1] == y[1]) return 0; return 1; } static st_index_t -code2_hash(OnigCodePoint* x) +code2_hash(st_data_t x0) { + const OnigCodePoint *x = (const OnigCodePoint *)x0; return (st_index_t )(x[0] + x[1]); } @@ -204,15 +207,18 @@ static const struct st_hash_type type_code2_hash = { }; static int -code3_cmp(OnigCodePoint* x, OnigCodePoint* y) +code3_cmp(st_data_t x0, st_data_t y0) { + const OnigCodePoint *x = (const OnigCodePoint *)x0; + const OnigCodePoint *y = (const OnigCodePoint *)y0; if (x[0] == y[0] && x[1] == y[1] && x[2] == y[2]) return 0; return 1; } static st_index_t -code3_hash(OnigCodePoint* x) +code3_hash(st_data_t x0) { + const OnigCodePoint *x = (const OnigCodePoint *)x0; return (st_index_t )(x[0] + x[1] + x[2]); } @@ -291,7 +297,7 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc, OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end, UChar* fold) { - CodePointList3 *to; + const CodePointList3 *to; OnigCodePoint code; int i, len, rlen; const UChar *p = *pp; @@ -483,8 +489,8 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc, { int n, i, j, k, len; OnigCodePoint code, codes[3]; - CodePointList3 *to, *z3; - CodePointList2 *z2; + const CodePointList3 *to, *z3; + const CodePointList2 *z2; if (CaseFoldInited == 0) init_case_fold_table(); |