aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-11-26 16:04:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-11-30 21:39:28 +0900
commit30f7b7a0535575a4995ea59086830ee19c79ea82 (patch)
treebe219e1468c17cba43014fe8d1757b563f299204
parent18f218d6a14f1a4744327d814554bfda04f1f119 (diff)
downloadruby-30f7b7a0535575a4995ea59086830ee19c79ea82.tar.gz
Prefix `REF_EDGE` and `REFS_LIST_PTR` with `RUBY_`
Also move `struct` so that `typedef`-ed names can be used.
-rw-r--r--dir.c4
-rw-r--r--doc/extension.rdoc6
-rw-r--r--enumerator.c20
-rw-r--r--include/ruby/internal/gc.h4
4 files changed, 17 insertions, 17 deletions
diff --git a/dir.c b/dir.c
index ce5a90ebf7..08bead05d0 100644
--- a/dir.c
+++ b/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
},
diff --git a/doc/extension.rdoc b/doc/extension.rdoc
index b95ed033e4..fe7f16a1a6 100644
--- a/doc/extension.rdoc
+++ b/doc/extension.rdoc
@@ -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
};
diff --git a/enumerator.c b/enumerator.c
index 52e010cd9a..b77ef175ce 100644
--- a/enumerator.c
+++ b/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,
diff --git a/include/ruby/internal/gc.h b/include/ruby/internal/gc.h
index 68472c6454..4ca379c4ba 100644
--- a/include/ruby/internal/gc.h
+++ b/include/ruby/internal/gc.h
@@ -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, };