зеркало из https://github.com/github/ruby.git
Add `RUBY_REFERENCES`
Instead of `RUBY_REFERENCES_START` and `RUBY_REFERENCES_END`, so that auto-indent works well.
This commit is contained in:
Родитель
30f7b7a053
Коммит
0cdad3b92a
5
dir.c
5
dir.c
|
@ -473,9 +473,10 @@ dir_free(void *ptr)
|
|||
if (dir->dir) closedir(dir->dir);
|
||||
}
|
||||
|
||||
RUBY_REFERENCES_START(dir_refs)
|
||||
RUBY_REFERENCES(dir_refs) = {
|
||||
RUBY_REF_EDGE(struct dir_data, path),
|
||||
RUBY_REFERENCES_END
|
||||
RUBY_REF_END
|
||||
};
|
||||
|
||||
static const rb_data_type_t dir_data_type = {
|
||||
"dir",
|
||||
|
|
|
@ -789,9 +789,9 @@ Some Macros have been provided to make edge referencing easier:
|
|||
|
||||
* <code>RUBY_TYPED_DECL_MARKING</code> =A flag that can be set on the +ruby_data_type_t+ to indicate that references are being declared as edges.
|
||||
|
||||
* <code>RUBY_REFERENCES_START(ref_list_name)</code> - Define _ref_list_name_ as a list of references
|
||||
* <code>RUBY_REFERENCES(ref_list_name)</code> - Define _ref_list_name_ as a list of references
|
||||
|
||||
* <code>RUBY_REFERENCES_END</code> - Mark the end of the references list. This will take care of terminating the list correctly
|
||||
* <code>RUBY_REF_END</code> - The end mark of the references list.
|
||||
|
||||
* <code>RUBY_REF_EDGE(struct, member)</code> - Declare _member_ as a VALUE edge from _struct_. Use this after +RUBY_REFERENCES_START+
|
||||
|
||||
|
@ -808,11 +808,12 @@ The example below is from Dir (defined in +dir.c+)
|
|||
rb_encoding *enc;
|
||||
}
|
||||
|
||||
// Define a reference list `dir_refs` containing a single entry to `path`, and
|
||||
// terminating with RUBY_REF_END
|
||||
RUBY_REFERENCES_START(dir_refs)
|
||||
// Define a reference list `dir_refs` containing a single entry to `path`.
|
||||
// Needs terminating with RUBY_REF_END
|
||||
RUBY_REFERENCES(dir_refs) = {
|
||||
RUBY_REF_EDGE(dir_data, path),
|
||||
RUBY_REFERENCES_END
|
||||
RUBY_REF_END
|
||||
};
|
||||
|
||||
// Override the "dmark" field with the defined reference list now that we
|
||||
// no longer need a marking callback and add RUBY_TYPED_DECL_MARKING to the
|
||||
|
|
|
@ -195,7 +195,7 @@ struct enumerator {
|
|||
int kw_splat;
|
||||
};
|
||||
|
||||
RUBY_REFERENCES_START(enumerator_refs)
|
||||
RUBY_REFERENCES(enumerator_refs) = {
|
||||
RUBY_REF_EDGE(struct enumerator, obj),
|
||||
RUBY_REF_EDGE(struct enumerator, args),
|
||||
RUBY_REF_EDGE(struct enumerator, fib),
|
||||
|
@ -205,7 +205,8 @@ RUBY_REFERENCES_START(enumerator_refs)
|
|||
RUBY_REF_EDGE(struct enumerator, stop_exc),
|
||||
RUBY_REF_EDGE(struct enumerator, size),
|
||||
RUBY_REF_EDGE(struct enumerator, procs),
|
||||
RUBY_REFERENCES_END
|
||||
RUBY_REF_END
|
||||
};
|
||||
|
||||
static VALUE rb_cGenerator, rb_cYielder, rb_cEnumProducer;
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ RBIMPL_SYMBOL_EXPORT_BEGIN()
|
|||
#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(t) static const size_t t[]
|
||||
#define RUBY_REFERENCES_START(t) RUBY_REFERENCES(t) = {
|
||||
#define RUBY_REFERENCES_END RUBY_REF_END, };
|
||||
|
||||
/* gc.c */
|
||||
|
|
Загрузка…
Ссылка в новой задаче