Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
rhash.h
Go to the documentation of this file.
1 #ifndef RBIMPL_RHASH_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_RHASH_H
24 #include "ruby/internal/config.h"
25 
26 #ifdef STDC_HEADERS
27 # include <stddef.h>
28 #endif
29 
31 #include "ruby/internal/value.h"
32 #if !defined RUBY_EXPORT && !defined RUBY_NO_OLD_COMPATIBILITY
33 # include "ruby/backward.h"
34 #endif
35 
46 #define RHASH_TBL(h) rb_hash_tbl(h, __FILE__, __LINE__)
47 
59 #define RHASH_IFNONE(h) rb_hash_ifnone(h)
60 
69 #define RHASH_SIZE(h) rb_hash_size_num(h)
70 
79 #define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
80 
92 #define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
93 
94 struct st_table; /* in ruby/st.h */
95 
97 
98 
106 size_t rb_hash_size_num(VALUE hash);
107 
118 struct st_table *rb_hash_tbl(VALUE hash, const char *file, int line);
119 
128 VALUE rb_hash_set_ifnone(VALUE hash, VALUE ifnone);
130 
131 #endif /* RBIMPL_RHASH_H */
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:74
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:65
VALUE rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
This is the implementation detail of RHASH_SET_IFNONE.
Definition: hash.c:123
struct st_table * rb_hash_tbl(VALUE hash, const char *file, int line)
This is the implementation detail of RHASH_TBL.
Definition: hash.c:1593
size_t rb_hash_size_num(VALUE hash)
This is the implementation detail of RHASH_SIZE.
Definition: hash.c:2960
Definition: st.h:79
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40