ruby-changes:13274
From: nobu <ko1@a...>
Date: Tue, 22 Sep 2009 16:26:36 +0900 (JST)
Subject: [ruby-changes:13274] Ruby:r25035 (trunk): * regparse.c (st_str_end_key, str_end_cmp, str_end_hash):
nobu 2009-09-22 16:26:22 +0900 (Tue, 22 Sep 2009) New Revision: 25035 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25035 Log: * regparse.c (st_str_end_key, str_end_cmp, str_end_hash): constified. Modified files: trunk/ChangeLog trunk/regparse.c Index: regparse.c =================================================================== --- regparse.c (revision 25034) +++ regparse.c (revision 25035) @@ -310,16 +310,19 @@ #include "ruby/st.h" typedef struct { - UChar* s; - UChar* end; + const UChar* s; + const UChar* end; } st_str_end_key; static int -str_end_cmp(st_str_end_key* x, st_str_end_key* y) +str_end_cmp(st_data_t xp, st_data_t yp) { - UChar *p, *q; + const st_str_end_key *x, *y; + const UChar *p, *q; int c; + x = (const st_str_end_key *)xp; + y = (const st_str_end_key *)yp; if ((x->end - x->s) != (y->end - y->s)) return 1; @@ -336,10 +339,11 @@ } static st_index_t -str_end_hash(st_str_end_key* x) +str_end_hash(st_data_t xp) { - UChar *p; - int val = 0; + const st_str_end_key *x = (const st_str_end_key *)xp; + const UChar *p; + st_index_t val = 0; p = x->s; while (p < x->end) { @@ -350,7 +354,7 @@ } extern hash_table_type* -onig_st_init_strend_table_with_size(int size) +onig_st_init_strend_table_with_size(st_index_t size) { static const struct st_hash_type hashType = { str_end_cmp, @@ -1430,7 +1434,7 @@ if (NSTR(node)->capa > 0 || (len + addlen > NODE_STR_BUF_SIZE - 1)) { UChar* p; - int capa = len + addlen + NODE_STR_MARGIN; + ptrdiff_t capa = len + addlen + NODE_STR_MARGIN; if (capa <= NSTR(node)->capa) { onig_strcpy(NSTR(node)->s + len, s, end); Index: ChangeLog =================================================================== --- ChangeLog (revision 25034) +++ ChangeLog (revision 25035) @@ -1,5 +1,8 @@ -Tue Sep 22 16:11:42 2009 Nobuyoshi Nakada <nobu@r...> +Tue Sep 22 16:26:21 2009 Nobuyoshi Nakada <nobu@r...> + * regparse.c (st_str_end_key, str_end_cmp, str_end_hash): + constified. + * tool/transcode-tblgen.rb (transcode_generated_code): fixed type. Tue Sep 22 10:29:06 2009 Tanaka Akira <akr@f...> -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/