[前][次][番号順一覧][スレッド一覧]

ruby-changes:33975

From: nobu <ko1@a...>
Date: Fri, 23 May 2014 13:37:10 +0900 (JST)
Subject: [ruby-changes:33975] nobu:r46056 (trunk): enc/unicode.c: constify

nobu	2014-05-23 13:37:02 +0900 (Fri, 23 May 2014)

  New Revision: 46056

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=46056

  Log:
    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.

  Modified files:
    trunk/enc/unicode.c
Index: enc/unicode.c
===================================================================
--- enc/unicode.c	(revision 46055)
+++ enc/unicode.c	(revision 46056)
@@ -186,15 +186,18 @@ onigenc_unicode_property_name_to_ctype(O https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L186
 
 
 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_co https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L207
 };
 
 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(OnigEncodi https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L297
     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_s https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L489
 {
   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();
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]