Prefix REF_EDGE
and REFS_LIST_PTR
with RUBY_
Also move `struct` so that `typedef`-ed names can be used.
This commit is contained in:
parent
18f218d6a1
commit
30f7b7a053
4
dir.c
4
dir.c
@ -474,13 +474,13 @@ dir_free(void *ptr)
|
||||
}
|
||||
|
||||
RUBY_REFERENCES_START(dir_refs)
|
||||
REF_EDGE(dir_data, path),
|
||||
RUBY_REF_EDGE(struct dir_data, path),
|
||||
RUBY_REFERENCES_END
|
||||
|
||||
static const rb_data_type_t dir_data_type = {
|
||||
"dir",
|
||||
{
|
||||
REFS_LIST_PTR(dir_refs),
|
||||
RUBY_REFS_LIST_PTR(dir_refs),
|
||||
dir_free,
|
||||
NULL, // Nothing allocated externally, so don't need a memsize function
|
||||
},
|
||||
|
@ -795,7 +795,7 @@ Some Macros have been provided to make edge referencing easier:
|
||||
|
||||
* <code>RUBY_REF_EDGE(struct, member)</code> - Declare _member_ as a VALUE edge from _struct_. Use this after +RUBY_REFERENCES_START+
|
||||
|
||||
* +REFS_LIST_PTR+ - Coerce the reference list into a format that can be
|
||||
* +RUBY_REFS_LIST_PTR+ - Coerce the reference list into a format that can be
|
||||
accepted by the existing +dmark+ interface.
|
||||
|
||||
The example below is from Dir (defined in +dir.c+)
|
||||
@ -811,7 +811,7 @@ The example below is from Dir (defined in +dir.c+)
|
||||
// Define a reference list `dir_refs` containing a single entry to `path`, and
|
||||
// terminating with RUBY_REF_END
|
||||
RUBY_REFERENCES_START(dir_refs)
|
||||
REF_EDGE(dir_data, path),
|
||||
RUBY_REF_EDGE(dir_data, path),
|
||||
RUBY_REFERENCES_END
|
||||
|
||||
// Override the "dmark" field with the defined reference list now that we
|
||||
@ -819,7 +819,7 @@ The example below is from Dir (defined in +dir.c+)
|
||||
// flags field
|
||||
static const rb_data_type_t dir_data_type = {
|
||||
"dir",
|
||||
{REFS_LIST_PTR(dir_refs), dir_free, dir_memsize,},
|
||||
{RUBY_REFS_LIST_PTR(dir_refs), dir_free, dir_memsize,},
|
||||
0, NULL, RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_DECL_MARKING
|
||||
};
|
||||
|
||||
|
20
enumerator.c
20
enumerator.c
@ -196,15 +196,15 @@ struct enumerator {
|
||||
};
|
||||
|
||||
RUBY_REFERENCES_START(enumerator_refs)
|
||||
REF_EDGE(enumerator, obj),
|
||||
REF_EDGE(enumerator, args),
|
||||
REF_EDGE(enumerator, fib),
|
||||
REF_EDGE(enumerator, dst),
|
||||
REF_EDGE(enumerator, lookahead),
|
||||
REF_EDGE(enumerator, feedvalue),
|
||||
REF_EDGE(enumerator, stop_exc),
|
||||
REF_EDGE(enumerator, size),
|
||||
REF_EDGE(enumerator, procs),
|
||||
RUBY_REF_EDGE(struct enumerator, obj),
|
||||
RUBY_REF_EDGE(struct enumerator, args),
|
||||
RUBY_REF_EDGE(struct enumerator, fib),
|
||||
RUBY_REF_EDGE(struct enumerator, dst),
|
||||
RUBY_REF_EDGE(struct enumerator, lookahead),
|
||||
RUBY_REF_EDGE(struct enumerator, feedvalue),
|
||||
RUBY_REF_EDGE(struct enumerator, stop_exc),
|
||||
RUBY_REF_EDGE(struct enumerator, size),
|
||||
RUBY_REF_EDGE(struct enumerator, procs),
|
||||
RUBY_REFERENCES_END
|
||||
|
||||
static VALUE rb_cGenerator, rb_cYielder, rb_cEnumProducer;
|
||||
@ -259,7 +259,7 @@ VALUE rb_cArithSeq;
|
||||
static const rb_data_type_t enumerator_data_type = {
|
||||
"enumerator",
|
||||
{
|
||||
REFS_LIST_PTR(enumerator_refs),
|
||||
RUBY_REFS_LIST_PTR(enumerator_refs),
|
||||
RUBY_TYPED_DEFAULT_FREE,
|
||||
NULL, // Nothing allocated externally, so don't need a memsize function
|
||||
NULL,
|
||||
|
@ -44,8 +44,8 @@
|
||||
|
||||
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
||||
|
||||
#define REF_EDGE(s, p) (offsetof(struct s, p))
|
||||
#define REFS_LIST_PTR(l) ((RUBY_DATA_FUNC)l)
|
||||
#define RUBY_REF_EDGE(s, p) offsetof(s, p)
|
||||
#define RUBY_REFS_LIST_PTR(l) (RUBY_DATA_FUNC)(l)
|
||||
#define RUBY_REF_END SIZE_MAX
|
||||
#define RUBY_REFERENCES_START(t) static const size_t t[] = {
|
||||
#define RUBY_REFERENCES_END RUBY_REF_END, };
|
||||
|
Loading…
x
Reference in New Issue
Block a user