Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Macros | Typedefs | Functions
hash.h File Reference

Public APIs related to rb_cHash. More...

#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
#include "ruby/st.h"

Go to the source code of this file.

Macros

#define st_foreach_safe   rb_st_foreach_safe
 

Typedefs

typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value)
 

Functions

void rb_st_foreach_safe (struct st_table *, int(*)(st_data_t, st_data_t, st_data_t), st_data_t)
 
VALUE rb_check_hash_type (VALUE)
 
void rb_hash_foreach (VALUE, int(*)(VALUE, VALUE, VALUE), VALUE)
 
VALUE rb_hash (VALUE)
 
VALUE rb_hash_new (void)
 
VALUE rb_hash_dup (VALUE)
 
VALUE rb_hash_freeze (VALUE)
 
VALUE rb_hash_aref (VALUE, VALUE)
 
VALUE rb_hash_lookup (VALUE, VALUE)
 
VALUE rb_hash_lookup2 (VALUE, VALUE, VALUE)
 
VALUE rb_hash_fetch (VALUE, VALUE)
 
VALUE rb_hash_aset (VALUE, VALUE, VALUE)
 
VALUE rb_hash_clear (VALUE)
 
VALUE rb_hash_delete_if (VALUE)
 
VALUE rb_hash_delete (VALUE, VALUE)
 
VALUE rb_hash_set_ifnone (VALUE hash, VALUE ifnone)
 
void rb_hash_bulk_insert (long, const VALUE *, VALUE)
 
VALUE rb_hash_update_by (VALUE hash1, VALUE hash2, rb_hash_update_func *func)
 
struct st_tablerb_hash_tbl (VALUE, const char *file, int line)
 
int rb_path_check (const char *)
 
int rb_env_path_tainted (void)
 
VALUE rb_env_clear (void)
 
VALUE rb_hash_size (VALUE)
 
void rb_hash_free (VALUE)
 

Detailed Description

Public APIs related to rb_cHash.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file hash.h.

Macro Definition Documentation

◆ st_foreach_safe

#define st_foreach_safe   rb_st_foreach_safe

Definition at line 31 of file hash.h.

Typedef Documentation

◆ rb_hash_update_func

typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value)

Definition at line 48 of file hash.h.

Function Documentation

◆ rb_check_hash_type()

VALUE rb_check_hash_type ( VALUE  hash)

Definition at line 1860 of file hash.c.

References update_arg::hash, rb_check_convert_type_with_id(), and T_HASH.

Referenced by rb_econv_prepare_options(), and rb_Hash().

◆ rb_env_clear()

VALUE rb_env_clear ( void  )

Definition at line 5839 of file hash.c.

References key, RARRAY_AREF, RARRAY_LEN, RB_GC_GUARD, RSTRING_PTR, ruby_setenv(), and TRUE.

Referenced by rb_execarg_run_options().

◆ rb_env_path_tainted()

int rb_env_path_tainted ( void  )

Definition at line 5051 of file hash.c.

References rb_warn_deprecated_to_remove().

◆ rb_hash()

VALUE rb_hash ( VALUE  obj)

◆ rb_hash_aref()

VALUE rb_hash_aref ( VALUE  hash,
VALUE  key 
)

◆ rb_hash_aset()

VALUE rb_hash_aset ( VALUE  hash,
VALUE  key,
VALUE  val 
)

◆ rb_hash_bulk_insert()

void rb_hash_bulk_insert ( long  argc,
const VALUE argv,
VALUE  hash 
)

◆ rb_hash_clear()

VALUE rb_hash_clear ( VALUE  hash)

Definition at line 2819 of file hash.c.

References rb_hash_foreach(), RHASH_ITER_LEV, and st_clear.

Referenced by Init_Hash(), and yyparse().

◆ rb_hash_delete()

VALUE rb_hash_delete ( VALUE  hash,
VALUE  key 
)

Definition at line 2327 of file hash.c.

References key, Qnil, Qundef, and rb_hash_delete_entry().

◆ rb_hash_delete_if()

VALUE rb_hash_delete_if ( VALUE  hash)

Definition at line 2490 of file hash.c.

References rb_hash_foreach(), and RETURN_SIZED_ENUMERATOR.

Referenced by Init_Hash().

◆ rb_hash_dup()

VALUE rb_hash_dup ( VALUE  hash)

◆ rb_hash_fetch()

VALUE rb_hash_fetch ( VALUE  hash,
VALUE  key 
)

Definition at line 2138 of file hash.c.

References key.

Referenced by rb_category_compile_warn(), rb_category_warn(), and rb_category_warning().

◆ rb_hash_foreach()

void rb_hash_foreach ( VALUE  ,
int(*)(VALUE, VALUE, VALUE ,
VALUE   
)

◆ rb_hash_free()

void rb_hash_free ( VALUE  )

◆ rb_hash_freeze()

VALUE rb_hash_freeze ( VALUE  hash)

Definition at line 101 of file hash.c.

References rb_obj_freeze().

Referenced by rb_econv_prepare_options().

◆ rb_hash_lookup()

VALUE rb_hash_lookup ( VALUE  hash,
VALUE  key 
)

Definition at line 2072 of file hash.c.

References key, Qnil, and rb_hash_lookup2().

◆ rb_hash_lookup2()

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

Definition at line 2059 of file hash.c.

References def(), and key.

Referenced by rb_hash_lookup(), rb_io_extract_encoding_option(), and rb_str_format().

◆ rb_hash_new()

VALUE rb_hash_new ( void  )

◆ rb_hash_set_ifnone()

VALUE rb_hash_set_ifnone ( VALUE  hash,
VALUE  ifnone 
)

Definition at line 113 of file hash.c.

References RB_OBJ_WRITE, and RHASH.

◆ rb_hash_size()

VALUE rb_hash_size ( VALUE  hash)

Definition at line 2981 of file hash.c.

References INT2FIX, and RHASH_SIZE.

Referenced by Init_Hash().

◆ rb_hash_tbl()

struct st_table * rb_hash_tbl ( VALUE  hash,
const char *  file,
int  line 
)

Definition at line 1609 of file hash.c.

References OBJ_WB_UNPROTECT, and rb_hash_tbl_raw().

◆ rb_hash_update_by()

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

Definition at line 4036 of file hash.c.

References update_func_arg::func, update_func_arg::hash, rb_hash_foreach(), and to_hash.

◆ rb_path_check()

int rb_path_check ( const char *  path)

Definition at line 6250 of file file.c.

References PATH_SEP_CHAR, rb_str_new, strchr(), and strlen().

◆ rb_st_foreach_safe()

void rb_st_foreach_safe ( struct st_table ,
int(*)(st_data_t, st_data_t, st_data_t ,
st_data_t   
)