aboutsummaryrefslogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-08 13:10:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-08 13:10:04 +0000
commit31b7ae00c05aef76416c767df92be45d62e9d06a (patch)
tree87743fd1893484f1af704d20e3695810ea21a893 /st.c
parent034414741e4616f7a305f12fe36e1f9a6b0ff074 (diff)
downloadruby-31b7ae00c05aef76416c767df92be45d62e9d06a.tar.gz
* include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r--st.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/st.c b/st.c
index 7866d03e45..938e07dc76 100644
--- a/st.c
+++ b/st.c
@@ -44,13 +44,13 @@ static const struct st_hash_type type_numhash = {
};
/* extern int strcmp(const char *, const char *); */
-static int strhash(const char *);
+static st_index_t strhash(const char *);
static const struct st_hash_type type_strhash = {
strcmp,
strhash,
};
-static int strcasehash(const char *);
+static st_index_t strcasehash(const char *);
static const struct st_hash_type type_strcasehash = {
st_strcasecmp,
strcasehash,
@@ -69,7 +69,7 @@ static void rehash(st_table *);
#define EQUAL(table,x,y) ((x)==(y) || (*table->type->compare)((x),(y)) == 0)
-#define do_hash(key,table) (unsigned int)(*(table)->type->hash)((key))
+#define do_hash(key,table) (unsigned int)(st_index_t)(*(table)->type->hash)((key))
#define do_hash_bin(key,table) (do_hash(key, table)%(table)->num_bins)
/*
@@ -927,10 +927,10 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
*/
#define FNV_32_PRIME 0x01000193
-static int
+static st_index_t
strhash(register const char *string)
{
- register unsigned int hval = FNV1_32A_INIT;
+ register st_index_t hval = FNV1_32A_INIT;
/*
* FNV-1a hash each octet in the buffer
@@ -994,10 +994,10 @@ st_strncasecmp(const char *s1, const char *s2, size_t n)
return 0;
}
-static int
+static st_index_t
strcasehash(register const char *string)
{
- register unsigned int hval = FNV1_32A_INIT;
+ register st_index_t hval = FNV1_32A_INIT;
/*
* FNV-1a hash each octet in the buffer
@@ -1019,8 +1019,8 @@ st_numcmp(st_data_t x, st_data_t y)
return x != y;
}
-int
+st_index_t
st_numhash(st_data_t n)
{
- return (int)n;
+ return (st_index_t)n;
}