Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions | Variables
hash.c File Reference
`#include "ruby/ruby.h"`
`#include "ruby/st.h"`
`#include "ruby/util.h"`
`#include "ruby/encoding.h"`
`#include "internal.h"`
`#include <errno.h>`
`#include "probes.h"`
Include dependency graph for hash.c:

Go to the source code of this file.

## Data Structures
struct | foreach_safe_arg
struct | hash_foreach_arg
struct | shift_var
struct | equal_data
struct | update_arg

## Macros
#define | HASH_DELETED FL_USER1
#define | HASH_PROC_DEFAULT FL_USER2
#define | identhash st_hashtype_num
#define | NOINSERT_UPDATE_CALLBACK(func)
#define | UPDATE_CALLBACK(iter_lev, func) ((iter_lev) > 0 ? func##_noinsert : func)
#define | RHASH_UPDATE_ITER(hash, iter_lev, key, func, arg)
#define | RHASH_UPDATE(hash, key, func, arg) RHASH_UPDATE_ITER(hash, RHASH_ITER_LEV(hash), key, func, arg)
#define | GET_ENVIRON(e) (e)
#define | FREE_ENVIRON(e)
#define | ENVMATCH(n1, n2) (strcmp((n1), (n2)) == 0)
#define | ENVNMATCH(s1, s2, n) (memcmp((s1), (s2), (n)) == 0)
#define | rb_intern(str) rb_intern_const(str)

## Typedefs
typedef int | st_foreach_func (st_data_t, st_data_t, st_data_t)
typedef int | rb_foreach_func (VALUE, VALUE, VALUE)

## Functions
static VALUE | rb_hash_s_try_convert (VALUE, VALUE)
VALUE | rb_hash_freeze (VALUE hash)
static int | rb_any_cmp (VALUE a, VALUE b)
VALUE | rb_hash (VALUE obj)
static st_index_t | rb_any_hash (VALUE a)
static int | foreach_safe_i (st_data_t key, st_data_t value, struct foreach_safe_arg *arg)
void | st_foreach_safe (st_table *table, int(*func)(ANYARGS), st_data_t a)
static int | hash_foreach_iter (st_data_t key, st_data_t value, st_data_t argp)
static VALUE | hash_foreach_ensure (VALUE hash)
static VALUE | hash_foreach_call (VALUE arg)
void | rb_hash_foreach (VALUE hash, int(*func)(ANYARGS), VALUE farg)
static VALUE | hash_alloc (VALUE klass)
static VALUE | empty_hash_alloc (VALUE klass)
VALUE | rb_hash_new (void)
VALUE | rb_hash_dup (VALUE hash)
static void | rb_hash_modify_check (VALUE hash)
struct st_table * | rb_hash_tbl (VALUE hash)
static void | rb_hash_modify (VALUE hash)
| NORETURN (static void no_new_key(void))
static void | no_new_key (void)
static void | default_proc_arity_check (VALUE proc)
static VALUE | rb_hash_initialize (int argc, VALUE *argv, VALUE hash)
static VALUE | rb_hash_s_create (int argc, VALUE *argv, VALUE klass)
static VALUE | to_hash (VALUE hash)
VALUE | rb_check_hash_type (VALUE hash)
static int | rb_hash_rehash_i (VALUE key, VALUE value, VALUE arg)
static VALUE | rb_hash_rehash (VALUE hash)
static VALUE | hash_default_value (VALUE hash, VALUE key)
VALUE | rb_hash_aref (VALUE hash, VALUE key)
VALUE | rb_hash_lookup2 (VALUE hash, VALUE key, VALUE def)
VALUE | rb_hash_lookup (VALUE hash, VALUE key)
static VALUE | rb_hash_fetch_m (int argc, VALUE *argv, VALUE hash)
VALUE | rb_hash_fetch (VALUE hash, VALUE key)
static VALUE | rb_hash_default (int argc, VALUE *argv, VALUE hash)
static VALUE | rb_hash_set_default (VALUE hash, VALUE ifnone)
static VALUE | rb_hash_default_proc (VALUE hash)
static VALUE | rb_hash_set_default_proc (VALUE hash, VALUE proc)
static int | key_i (VALUE key, VALUE value, VALUE arg)
static VALUE | rb_hash_key (VALUE hash, VALUE value)
static VALUE | rb_hash_index (VALUE hash, VALUE value)
static VALUE | rb_hash_delete_key (VALUE hash, VALUE key)
VALUE | rb_hash_delete (VALUE hash, VALUE key)
static int | shift_i (VALUE key, VALUE value, VALUE arg)
static int | shift_i_safe (VALUE key, VALUE value, VALUE arg)
static VALUE | rb_hash_shift (VALUE hash)
static int | delete_if_i (VALUE key, VALUE value, VALUE hash)
static VALUE | rb_hash_size (VALUE hash)
VALUE | rb_hash_delete_if (VALUE hash)
VALUE | rb_hash_reject_bang (VALUE hash)
static VALUE | rb_hash_reject (VALUE hash)
VALUE | rb_hash_values_at (int argc, VALUE *argv, VALUE hash)
static int | select_i (VALUE key, VALUE value, VALUE result)
VALUE | rb_hash_select (VALUE hash)
static int | keep_if_i (VALUE key, VALUE value, VALUE hash)
VALUE | rb_hash_select_bang (VALUE hash)
VALUE | rb_hash_keep_if (VALUE hash)
static int | clear_i (VALUE key, VALUE value, VALUE dummy)
VALUE | rb_hash_clear (VALUE hash)
static int | hash_aset (st_data_t *key, st_data_t *val, st_data_t arg, int existing)
static int | hash_aset_str (st_data_t *key, st_data_t *val, st_data_t arg, int existing)
static | NOINSERT_UPDATE_CALLBACK (hash_aset)
static int | replace_i (VALUE key, VALUE val, VALUE hash)
static VALUE | rb_hash_initialize_copy (VALUE hash, VALUE hash2)
static VALUE | rb_hash_replace (VALUE hash, VALUE hash2)
static VALUE | rb_hash_empty_p (VALUE hash)
static int | each_value_i (VALUE key, VALUE value)
static VALUE | rb_hash_each_value (VALUE hash)
static int | each_key_i (VALUE key, VALUE value)
static VALUE | rb_hash_each_key (VALUE hash)
static int | each_pair_i (VALUE key, VALUE value)
static VALUE | rb_hash_each_pair (VALUE hash)
static int | to_a_i (VALUE key, VALUE value, VALUE ary)
static VALUE | rb_hash_to_a (VALUE hash)
static int | inspect_i (VALUE key, VALUE value, VALUE str)
static VALUE | inspect_hash (VALUE hash, VALUE dummy, int recur)
static VALUE | rb_hash_inspect (VALUE hash)
static VALUE | rb_hash_to_hash (VALUE hash)
static VALUE | rb_hash_to_h (VALUE hash)
static int | keys_i (VALUE key, VALUE value, VALUE ary)
static VALUE | rb_hash_keys (VALUE hash)
static int | values_i (VALUE key, VALUE value, VALUE ary)
static VALUE | rb_hash_values (VALUE hash)
static VALUE | rb_hash_has_key (VALUE hash, VALUE key)
static int | rb_hash_search_value (VALUE key, VALUE value, VALUE arg)
static VALUE | rb_hash_has_value (VALUE hash, VALUE val)
static int | eql_i (VALUE key, VALUE val1, VALUE arg)
static VALUE | recursive_eql (VALUE hash, VALUE dt, int recur)
static VALUE | hash_equal (VALUE hash1, VALUE hash2, int eql)
static VALUE | rb_hash_equal (VALUE hash1, VALUE hash2)
static VALUE | rb_hash_eql (VALUE hash1, VALUE hash2)
static int | hash_i (VALUE key, VALUE val, VALUE arg)
static VALUE | recursive_hash (VALUE hash, VALUE dummy, int recur)
static VALUE | rb_hash_hash (VALUE hash)
static int | rb_hash_invert_i (VALUE key, VALUE value, VALUE hash)
static VALUE | rb_hash_invert (VALUE hash)
static int | rb_hash_update_callback (st_data_t *key, st_data_t *value, st_data_t arg, int existing)
static | NOINSERT_UPDATE_CALLBACK (rb_hash_update_callback)
static int | rb_hash_update_block_callback (st_data_t *key, st_data_t *value, st_data_t arg, int existing)
static | NOINSERT_UPDATE_CALLBACK (rb_hash_update_block_callback)
static VALUE | rb_hash_update (VALUE hash1, VALUE hash2)
static int | rb_hash_update_func_callback (st_data_t *key, st_data_t *value, st_data_t arg0, int existing)
static | NOINSERT_UPDATE_CALLBACK (rb_hash_update_func_callback)
VALUE | rb_hash_update_by (VALUE hash1, VALUE hash2, rb_hash_update_func *func)
static VALUE | rb_hash_merge (VALUE hash1, VALUE hash2)
static int | assoc_i (VALUE key, VALUE val, VALUE arg)
VALUE | rb_hash_assoc (VALUE hash, VALUE obj)
static int | rassoc_i (VALUE key, VALUE val, VALUE arg)
VALUE | rb_hash_rassoc (VALUE hash, VALUE obj)
static VALUE | rb_hash_flatten (int argc, VALUE *argv, VALUE hash)
static VALUE | rb_hash_compare_by_id (VALUE hash)
static VALUE | rb_hash_compare_by_id_p (VALUE hash)
static VALUE | env_str_new (const char *ptr, long len)
static VALUE | env_str_new2 (const char *ptr)
static VALUE | env_delete (VALUE obj, VALUE name)
static VALUE | env_delete_m (VALUE obj, VALUE name)
static int | env_path_tainted (const char *)
static VALUE | rb_f_getenv (VALUE obj, VALUE name)
static VALUE | env_fetch (int argc, VALUE *argv)
static void | path_tainted_p (const char *path)
int | rb_env_path_tainted (void)
static int | envix (const char *nam)
void | ruby_setenv (const char *name, const char *value)
void | ruby_unsetenv (const char *name)
static VALUE | env_aset (VALUE obj, VALUE nm, VALUE val)
static VALUE | env_keys (void)
static VALUE | rb_env_size (VALUE ehash)
static VALUE | env_each_key (VALUE ehash)
static VALUE | env_values (void)
static VALUE | env_each_value (VALUE ehash)
static VALUE | env_each_pair (VALUE ehash)
static VALUE | env_reject_bang (VALUE ehash)
static VALUE | env_delete_if (VALUE ehash)
static VALUE | env_values_at (int argc, VALUE *argv)
static VALUE | env_select (VALUE ehash)
static VALUE | env_select_bang (VALUE ehash)
static VALUE | env_keep_if (VALUE ehash)
VALUE | rb_env_clear (void)
static VALUE | env_to_s (void)
static VALUE | env_inspect (void)
static VALUE | env_to_a (void)
static VALUE | env_none (void)
static VALUE | env_size (void)
static VALUE | env_empty_p (void)
static VALUE | env_has_key (VALUE env, VALUE key)
static VALUE | env_assoc (VALUE env, VALUE key)
static VALUE | env_has_value (VALUE dmy, VALUE obj)
static VALUE | env_rassoc (VALUE dmy, VALUE obj)
static VALUE | env_key (VALUE dmy, VALUE value)
static VALUE | env_index (VALUE dmy, VALUE value)
static VALUE | env_to_hash (void)
static VALUE | env_reject (void)
static VALUE | env_shift (void)
static VALUE | env_invert (void)
static int | env_replace_i (VALUE key, VALUE val, VALUE keys)
static VALUE | env_replace (VALUE env, VALUE hash)
static int | env_update_i (VALUE key, VALUE val)
static VALUE | env_update (VALUE env, VALUE hash)
void | Init_Hash (void)

## Variables
VALUE | rb_cHash
static VALUE | envtbl
static ID | id_hash
static ID | id_yield
static ID | id_default
static struct st_hash_type | objhash
struct st_hash_type | st_hashtype_num
static int | path_tainted = -1
static char ** | origenviron
char ** | environ

## Macro Definition Documentation

#define ENVMATCH | ( |  | n1,
|  |  | n2
| ) |  | (strcmp((n1), (n2)) == 0)

Definition at line 2160 of file hash.c.

Referenced by env_aset(), env_delete(), env_fetch(), and rb_f_getenv().

#define ENVNMATCH | ( |  | s1,
|  |  | s2,
|  |  | n
| ) |  | (memcmp((s1), (s2), (n)) == 0)

Definition at line 2161 of file hash.c.

Referenced by envix().

#define FREE_ENVIRON | ( |  | e) |  |

Definition at line 2154 of file hash.c.

Referenced by env_each_pair(), env_empty_p(), env_has_value(), env_inspect(), env_key(), env_keys(), env_rassoc(), env_select(), env_shift(), env_size(), env_to_a(), env_to_hash(), env_values(), envix(), and rb_env_size().

#define GET_ENVIRON | ( |  | e) |  | (e)

Definition at line 2153 of file hash.c.

Referenced by env_each_pair(), env_empty_p(), env_has_value(), env_inspect(), env_key(), env_keys(), env_rassoc(), env_select(), env_shift(), env_size(), env_to_a(), env_to_hash(), env_values(), envix(), rb_env_size(), and ruby_setenv().

#define HASH_DELETED FL_USER1

Definition at line 32 of file hash.c.

Referenced by hash_foreach_ensure(), hash_foreach_iter(), and rb_hash_delete_key().

#define HASH_PROC_DEFAULT FL_USER2

Definition at line 33 of file hash.c.

Referenced by hash_default_value(), hash_equal(), rb_hash_default(), rb_hash_default_proc(), rb_hash_dup(), rb_hash_initialize(), rb_hash_initialize_copy(), rb_hash_replace(), rb_hash_set_default(), rb_hash_set_default_proc(), and rb_hash_to_h().

#define identhash st_hashtype_num

Definition at line 110 of file hash.c.

Referenced by NOINSERT_UPDATE_CALLBACK(), rb_hash_compare_by_id(), and rb_hash_compare_by_id_p().

#define NOINSERT_UPDATE_CALLBACK | ( |  | func) |  |

Value:
int \
func##_noinsert(st_data_t *key, st_data_t *val, st_data_t arg, int existing) \
{ \
if (!existing) no_new_key(); \
return func(key, val, arg, existing); \
}

Definition at line 288 of file hash.c.

#define rb_intern | ( |  | str) |  | rb_intern_const(str)

#define RHASH_UPDATE | ( |  | hash,
|  |  | key,
|  |  | func,
|  |  | arg
| ) |  | RHASH_UPDATE_ITER(hash, RHASH_ITER_LEV(hash), key, func, arg)

Definition at line 302 of file hash.c.

Referenced by NOINSERT_UPDATE_CALLBACK().

#define RHASH_UPDATE_ITER | ( |  | hash,
|  |  | iter_lev,
|  |  | key,
|  |  | func,
|  |  | arg
| ) |  |

Value:
st_update(RHASH(hash)->ntbl, (st_data_t)(key), \
UPDATE_CALLBACK((iter_lev), func), \
(st_data_t)(arg))

Definition at line 298 of file hash.c.

Referenced by NOINSERT_UPDATE_CALLBACK().

#define UPDATE_CALLBACK | ( |  | iter_lev,
|  |  | func
| ) |  | ((iter_lev) > 0 ? func##_noinsert : func)

Definition at line 296 of file hash.c.

## Typedef Documentation

typedef int rb_foreach_func(VALUE, VALUE, VALUE)

Definition at line 145 of file hash.c.

typedef int st_foreach_func(st_data_t, st_data_t, st_data_t)

Definition at line 112 of file hash.c.

## Function Documentation

static int assoc_i | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | arg
| ) |  |
| static

Definition at line 1987 of file hash.c.

References args, rb_assoc_new(), rb_equal(), RTEST, ST_CONTINUE, and ST_STOP.

Referenced by rb_hash_assoc().

static int clear_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | dummy
| ) |  |
| static

Definition at line 1121 of file hash.c.

References ST_DELETE.

Referenced by rb_hash_clear().

static void default_proc_arity_check | ( | VALUE | proc) |  |
| static

Definition at line 306 of file hash.c.

References rb_eTypeError, rb_proc_arity(), rb_proc_lambda_p(), and rb_raise().

Referenced by rb_hash_initialize(), and rb_hash_set_default_proc().

static int delete_if_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | hash
| ) |  |
| static

Definition at line 933 of file hash.c.

References rb_hash_delete_key(), rb_yield_values(), RTEST, and ST_CONTINUE.

Referenced by rb_hash_delete_if(), and rb_hash_reject_bang().

static int each_key_i | ( | VALUE | key,
|  | VALUE | value
| ) |  |
| static

Definition at line 1348 of file hash.c.

References rb_yield(), and ST_CONTINUE.

Referenced by rb_hash_each_key().

static int each_pair_i | ( | VALUE | key,
|  | VALUE | value
| ) |  |
| static

Definition at line 1381 of file hash.c.

References rb_assoc_new(), rb_yield(), and ST_CONTINUE.

Referenced by rb_hash_each_pair().

static int each_value_i | ( | VALUE | key,
|  | VALUE | value
| ) |  |
| static

Definition at line 1314 of file hash.c.

References rb_yield(), and ST_CONTINUE.

Referenced by rb_hash_each_value().

static VALUE empty_hash_alloc | ( | VALUE | klass) |  |
| static

Definition at line 224 of file hash.c.

References hash_alloc(), rb_sourcefile, rb_sourceline(), RUBY_DTRACE_HASH_CREATE, and RUBY_DTRACE_HASH_CREATE_ENABLED.

Referenced by Init_Hash().

static VALUE env_aset | ( | VALUE | obj,
|  | VALUE | nm,
|  | VALUE | val
| ) |  |
| static

Definition at line 2508 of file hash.c.

References env_delete(), ENVMATCH, name, NIL_P, OBJ_TAINTED, PATH_ENV, path_tainted_p(), Qnil, rb_eArgError, rb_eSecurityError, rb_raise(), rb_safe_level, RSTRING_LEN, RSTRING_PTR, ruby_setenv(), StringValue, and update_arg::value.

Referenced by env_replace_i(), env_update_i(), and Init_Hash().

static VALUE env_assoc | ( | VALUE | env,
|  | VALUE | key
| ) |  |
| static

Definition at line 3038 of file hash.c.

References getenv(), Qnil, rb_assoc_new(), rb_eArgError, rb_raise(), rb_secure(), rb_tainted_str_new2, RSTRING_LEN, and StringValuePtr.

Referenced by Init_Hash().

static VALUE env_delete | ( | VALUE | obj,
|  | VALUE | name
| ) |  |
| static

Definition at line 2185 of file hash.c.

References env_str_new2(), ENVMATCH, getenv(), PATH_ENV, Qnil, rb_eArgError, rb_raise(), rb_secure(), RSTRING_LEN, RSTRING_PTR, ruby_setenv(), SafeStringValue, val, and update_arg::value.

Referenced by env_aset(), env_delete_m(), env_reject_bang(), env_replace(), env_select_bang(), env_shift(), and rb_env_clear().

static VALUE env_delete_if | ( | VALUE | ehash) |  |
| static

Definition at line 2741 of file hash.c.

References env_reject_bang(), envtbl, rb_env_size(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE env_delete_m | ( | VALUE | obj,
|  | VALUE | name
| ) |  |
| static

Definition at line 2218 of file hash.c.

References env_delete(), NIL_P, rb_block_given_p(), rb_yield(), and val.

Referenced by Init_Hash().

static VALUE env_each_key | ( | VALUE | ehash) |  |
| static

Definition at line 2597 of file hash.c.

References env_keys(), i, RARRAY_LEN, RARRAY_PTR, rb_env_size(), rb_yield(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE env_each_pair | ( | VALUE | ehash) |  |
| static

Definition at line 2671 of file hash.c.

References env_str_new(), env_str_new2(), FREE_ENVIRON, GET_ENVIRON, i, RARRAY_LEN, RARRAY_PTR, rb_ary_new(), rb_ary_push(), rb_assoc_new(), rb_env_size(), rb_secure(), rb_yield(), RETURN_SIZED_ENUMERATOR, and strchr().

Referenced by Init_Hash().

static VALUE env_each_value | ( | VALUE | ehash) |  |
| static

Definition at line 2646 of file hash.c.

References env_values(), i, RARRAY_LEN, RARRAY_PTR, rb_env_size(), rb_yield(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE env_empty_p | ( | void | ) |  |
| static

Definition at line 2994 of file hash.c.

References FREE_ENVIRON, GET_ENVIRON, Qfalse, Qtrue, and rb_secure().

Referenced by Init_Hash().

static VALUE env_fetch | ( | int | argc,
|  | VALUE * | argv
| ) |  |
| static

Definition at line 2279 of file hash.c.

References env, env_path_tainted(), env_str_new2(), ENVMATCH, getenv(), key, PATH_ENV, rb_block_given_p(), rb_eArgError, rb_eKeyError, rb_filesystem_encoding(), rb_filesystem_str_new_cstr(), rb_raise(), rb_scan_args(), rb_secure(), rb_str_conv_enc(), rb_str_new(), rb_utf8_encoding(), rb_warn(), rb_yield(), RSTRING_LEN, RSTRING_PTR, SafeStringValue, and strlen().

Referenced by Init_Hash().

static VALUE env_has_key | ( | VALUE | env,
|  | VALUE | key
| ) |  |
| static

Definition at line 3018 of file hash.c.

References getenv(), Qfalse, Qtrue, rb_eArgError, rb_raise(), rb_secure(), RSTRING_LEN, and StringValuePtr.

Referenced by Init_Hash().

static VALUE env_has_value | ( | VALUE | dmy,
|  | VALUE | obj
| ) |  |
| static

Definition at line 3059 of file hash.c.

References FREE_ENVIRON, GET_ENVIRON, NIL_P, Qfalse, Qnil, Qtrue, rb_check_string_type(), rb_secure(), RSTRING_LEN, RSTRING_PTR, strchr(), and strlen().

Referenced by Init_Hash().

static VALUE env_index | ( | VALUE | dmy,
|  | VALUE | value
| ) |  |
| static

Definition at line 3153 of file hash.c.

References env_key(), and rb_warn().

Referenced by Init_Hash().

static VALUE env_inspect | ( | void | ) |  |
| static

Definition at line 2893 of file hash.c.

References FREE_ENVIRON, GET_ENVIRON, i, OBJ_TAINT, rb_inspect(), rb_secure(), rb_str_buf_append(), rb_str_buf_cat(), rb_str_buf_cat2(), rb_str_buf_new2, rb_str_new2, and strchr().

Referenced by Init_Hash().

static VALUE env_invert | ( | void | ) |  |
| static

Definition at line 3237 of file hash.c.

References env_to_hash(), and rb_hash_invert().

Referenced by Init_Hash().

static VALUE env_keep_if | ( | VALUE | ehash) |  |
| static

Definition at line 2845 of file hash.c.

References env_select_bang(), envtbl, rb_env_size(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE env_key | ( | VALUE | dmy,
|  | VALUE | value
| ) |  |
| static

Definition at line 3122 of file hash.c.

References env_str_new(), FREE_ENVIRON, GET_ENVIRON, Qnil, rb_secure(), RSTRING_LEN, RSTRING_PTR, strchr(), StringValue, and strlen().

Referenced by env_index(), and Init_Hash().

static VALUE env_keys | ( | void | ) |  |
| static

Definition at line 2550 of file hash.c.

References env_str_new(), FREE_ENVIRON, GET_ENVIRON, rb_ary_new(), rb_ary_push(), rb_secure(), and strchr().

Referenced by env_each_key(), env_reject_bang(), env_replace(), env_select_bang(), Init_Hash(), and rb_env_clear().

static VALUE env_none | ( | void | ) |  |
| static

Definition at line 2961 of file hash.c.

References Qnil.

Referenced by Init_Hash().

static int env_path_tainted | ( | const char * | path) |  |
| static

Definition at line 2320 of file hash.c.

References path_tainted, and path_tainted_p().

Referenced by env_fetch(), and rb_f_getenv().

static VALUE env_rassoc | ( | VALUE | dmy,
|  | VALUE | obj
| ) |  |
| static

Definition at line 3090 of file hash.c.

References FREE_ENVIRON, GET_ENVIRON, NIL_P, Qnil, rb_assoc_new(), rb_check_string_type(), rb_secure(), rb_tainted_str_new(), result, RSTRING_LEN, RSTRING_PTR, strchr(), and strlen().

Referenced by Init_Hash().

static VALUE env_reject | ( | void | ) |  |
| static

Definition at line 3197 of file hash.c.

References env_to_hash(), and rb_hash_delete_if().

Referenced by Init_Hash().

static VALUE env_reject_bang | ( | VALUE | ehash) |  |
| static

Definition at line 2708 of file hash.c.

References env_delete(), env_keys(), envtbl, FL_TAINT, FL_UNSET, i, NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_env_size(), rb_f_getenv(), rb_yield_values(), RBASIC, RETURN_SIZED_ENUMERATOR, RTEST, and val.

Referenced by env_delete_if(), and Init_Hash().

static VALUE env_replace | ( | VALUE | env,
|  | VALUE | hash
| ) |  |
| static

Definition at line 3260 of file hash.c.

References env_delete(), env_keys(), env_replace_i(), i, RARRAY_LEN, RARRAY_PTR, rb_hash_foreach(), and to_hash().

Referenced by Init_Hash().

static int env_replace_i | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | keys
| ) |  |
| static

Definition at line 3243 of file hash.c.

References env_aset(), Qnil, rb_ary_delete(), rb_ary_includes(), and ST_CONTINUE.

Referenced by env_replace().

static VALUE env_select | ( | VALUE | ehash) |  |
| static

Definition at line 2779 of file hash.c.

References env_str_new(), env_str_new2(), FREE_ENVIRON, GET_ENVIRON, rb_env_size(), rb_hash_aset(), rb_hash_new(), rb_secure(), rb_yield_values(), result, RETURN_SIZED_ENUMERATOR, RTEST, strchr(), and v.

Referenced by Init_Hash().

static VALUE env_select_bang | ( | VALUE | ehash) |  |
| static

Definition at line 2812 of file hash.c.

References env_delete(), env_keys(), envtbl, FL_TAINT, FL_UNSET, i, NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_env_size(), rb_f_getenv(), rb_yield_values(), RBASIC, RETURN_SIZED_ENUMERATOR, RTEST, and val.

Referenced by env_keep_if(), and Init_Hash().

static VALUE env_shift | ( | void | ) |  |
| static

Definition at line 3210 of file hash.c.

References env_delete(), env_str_new(), env_str_new2(), FREE_ENVIRON, GET_ENVIRON, getenv(), key, Qnil, rb_assoc_new(), rb_secure(), RSTRING_PTR, strchr(), and val.

Referenced by Init_Hash().

static VALUE env_size | ( | void | ) |  |
| static

Definition at line 2974 of file hash.c.

References FREE_ENVIRON, GET_ENVIRON, i, INT2FIX, and rb_secure().

Referenced by Init_Hash().

static VALUE env_str_new | ( | const char * | ptr,
|  | long | len
| ) |  |
| static

Definition at line 2165 of file hash.c.

References rb_locale_encoding(), rb_locale_str_new(), rb_obj_freeze(), rb_str_conv_enc(), rb_str_new(), and rb_utf8_encoding().

Referenced by env_each_pair(), env_key(), env_keys(), env_select(), env_shift(), env_str_new2(), env_to_a(), and env_to_hash().

static VALUE env_str_new2 | ( | const char * | ptr) |  |
| static

Definition at line 2178 of file hash.c.

References env_str_new(), Qnil, and strlen().

Referenced by env_delete(), env_each_pair(), env_fetch(), env_select(), env_shift(), env_to_a(), env_to_hash(), env_values(), and rb_f_getenv().

static VALUE env_to_a | ( | void | ) |  |
| static

Definition at line 2933 of file hash.c.

References env_str_new(), env_str_new2(), FREE_ENVIRON, GET_ENVIRON, rb_ary_new(), rb_ary_push(), rb_assoc_new(), rb_secure(), and strchr().

Referenced by Init_Hash().

static VALUE env_to_hash | ( | void | ) |  |
| static

Definition at line 3168 of file hash.c.

References env_str_new(), env_str_new2(), FREE_ENVIRON, GET_ENVIRON, hash(), rb_hash_aset(), rb_hash_new(), rb_secure(), and strchr().

Referenced by env_invert(), env_reject(), and Init_Hash().

static VALUE env_to_s | ( | void | ) |  |
| static

Definition at line 2881 of file hash.c.

References rb_usascii_str_new2.

Referenced by Init_Hash().

static VALUE env_update | ( | VALUE | env,
|  | VALUE | hash
| ) |  |
| static

Definition at line 3297 of file hash.c.

References env_update_i(), rb_hash_foreach(), rb_secure(), and to_hash().

Referenced by Init_Hash().

static int env_update_i | ( | VALUE | key,
|  | VALUE | val
| ) |  |
| static

Definition at line 3277 of file hash.c.

References env_aset(), Qnil, rb_block_given_p(), rb_f_getenv(), rb_yield_values(), and ST_CONTINUE.

Referenced by env_update().

static VALUE env_values | ( | void | ) |  |
| static

Definition at line 2617 of file hash.c.

References env_str_new2(), FREE_ENVIRON, GET_ENVIRON, rb_ary_new(), rb_ary_push(), rb_secure(), and strchr().

Referenced by env_each_value(), and Init_Hash().

static VALUE env_values_at | ( | int | argc,
|  | VALUE * | argv
| ) |  |
| static

Definition at line 2756 of file hash.c.

References argc, i, Qnil, rb_ary_new(), rb_ary_push(), rb_f_getenv(), rb_secure(), and result.

Referenced by Init_Hash().

static int envix | ( | const char * | nam) |  |
| static

Definition at line 2350 of file hash.c.

References ENVNMATCH, FREE_ENVIRON, GET_ENVIRON, i, and strlen().

Referenced by ruby_setenv().

static int eql_i | ( | VALUE | key,
|  | VALUE | val1,
|  | VALUE | arg
| ) |  |
| static

Definition at line 1668 of file hash.c.

References equal_data::eql, Qfalse, rb_eql(), rb_equal(), equal_data::result, ST_CONTINUE, st_lookup(), ST_STOP, and equal_data::tbl.

Referenced by recursive_eql().

static int foreach_safe_i | ( | st_data_t | key,
|  | st_data_t | value,
|  | struct foreach_safe_arg * | arg
| ) |  |
| static

Definition at line 121 of file hash.c.

References foreach_safe_arg::arg, foreach_safe_arg::func, ST_CHECK, and ST_CONTINUE.

Referenced by st_foreach_safe().

static VALUE hash_alloc | ( | VALUE | klass) |  |
| static

Definition at line 214 of file hash.c.

References hash(), NEWOBJ_OF, Qnil, RHASH_IFNONE, and T_HASH.

Referenced by empty_hash_alloc(), rb_hash_new(), and rb_hash_s_create().

static int hash_aset | ( | st_data_t * | key,
|  | st_data_t * | val,
|  | st_data_t | arg,
|  | int | existing
| ) |  |
| static

Definition at line 1154 of file hash.c.

References arg, and ST_CONTINUE.

Referenced by hash_aset_str(), and NOINSERT_UPDATE_CALLBACK().

static int hash_aset_str | ( | st_data_t * | key,
|  | st_data_t * | val,
|  | st_data_t | arg,
|  | int | existing
| ) |  |
| static

Definition at line 1161 of file hash.c.

References hash_aset(), key, and rb_str_new_frozen().

Referenced by NOINSERT_UPDATE_CALLBACK().

static VALUE hash_default_value | ( | VALUE | hash,
|  | VALUE | key
| ) |  |
| static

Definition at line 532 of file hash.c.

References CLASS_OF, FL_TEST, HASH_PROC_DEFAULT, id_default, id_yield, Qnil, Qundef, rb_funcall(), rb_method_basic_definition_p(), and RHASH_IFNONE.

Referenced by rb_hash_aref(), and rb_hash_shift().

static VALUE hash_equal | ( | VALUE | hash1,
|  | VALUE | hash2,
|  | int | eql
| ) |  |
| static

Definition at line 1698 of file hash.c.

References equal_data::eql, FL_TEST, HASH_PROC_DEFAULT, Qfalse, Qtrue, rb_eql(), rb_equal(), rb_exec_recursive_paired(), rb_intern, rb_respond_to(), RB_TYPE_P, recursive_eql(), RHASH, RHASH_IFNONE, RHASH_SIZE, T_HASH, and equal_data::tbl.

Referenced by rb_hash_eql(), and rb_hash_equal().

static VALUE hash_foreach_call | ( | VALUE | arg) |  |
| static

Definition at line 190 of file hash.c.

References hash(), hash_foreach_iter(), Qnil, Qundef, rb_eRuntimeError, rb_raise(), RHASH, and st_foreach_check().

Referenced by rb_hash_foreach().

static VALUE hash_foreach_ensure | ( | VALUE | hash) |  |
| static

Definition at line 178 of file hash.c.

References FL_TEST, FL_UNSET, HASH_DELETED, Qundef, RHASH, RHASH_ITER_LEV, and st_cleanup_safe().

Referenced by rb_hash_foreach().

static int hash_foreach_iter | ( | st_data_t | key,
|  | st_data_t | value,
|  | st_data_t | argp
| ) |  |
| static

Definition at line 154 of file hash.c.

References hash_foreach_arg::arg, arg, FL_SET, hash_foreach_arg::func, hash_foreach_arg::hash, HASH_DELETED, key, rb_eRuntimeError, rb_raise(), RHASH, ST_CHECK, ST_CONTINUE, ST_DELETE, and ST_STOP.

Referenced by hash_foreach_call().

static int hash_i | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | arg
| ) |  |
| static

Definition at line 1769 of file hash.c.

References rb_hash(), ST_CONTINUE, and st_hash().

Referenced by recursive_hash().

void Init_Hash | ( | void | ) |  |

Definition at line 3420 of file hash.c.

References empty_hash_alloc(), env_aset(), env_assoc(), env_delete_if(), env_delete_m(), env_each_key(), env_each_pair(), env_each_value(), env_empty_p(), env_fetch(), env_has_key(), env_has_value(), env_index(), env_inspect(), env_invert(), env_keep_if(), env_key(), env_keys(), env_none(), env_rassoc(), env_reject(), env_reject_bang(), env_replace(), env_select(), env_select_bang(), env_shift(), env_size(), env_to_a(), env_to_hash(), env_to_s(), env_update(), env_values(), env_values_at(), environ, envtbl, id_default, id_hash, id_yield, rb_cHash, rb_cObject, rb_define_alias(), rb_define_alloc_func(), rb_define_class(), rb_define_global_const(), rb_define_method(), rb_define_singleton_method(), rb_env_clear(), rb_extend_object(), rb_f_getenv(), rb_hash_aref(), rb_hash_aset(), rb_hash_assoc(), rb_hash_clear(), rb_hash_compare_by_id(), rb_hash_compare_by_id_p(), rb_hash_default(), rb_hash_default_proc(), rb_hash_delete(), rb_hash_delete_if(), rb_hash_each_key(), rb_hash_each_pair(), rb_hash_each_value(), rb_hash_empty_p(), rb_hash_eql(), rb_hash_equal(), rb_hash_fetch_m(), rb_hash_flatten(), rb_hash_has_key(), rb_hash_has_value(), rb_hash_hash(), rb_hash_index(), rb_hash_initialize(), rb_hash_initialize_copy(), rb_hash_inspect(), rb_hash_invert(), rb_hash_keep_if(), rb_hash_key(), rb_hash_keys(), rb_hash_merge(), rb_hash_rassoc(), rb_hash_rehash(), rb_hash_reject(), rb_hash_reject_bang(), rb_hash_replace(), rb_hash_s_create(), rb_hash_s_try_convert(), rb_hash_select(), rb_hash_select_bang(), rb_hash_set_default(), rb_hash_set_default_proc(), rb_hash_shift(), rb_hash_size(), rb_hash_to_a(), rb_hash_to_h(), rb_hash_to_hash(), rb_hash_update(), rb_hash_values(), rb_hash_values_at(), rb_include_module(), rb_intern, rb_mEnumerable, and rb_obj_alloc().

static VALUE inspect_hash | ( | VALUE | hash,
|  | VALUE | dummy,
|  | int | recur
| ) |  |
| static

Definition at line 1470 of file hash.c.

References inspect_i(), OBJ_INFECT, rb_hash_foreach(), rb_str_buf_cat2(), rb_str_buf_new2, and rb_usascii_str_new2.

Referenced by rb_hash_inspect().

static int inspect_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | str
| ) |  |
| static

Definition at line 1448 of file hash.c.

References OBJ_INFECT, rb_enc_copy(), rb_inspect(), rb_str_buf_append(), rb_str_buf_cat_ascii(), RSTRING_LEN, and ST_CONTINUE.

Referenced by inspect_hash().

static int keep_if_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | hash
| ) |  |
| static

Definition at line 1066 of file hash.c.

References rb_yield_values(), RTEST, ST_CONTINUE, and ST_DELETE.

Referenced by rb_hash_keep_if(), and rb_hash_select_bang().

static int key_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | arg
| ) |  |
| static

Definition at line 776 of file hash.c.

References args, key, rb_equal(), ST_CONTINUE, and ST_STOP.

Referenced by rb_hash_key().

static int keys_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | ary
| ) |  |
| static

Definition at line 1540 of file hash.c.

References rb_ary_push(), and ST_CONTINUE.

Referenced by rb_hash_keys().

static void no_new_key | ( | void | ) |  |
| static

Definition at line 283 of file hash.c.

References rb_eRuntimeError, and rb_raise().

Referenced by NOINSERT_UPDATE_CALLBACK().

static NOINSERT_UPDATE_CALLBACK | ( | hash_aset | ) |  |
| static

Definition at line 1167 of file hash.c.

References hash_aset(), hash_aset_str(), identhash, no_new_key(), rb_cString, rb_hash_modify(), rb_obj_class(), RHASH, RHASH_ITER_LEV, RHASH_TBL, RHASH_UPDATE_ITER, st_table::type, and shift_var::val.

static NOINSERT_UPDATE_CALLBACK | ( | rb_hash_update_callback | ) |  |
| static

Definition at line 1846 of file hash.c.

References rb_hash_update_callback(), RHASH_UPDATE, and ST_CONTINUE.

static NOINSERT_UPDATE_CALLBACK | ( | rb_hash_update_block_callback | ) |  |
| static

Definition at line 1866 of file hash.c.

References rb_hash_update_block_callback(), RHASH_UPDATE, and ST_CONTINUE.

static NOINSERT_UPDATE_CALLBACK | ( | rb_hash_update_func_callback | ) |  |
| static

Definition at line 1930 of file hash.c.

References arg, update_arg::hash, rb_hash_update_func_callback(), RHASH_UPDATE, ST_CONTINUE, and update_arg::value.

NORETURN | ( | static void | no_new_keyvoid) |  |

static void path_tainted_p | ( | const char * | path) |  |
| static

Definition at line 2314 of file hash.c.

References rb_path_check().

Referenced by env_aset(), env_path_tainted(), and rb_env_path_tainted().

static int rassoc_i | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | arg
| ) |  |
| static

Definition at line 2024 of file hash.c.

References args, rb_assoc_new(), rb_equal(), RTEST, ST_CONTINUE, and ST_STOP.

Referenced by rb_hash_rassoc().

static int rb_any_cmp | ( | VALUE | a,
|  | VALUE | b
| ) |  |
| static

Definition at line 47 of file hash.c.

References FIXNUM_P, Qundef, rb_cString, rb_eql(), rb_str_hash_cmp(), RB_TYPE_P, RBASIC, SYMBOL_P, and T_STRING.

static st_index_t rb_any_hash | ( | VALUE | a) |  |
| static

Definition at line 84 of file hash.c.

References BUILTIN_TYPE, FIX2LONG, Qundef, rb_hash(), rb_hash_end, rb_hash_start(), rb_str_hash(), SPECIAL_CONST_P, and T_STRING.

VALUE rb_check_hash_type | ( | VALUE | hash) |  |

Definition at line 461 of file hash.c.

References rb_check_convert_type(), and T_HASH.

Referenced by get_hash(), rb_econv_prepare_options(), rb_exec_getargs(), rb_Hash(), rb_hash_s_try_convert(), rb_io_s_popen(), rb_scan_args(), rb_str_sub_bang(), str_gsub(), and vm_callee_setup_keyword_arg().

VALUE rb_env_clear | ( | void | ) |  |

Definition at line 2859 of file hash.c.

References env_delete(), env_keys(), envtbl, i, NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_f_getenv(), and val.

Referenced by Init_Hash(), and rb_execarg_run_options().

int rb_env_path_tainted | ( | void | ) |  |

Definition at line 2329 of file hash.c.

References getenv(), PATH_ENV, path_tainted, and path_tainted_p().

Referenced by security().

static VALUE rb_env_size | ( | VALUE | ehash) |  |
| static

Definition at line 2570 of file hash.c.

References cnt, FREE_ENVIRON, GET_ENVIRON, LONG2FIX, rb_secure(), and strchr().

Referenced by env_delete_if(), env_each_key(), env_each_pair(), env_each_value(), env_keep_if(), env_reject_bang(), env_select(), and env_select_bang().

static VALUE rb_f_getenv | ( | VALUE | obj,
|  | VALUE | name
| ) |  |
| static

Definition at line 2237 of file hash.c.

References env, env_path_tainted(), env_str_new2(), ENVMATCH, getenv(), PATH_ENV, Qnil, rb_eArgError, rb_filesystem_encoding(), rb_filesystem_str_new_cstr(), rb_obj_freeze(), rb_raise(), rb_secure(), rb_str_conv_enc(), rb_str_new(), rb_utf8_encoding(), RSTRING_LEN, RSTRING_PTR, SafeStringValue, and strlen().

Referenced by env_reject_bang(), env_select_bang(), env_update_i(), env_values_at(), Init_Hash(), and rb_env_clear().

VALUE rb_hash | ( | VALUE | obj) |  |

Definition at line 66 of file hash.c.

References id_hash, LONG2FIX, rb_funcall(), rb_to_int(), RBIGNUM_DIGITS, T_BIGNUM, T_FIXNUM, and TYPE.

Referenced by cdhash_hash(), hash_i(), nucomp_hash(), nurat_hash(), rb_any_hash(), recursive_hash(), and time_hash().

VALUE rb_hash_aref | ( | VALUE | hash,
|  | VALUE | key
| ) |  |

Definition at line 560 of file hash.c.

References hash_default_value(), RHASH, st_lookup(), and val.

Referenced by cbsubst_get_subst_arg(), cbsubst_scan_args(), cbsubst_sym_to_subst(), cParser_initialize(), cState_configure(), cto_i(), dir_initialize(), econv_opts(), econv_primitive_convert(), extract_binmode(), generate_json_object(), group_by_i(), hash2ptr_dispparams(), hash2result(), Init_Hash(), io_s_write(), iseq_build_from_ary_body(), JSON_parse_object(), mString_Extend_json_create(), open_key_args(), parse_main(), pruby_get_instance(), rawmode_opt(), rb_econv_open_opts(), rb_econv_prepare_options(), rb_hash_values_at(), rb_io_extract_modeenc(), rb_io_initialize(), rb_str_sub_bang(), rb_thread_variable_get(), rb_threadptr_pending_interrupt_check_mask(), realpath_rec(), recursive_list_access(), str_gsub(), tk_do_callback(), tr_setup_table(), transcode_loop(), and zstream_run().

VALUE rb_hash_assoc | ( | VALUE | hash,
|  | VALUE | obj
| ) |  |

Definition at line 2013 of file hash.c.

References args, assoc_i(), Qnil, and rb_hash_foreach().

Referenced by Init_Hash().

VALUE rb_hash_clear | ( | VALUE | hash) |  |

Definition at line 1138 of file hash.c.

References clear_i(), hash(), rb_hash_foreach(), rb_hash_modify_check(), RHASH, RHASH_ITER_LEV, and st_clear().

Referenced by Init_Hash(), and rb_hash_replace().

static VALUE rb_hash_compare_by_id | ( | VALUE | hash) |  |
| static

Definition at line 2107 of file hash.c.

References hash(), identhash, rb_hash_modify(), rb_hash_rehash(), and RHASH.

Referenced by Init_Hash().

static VALUE rb_hash_compare_by_id_p | ( | VALUE | hash) |  |
| static

Definition at line 2125 of file hash.c.

References identhash, Qfalse, Qtrue, and RHASH.

Referenced by Init_Hash().

static VALUE rb_hash_default | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | hash
| ) |  |
| static

Definition at line 672 of file hash.c.

References FL_TEST, HASH_PROC_DEFAULT, id_yield, key, Qnil, rb_funcall(), rb_scan_args(), and RHASH_IFNONE.

Referenced by Init_Hash().

static VALUE rb_hash_default_proc | ( | VALUE | hash) |  |
| static

Definition at line 730 of file hash.c.

References FL_TEST, HASH_PROC_DEFAULT, Qnil, and RHASH_IFNONE.

Referenced by Init_Hash().

VALUE rb_hash_delete | ( | VALUE | hash,
|  | VALUE | key
| ) |  |

Definition at line 859 of file hash.c.

References Qnil, Qundef, rb_block_given_p(), rb_hash_delete_key(), rb_hash_modify_check(), rb_yield(), and val.

Referenced by Init_Hash(), pruby_unregister_instance(), recursive_pop(), tk_uninstall_cmd(), and unknown_keyword_error().

VALUE rb_hash_delete_if | ( | VALUE | hash) |  |

Definition at line 959 of file hash.c.

References delete_if_i(), hash(), rb_hash_foreach(), rb_hash_modify_check(), rb_hash_size(), RETURN_SIZED_ENUMERATOR, and RHASH.

Referenced by env_reject(), fdbm_reject(), fgdbm_reject(), fsdbm_reject(), Init_Hash(), and rb_hash_reject().

static VALUE rb_hash_delete_key | ( | VALUE | hash,
|  | VALUE | key
| ) |  |
| static

Definition at line 823 of file hash.c.

References FL_SET, HASH_DELETED, Qundef, RHASH, RHASH_ITER_LEV, st_delete(), st_delete_safe(), and val.

Referenced by delete_if_i(), rb_hash_delete(), and rb_hash_shift().

VALUE rb_hash_dup | ( | VALUE | hash) |  |

Definition at line 240 of file hash.c.

References FL_EXIVAR, FL_SET, FL_TAINT, FL_TEST, FL_UNTRUSTED, HASH_PROC_DEFAULT, NEWOBJ_OF, rb_copy_generic_ivar(), rb_obj_class(), RBASIC, RHASH, RHASH_EMPTY_P, RHASH_IFNONE, st_copy(), and T_MASK.

Referenced by io_s_write(), and rb_using_refinement().

static VALUE rb_hash_each_key | ( | VALUE | hash) |  |
| static

Definition at line 1373 of file hash.c.

References each_key_i(), hash(), rb_hash_foreach(), rb_hash_size(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE rb_hash_each_pair | ( | VALUE | hash) |  |
| static

Definition at line 1410 of file hash.c.

References each_pair_i(), hash(), rb_hash_foreach(), rb_hash_size(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE rb_hash_each_value | ( | VALUE | hash) |  |
| static

Definition at line 1340 of file hash.c.

References each_value_i(), hash(), rb_hash_foreach(), rb_hash_size(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

static VALUE rb_hash_empty_p | ( | VALUE | hash) |  |
| static

Definition at line 1308 of file hash.c.

References Qfalse, Qtrue, and RHASH_EMPTY_P.

Referenced by Init_Hash().

static VALUE rb_hash_eql | ( | VALUE | hash1,
|  | VALUE | hash2
| ) |  |
| static

Definition at line 1763 of file hash.c.

References hash_equal(), and TRUE.

Referenced by Init_Hash().

static VALUE rb_hash_equal | ( | VALUE | hash1,
|  | VALUE | hash2
| ) |  |
| static

Definition at line 1749 of file hash.c.

References FALSE, and hash_equal().

Referenced by Init_Hash().

VALUE rb_hash_fetch | ( | VALUE | hash,
|  | VALUE | key
| ) |  |

Definition at line 645 of file hash.c.

References rb_hash_fetch_m().

static VALUE rb_hash_fetch_m | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | hash
| ) |  |
| static

Definition at line 617 of file hash.c.

References key, NIL_P, rb_any_to_s(), rb_block_given_p(), rb_eKeyError, rb_inspect(), rb_protect(), rb_raise(), rb_scan_args(), rb_str_ellipsize(), rb_warn(), rb_yield(), RHASH, RSTRING_PTR, st_lookup(), and val.

Referenced by Init_Hash(), and rb_hash_fetch().

static VALUE rb_hash_flatten | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | hash
| ) |  |
| static

Definition at line 2076 of file hash.c.

References INT2FIX, rb_funcall2(), rb_hash_to_a(), and rb_intern.

Referenced by Init_Hash().

void rb_hash_foreach | ( | VALUE | hash,
|  | int(*)(ANYARGS) | func,
|  | VALUE | farg
| ) |  |

Definition at line 200 of file hash.c.

References hash_foreach_arg::arg, func, hash_foreach_arg::func, hash(), hash_foreach_arg::hash, hash_foreach_call(), hash_foreach_ensure(), rb_ensure(), RHASH, and RHASH_ITER_LEV.

Referenced by cbsubst_def_attr_aliases(), env_replace(), env_update(), initialize(), inspect_hash(), iseq_data_to_ary(), iseq_set_sequence(), JSON_parse_string(), m_core_hash_merge_kwd(), rb_hash_assoc(), rb_hash_clear(), rb_hash_delete_if(), rb_hash_each_key(), rb_hash_each_pair(), rb_hash_each_value(), rb_hash_has_value(), rb_hash_invert(), rb_hash_keep_if(), rb_hash_key(), rb_hash_keys(), rb_hash_rassoc(), rb_hash_rehash(), rb_hash_reject_bang(), rb_hash_replace(), rb_hash_select(), rb_hash_select_bang(), rb_hash_shift(), rb_hash_to_a(), rb_hash_update(), rb_hash_update_by(), rb_hash_values(), rb_thread_s_handle_interrupt(), rb_thread_variables(), rb_using_module(), recursive_eql(), recursive_hash(), and w_object().

VALUE rb_hash_freeze | ( | VALUE | hash) |  |

Definition at line 36 of file hash.c.

References rb_obj_freeze().

Referenced by rb_coverage_result(), and rb_econv_prepare_options().

static VALUE rb_hash_has_key | ( | VALUE | hash,
|  | VALUE | key
| ) |  |
| static

Definition at line 1615 of file hash.c.

References Qfalse, Qtrue, RHASH, and st_lookup().

Referenced by Init_Hash().

static VALUE rb_hash_has_value | ( | VALUE | hash,
|  | VALUE | val
| ) |  |
| static

Definition at line 1651 of file hash.c.

References Qfalse, rb_hash_foreach(), rb_hash_search_value(), and shift_var::val.

Referenced by Init_Hash().

static VALUE rb_hash_hash | ( | VALUE | hash) |  |
| static

Definition at line 1806 of file hash.c.

References rb_exec_recursive_outer(), and recursive_hash().

Referenced by Init_Hash().

static VALUE rb_hash_index | ( | VALUE | hash,
|  | VALUE | value
| ) |  |
| static

Definition at line 816 of file hash.c.

References rb_hash_key(), and rb_warn().

Referenced by Init_Hash().

static VALUE rb_hash_initialize | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | hash
| ) |  |
| static

Definition at line 352 of file hash.c.

References default_proc_arity_check(), FL_SET, hash(), HASH_PROC_DEFAULT, rb_block_given_p(), rb_block_proc(), rb_check_arity, rb_hash_modify(), rb_scan_args(), and RHASH_IFNONE.

Referenced by Init_Hash().

static VALUE rb_hash_initialize_copy | ( | VALUE | hash,
|  | VALUE | hash2
| ) |  |
| static

Definition at line 1217 of file hash.c.

References Check_Type, FL_SET, FL_TEST, FL_UNSET, hash(), HASH_PROC_DEFAULT, rb_hash_modify_check(), rb_hash_rehash(), RHASH, RHASH_EMPTY_P, RHASH_IFNONE, st_copy(), T_HASH, and to_hash().

Referenced by Init_Hash().

static VALUE rb_hash_inspect | ( | VALUE | hash) |  |
| static

Definition at line 1495 of file hash.c.

References inspect_hash(), rb_exec_recursive(), rb_usascii_str_new2, and RHASH_EMPTY_P.

Referenced by Init_Hash().

static VALUE rb_hash_invert | ( | VALUE | hash) |  |
| static

Definition at line 1831 of file hash.c.

References rb_hash_foreach(), rb_hash_invert_i(), and rb_hash_new().

Referenced by env_invert(), and Init_Hash().

static int rb_hash_invert_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | hash
| ) |  |
| static

Definition at line 1812 of file hash.c.

References rb_hash_aset(), and ST_CONTINUE.

Referenced by rb_hash_invert().

VALUE rb_hash_keep_if | ( | VALUE | hash) |  |

Definition at line 1111 of file hash.c.

References hash(), keep_if_i(), rb_hash_foreach(), rb_hash_modify_check(), rb_hash_size(), RETURN_SIZED_ENUMERATOR, and RHASH.

Referenced by Init_Hash().

static VALUE rb_hash_key | ( | VALUE | hash,
|  | VALUE | value
| ) |  |
| static

Definition at line 802 of file hash.c.

References args, key_i(), Qnil, and rb_hash_foreach().

Referenced by Init_Hash(), and rb_hash_index().

static VALUE rb_hash_keys | ( | VALUE | hash) |  |
| static

Definition at line 1559 of file hash.c.

References keys_i(), rb_ary_new(), and rb_hash_foreach().

Referenced by Init_Hash().

VALUE rb_hash_lookup | ( | VALUE | hash,
|  | VALUE | key
| ) |  |

Definition at line 582 of file hash.c.

References Qnil, and rb_hash_lookup2().

VALUE rb_hash_lookup2 | ( | VALUE | hash,
|  | VALUE | key,
|  | VALUE | def
| ) |  |

Definition at line 571 of file hash.c.

References RHASH, st_lookup(), and val.

Referenced by ary_add_hash_by(), rb_ary_sample(), rb_ary_shuffle_bang(), rb_hash_lookup(), rb_io_extract_encoding_option(), recursive_check(), recursive_pop(), and recursive_push().

static VALUE rb_hash_merge | ( | VALUE | hash1,
|  | VALUE | hash2
| ) |  |
| static

Definition at line 1981 of file hash.c.

References rb_hash_update(), and rb_obj_dup().

Referenced by Init_Hash().

static void rb_hash_modify | ( | VALUE | hash) |  |
| static

Definition at line 275 of file hash.c.

References rb_hash_modify_check(), and rb_hash_tbl().

Referenced by NOINSERT_UPDATE_CALLBACK(), rb_hash_compare_by_id(), rb_hash_initialize(), rb_hash_reject_bang(), rb_hash_update(), and rb_hash_update_by().

static void rb_hash_modify_check | ( | VALUE | hash) |  |
| static

Definition at line 258 of file hash.c.

References OBJ_UNTRUSTED, rb_check_frozen, rb_eSecurityError, rb_raise(), and rb_safe_level.

Referenced by rb_hash_clear(), rb_hash_delete(), rb_hash_delete_if(), rb_hash_initialize_copy(), rb_hash_keep_if(), rb_hash_modify(), rb_hash_rehash(), rb_hash_replace(), rb_hash_select_bang(), rb_hash_set_default(), rb_hash_set_default_proc(), and rb_hash_shift().

VALUE rb_hash_new | ( | void | ) |  |

Definition at line 234 of file hash.c.

References hash_alloc(), and rb_cHash.

Referenced by allocate_cbsubst_info(), ary_tmp_hash_new(), check_exec_fds(), check_exec_options_i_extract(), count_nodes(), count_objects(), count_objects_size(), count_tdata_objects(), create_encoding_table_core(), cState_to_h(), date__httpdate(), date__iso8601(), date__jisx0301(), date__parse(), date__rfc2822(), date__rfc3339(), date__xmlschema(), date_s__strptime_internal(), date_zone_to_diff(), enum_group_by(), env_select(), env_to_hash(), fdbm_invert(), fdbm_to_hash(), fgdbm_invert(), fgdbm_to_hash(), fsdbm_invert(), fsdbm_to_hash(), gc_profile_record_get(), gc_stat(), hidden_identity_hash_new(), Init_ossl_asn1(), Init_ossl_x509name(), Init_tkutil(), Init_VM(), io_s_write(), iseq_compile_each(), iseq_data_to_ary(), JSON_parse_object(), m_core_hash_from_ary(), make_compile_option_value(), mString_to_json_raw_object(), nil_to_h(), ole_const_load(), ossl_dh_get_params(), ossl_dsa_get_params(), ossl_rsa_get_params(), ossl_sslctx_get_session_cache_stats(), pruby_init(), r_object0(), rb_coverage_result(), rb_coverage_start(), rb_econv_prepare_options(), rb_enc_aliases(), rb_execarg_fixup(), rb_Hash(), rb_hash_invert(), rb_hash_select(), rb_hash_to_h(), rb_inflate_s_allocate(), rb_realpath_internal(), rb_reg_named_captures(), rb_struct_to_h(), rb_uninterruptible(), rb_w32_init_file(), recursive_list_access(), recursive_push(), ripper_init_eventids1_table(), ripper_init_eventids2_table(), ruby_thread_init(), separate_symbol(), sig_list(), tk_symbolkey2str(), tr_setup_table(), tr_trans(), vm_callee_setup_keyword_arg(), and vm_default_params().

VALUE rb_hash_rassoc | ( | VALUE | hash,
|  | VALUE | obj
| ) |  |

Definition at line 2049 of file hash.c.

References args, Qnil, rassoc_i(), and rb_hash_foreach().

Referenced by Init_Hash().

static VALUE rb_hash_rehash | ( | VALUE | hash) |  |
| static

Definition at line 513 of file hash.c.

References hash(), rb_eRuntimeError, rb_hash_foreach(), rb_hash_modify_check(), rb_hash_rehash_i(), rb_raise(), RHASH, RHASH_ITER_LEV, st_free_table(), and st_init_table_with_size().

Referenced by Init_Hash(), rb_hash_compare_by_id(), and rb_hash_initialize_copy().

static int rb_hash_rehash_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | arg
| ) |  |
| static

Definition at line 484 of file hash.c.

References ST_CONTINUE, and st_insert().

Referenced by rb_hash_rehash().

static VALUE rb_hash_reject | ( | VALUE | hash) |  |
| static

Definition at line 1004 of file hash.c.

References rb_hash_delete_if(), and rb_obj_dup().

Referenced by Init_Hash().

VALUE rb_hash_reject_bang | ( | VALUE | hash) |  |

Definition at line 978 of file hash.c.

References delete_if_i(), hash(), Qnil, rb_hash_foreach(), rb_hash_modify(), rb_hash_size(), RETURN_SIZED_ENUMERATOR, and RHASH.

Referenced by Init_Hash().

static VALUE rb_hash_replace | ( | VALUE | hash,
|  | VALUE | hash2
| ) |  |
| static

Definition at line 1253 of file hash.c.

References FL_SET, FL_TEST, FL_UNSET, hash(), HASH_PROC_DEFAULT, rb_hash_clear(), rb_hash_foreach(), rb_hash_modify_check(), rb_hash_tbl(), replace_i(), RHASH, RHASH_IFNONE, and to_hash().

Referenced by Init_Hash().

static VALUE rb_hash_s_create | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | klass
| ) |  |
| static

Definition at line 390 of file hash.c.

References argc, hash(), hash_alloc(), i, key, NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR, rb_builtin_class_name(), rb_check_array_type(), rb_eArgError, rb_hash_aset(), rb_hash_s_try_convert(), rb_raise(), rb_warn(), RHASH, st_copy(), v, and val.

Referenced by Init_Hash().

static VALUE rb_hash_s_try_convert | ( | VALUE | dummy,
|  | VALUE | hash
| ) |  |
| static

Definition at line 478 of file hash.c.

References rb_check_hash_type().

Referenced by Init_Hash(), and rb_hash_s_create().

static int rb_hash_search_value | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | arg
| ) |  |
| static

Definition at line 1626 of file hash.c.

References Qtrue, rb_equal(), ST_CONTINUE, and ST_STOP.

Referenced by rb_hash_has_value().

VALUE rb_hash_select | ( | VALUE | hash) |  |

Definition at line 1055 of file hash.c.

References rb_hash_foreach(), rb_hash_new(), rb_hash_size(), result, RETURN_SIZED_ENUMERATOR, and select_i().

Referenced by Init_Hash().

VALUE rb_hash_select_bang | ( | VALUE | hash) |  |

Definition at line 1084 of file hash.c.

References hash(), keep_if_i(), Qnil, rb_hash_foreach(), rb_hash_modify_check(), rb_hash_size(), RETURN_SIZED_ENUMERATOR, and RHASH.

Referenced by Init_Hash().

static VALUE rb_hash_set_default | ( | VALUE | hash,
|  | VALUE | ifnone
| ) |  |
| static

Definition at line 706 of file hash.c.

References FL_UNSET, HASH_PROC_DEFAULT, rb_hash_modify_check(), and RHASH_IFNONE.

Referenced by Init_Hash().

static VALUE rb_hash_set_default_proc | ( | VALUE | hash,
|  | VALUE | proc
| ) |  |
| static

Definition at line 752 of file hash.c.

References default_proc_arity_check(), FL_SET, FL_UNSET, HASH_PROC_DEFAULT, NIL_P, rb_check_convert_type(), rb_eTypeError, rb_hash_modify_check(), rb_obj_classname(), rb_obj_is_proc(), rb_raise(), RHASH_IFNONE, and T_DATA.

Referenced by Init_Hash().

static VALUE rb_hash_shift | ( | VALUE | hash) |  |
| static

Definition at line 912 of file hash.c.

References hash_default_value(), shift_var::key, Qnil, Qundef, rb_assoc_new(), rb_hash_delete_key(), rb_hash_foreach(), rb_hash_modify_check(), RHASH, RHASH_ITER_LEV, shift_i(), and shift_i_safe().

Referenced by Init_Hash().

static VALUE rb_hash_size | ( | VALUE | hash) |  |
| static

Definition at line 1289 of file hash.c.

References INT2FIX, and RHASH.

Referenced by Init_Hash(), rb_hash_delete_if(), rb_hash_each_key(), rb_hash_each_pair(), rb_hash_each_value(), rb_hash_keep_if(), rb_hash_reject_bang(), rb_hash_select(), and rb_hash_select_bang().

struct st_table* rb_hash_tbl | ( | VALUE | hash) |  |

Definition at line 266 of file hash.c.

References RHASH, and st_init_table().

Referenced by rb_hash_modify(), and rb_hash_replace().

static VALUE rb_hash_to_a | ( | VALUE | hash) |  |
| static

Definition at line 1436 of file hash.c.

References OBJ_INFECT, rb_ary_new(), rb_hash_foreach(), and to_a_i().

Referenced by Init_Hash(), and rb_hash_flatten().

static VALUE rb_hash_to_h | ( | VALUE | hash) |  |
| static

Definition at line 1524 of file hash.c.

References FL_SET, FL_TEST, hash(), HASH_PROC_DEFAULT, rb_cHash, rb_hash_new(), rb_obj_class(), RHASH, RHASH_EMPTY_P, RHASH_IFNONE, and st_copy().

Referenced by Init_Hash().

static VALUE rb_hash_to_hash | ( | VALUE | hash) |  |
| static

Definition at line 1510 of file hash.c.

References hash().

Referenced by Init_Hash().

static VALUE rb_hash_update | ( | VALUE | hash1,
|  | VALUE | hash2
| ) |  |
| static

Definition at line 1899 of file hash.c.

References rb_block_given_p(), rb_hash_foreach(), rb_hash_modify(), and to_hash().

Referenced by Init_Hash(), and rb_hash_merge().

static int rb_hash_update_block_callback | ( | st_data_t * | key,
|  | st_data_t * | value,
|  | st_data_t | arg,
|  | int | existing
| ) |  |
| static

Definition at line 1856 of file hash.c.

References rb_yield_values(), and ST_CONTINUE.

Referenced by NOINSERT_UPDATE_CALLBACK().

VALUE rb_hash_update_by | ( | VALUE | hash1,
|  | VALUE | hash2,
|  | rb_hash_update_func * | func
| ) |  |

Definition at line 1944 of file hash.c.

References func, update_arg::func, update_arg::hash, rb_hash_foreach(), rb_hash_modify(), and to_hash().

static int rb_hash_update_callback | ( | st_data_t * | key,
|  | st_data_t * | value,
|  | st_data_t | arg,
|  | int | existing
| ) |  |
| static

Definition at line 1840 of file hash.c.

References arg, and ST_CONTINUE.

Referenced by NOINSERT_UPDATE_CALLBACK().

static int rb_hash_update_func_callback | ( | st_data_t * | key,
|  | st_data_t * | value,
|  | st_data_t | arg0,
|  | int | existing
| ) |  |
| static

Definition at line 1919 of file hash.c.

References arg, update_arg::func, key, ST_CONTINUE, and update_arg::value.

Referenced by NOINSERT_UPDATE_CALLBACK().

static VALUE rb_hash_values | ( | VALUE | hash) |  |
| static

Definition at line 1589 of file hash.c.

References rb_ary_new(), rb_hash_foreach(), and values_i().

Referenced by Init_Hash().

VALUE rb_hash_values_at | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | hash
| ) |  |

Definition at line 1021 of file hash.c.

References argc, i, rb_ary_new2(), rb_ary_push(), rb_hash_aref(), and result.

Referenced by Init_Hash().

static VALUE recursive_eql | ( | VALUE | hash,
|  | VALUE | dt,
|  | int | recur
| ) |  |
| static

Definition at line 1685 of file hash.c.

References eql_i(), Qtrue, rb_hash_foreach(), and equal_data::result.

Referenced by hash_equal().

static VALUE recursive_hash | ( | VALUE | hash,
|  | VALUE | dummy,
|  | int | recur
| ) |  |
| static

Definition at line 1781 of file hash.c.

References hash_i(), INT2FIX, LONG2FIX, rb_cHash, rb_hash(), rb_hash_end, rb_hash_foreach(), rb_hash_start(), rb_hash_uint, and RHASH.

Referenced by rb_hash_hash().

static int replace_i | ( | VALUE | key,
|  | VALUE | val,
|  | VALUE | hash
| ) |  |
| static

Definition at line 1209 of file hash.c.

References rb_hash_aset(), and ST_CONTINUE.

Referenced by rb_hash_replace().

void ruby_setenv | ( | const char * | name,
|  | const char * | value
| ) |  |

Definition at line 2381 of file hash.c.

References ALLOC_N, buf, envix(), errno, fail, free(), GET_ENVIRON, i, malloc, max(), origenviron, rb_sprintf(), rb_str_resize(), rb_sys_fail(), REALLOC_N, RSTRING_PTR, ruby_strdup(), setenv, snprintf, strchr(), strlen(), unsetenv, and xfree.

Referenced by env_aset(), env_delete(), rb_execarg_run_options(), and ruby_unsetenv().

void ruby_unsetenv | ( | const char * | name) |  |

Definition at line 2493 of file hash.c.

References ruby_setenv().

static int select_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | result
| ) |  |
| static

Definition at line 1033 of file hash.c.

References rb_hash_aset(), rb_yield_values(), RTEST, and ST_CONTINUE.

Referenced by rb_hash_select().

static int shift_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | arg
| ) |  |
| static

Definition at line 878 of file hash.c.

References shift_var::key, key, Qundef, ST_DELETE, ST_STOP, and shift_var::val.

Referenced by rb_hash_shift().

static int shift_i_safe | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | arg
| ) |  |
| static

Definition at line 889 of file hash.c.

References shift_var::key, key, ST_STOP, and shift_var::val.

Referenced by rb_hash_shift().

void st_foreach_safe | ( | st_table * | table,
|  | int(*)(ANYARGS) | func,
|  | st_data_t | a
| ) |  |

Definition at line 133 of file hash.c.

References foreach_safe_arg::arg, foreach_safe_i(), func, foreach_safe_arg::func, rb_eRuntimeError, rb_raise(), st_foreach_check(), and foreach_safe_arg::tbl.

Referenced by cvar_list(), find_class_path(), givar_i(), mod_cvar_at(), obj_ivar_each(), rb_const_list(), rb_f_global_variables(), rb_gc_mark_global_tbl(), rb_ivar_foreach(), rb_mark_generic_ivar_tbl(), rb_mod_const_at(), and w_ivar().

static int to_a_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | ary
| ) |  |
| static

Definition at line 1418 of file hash.c.

References rb_ary_push(), rb_assoc_new(), and ST_CONTINUE.

Referenced by rb_hash_to_a().

static VALUE to_hash | ( | VALUE | hash) |  |
| static

Definition at line 455 of file hash.c.

References rb_convert_type(), and T_HASH.

Referenced by env_replace(), env_update(), rb_hash_initialize_copy(), rb_hash_replace(), rb_hash_update(), and rb_hash_update_by().

static int values_i | ( | VALUE | key,
|  | VALUE | value,
|  | VALUE | ary
| ) |  |
| static

Definition at line 1570 of file hash.c.

References rb_ary_push(), and ST_CONTINUE.

Referenced by rb_hash_values().

## Variable Documentation

char** environ

Definition at line 6 of file missing-pips.c.

VALUE envtbl
| static

Definition at line 43 of file hash.c.

Referenced by env_delete_if(), env_keep_if(), env_reject_bang(), env_select_bang(), Init_Hash(), rb_env_clear(), and rb_execarg_fixup().

ID id_default
| static

Definition at line 44 of file hash.c.

Referenced by hash_default_value(), and Init_Hash().

ID id_hash
| static

Definition at line 44 of file hash.c.

Referenced by Init_Hash(), and rb_hash().

ID id_yield
| static

Definition at line 44 of file hash.c.

Referenced by hash_default_value(), Init_Hash(), and rb_hash_default().

struct st_hash_type objhash
| static

Initial value:
= {
rb_any_cmp,
rb_any_hash,
}

Definition at line 104 of file hash.c.

char** origenviron
| static

Definition at line 2137 of file hash.c.

Referenced by ruby_setenv().

int path_tainted = -1
| static

Definition at line 2135 of file hash.c.

Referenced by env_path_tainted(), and rb_env_path_tainted().

VALUE rb_cHash

Definition at line 41 of file hash.c.

struct st_hash_type st_hashtype_num

Referenced by STATIC_ASSERT().