mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
* hash.c (rb_hash_identical): a new method to make a hash to
compare keys by their identity. * hash.c (rb_hash_identical_p): new method to tell if a hash is identical or not. * st.c (st_numcmp, st_numhash): export hash type functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f2ad09d5b7
commit
ad0b87727d
4 changed files with 70 additions and 15 deletions
14
st.c
14
st.c
|
@ -38,11 +38,9 @@ struct st_table_entry {
|
|||
*
|
||||
*/
|
||||
|
||||
static int numcmp(long, long);
|
||||
static int numhash(long);
|
||||
static struct st_hash_type type_numhash = {
|
||||
numcmp,
|
||||
numhash,
|
||||
st_numcmp,
|
||||
st_numhash,
|
||||
};
|
||||
|
||||
/* extern int strcmp(const char *, const char *); */
|
||||
|
@ -589,14 +587,14 @@ strhash(register const char *string)
|
|||
return hval;
|
||||
}
|
||||
|
||||
static int
|
||||
numcmp(long x, long y)
|
||||
int
|
||||
st_numcmp(long x, long y)
|
||||
{
|
||||
return x != y;
|
||||
}
|
||||
|
||||
static int
|
||||
numhash(long n)
|
||||
int
|
||||
st_numhash(long n)
|
||||
{
|
||||
return n;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue