summaryrefslogtreecommitdiff
path: root/regparse.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-22 07:26:22 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-22 07:26:22 (GMT)
commit62f073a3864ab89cbb0a1995100b85a1686ddfb8 (patch)
tree29f141d8b6257e37e376bfc7f9854545d15ddb7e /regparse.c
parent476b3d8f3fb238ebea44f65e4b544c06ee8690d2 (diff)
* regparse.c (st_str_end_key, str_end_cmp, str_end_hash):
constified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regparse.c')
-rw-r--r--regparse.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/regparse.c b/regparse.c
index b9667c6..30debf7 100644
--- a/regparse.c
+++ b/regparse.c
@@ -310,16 +310,19 @@ strcat_capa_from_static(UChar* dest, UChar* dest_end,
#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 @@ str_end_cmp(st_str_end_key* x, st_str_end_key* y)
}
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 @@ str_end_hash(st_str_end_key* x)
}
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 @@ onig_node_str_cat(Node* node, const UChar* s, const UChar* end)
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);