ruby-changes:65110
From: Matt <ko1@a...>
Date: Tue, 2 Feb 2021 01:43:19 +0900 (JST)
Subject: [ruby-changes:65110] 49950266be (master): Add RCLASS_PARENT_SUBMODULES Macro
https://git.ruby-lang.org/ruby.git/commit/?id=49950266be From 49950266be32ae09ee6a17539c4412f032995fc6 Mon Sep 17 00:00:00 2001 From: Matt Valentine-House <matt@e...> Date: Tue, 26 Jan 2021 16:06:31 +0000 Subject: Add RCLASS_PARENT_SUBMODULES Macro --- class.c | 16 ++++++++-------- internal/class.h | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/class.c b/class.c index 8cd96f6..2e084d1 100644 --- a/class.c +++ b/class.c @@ -56,11 +56,11 @@ rb_class_subclass_add(VALUE super, VALUE klass) https://github.com/ruby/ruby/blob/trunk/class.c#L56 head = RCLASS_EXT(super)->subclasses; if (head) { entry->next = head; - RCLASS_EXT(head->klass)->parent_subclasses = &entry->next; + RCLASS_PARENT_SUBCLASSES(head->klass) = &entry->next; } RCLASS_EXT(super)->subclasses = entry; - RCLASS_EXT(klass)->parent_subclasses = &RCLASS_EXT(super)->subclasses; + RCLASS_PARENT_SUBCLASSES(klass) = &RCLASS_EXT(super)->subclasses; } } @@ -88,17 +88,17 @@ rb_class_remove_from_super_subclasses(VALUE klass) https://github.com/ruby/ruby/blob/trunk/class.c#L88 { rb_subclass_entry_t *entry; - if (RCLASS_EXT(klass)->parent_subclasses) { - entry = *RCLASS_EXT(klass)->parent_subclasses; + if (RCLASS_PARENT_SUBCLASSES(klass)) { + entry = *RCLASS_PARENT_SUBCLASSES(klass); - *RCLASS_EXT(klass)->parent_subclasses = entry->next; + *RCLASS_PARENT_SUBCLASSES(klass) = entry->next; if (entry->next) { - RCLASS_EXT(entry->next->klass)->parent_subclasses = RCLASS_EXT(klass)->parent_subclasses; + RCLASS_PARENT_SUBCLASSES(entry->next->klass) = RCLASS_PARENT_SUBCLASSES(klass); } xfree(entry); } - RCLASS_EXT(klass)->parent_subclasses = NULL; + RCLASS_PARENT_SUBCLASSES(klass) = NULL; } void @@ -182,7 +182,7 @@ class_alloc(VALUE flags, VALUE klass) https://github.com/ruby/ruby/blob/trunk/class.c#L182 RCLASS_IV_INDEX_TBL(obj) = 0; RCLASS_SET_SUPER((VALUE)obj, 0); RCLASS_EXT(obj)->subclasses = NULL; - RCLASS_EXT(obj)->parent_subclasses = NULL; + RCLASS_PARENT_SUBCLASSES(obj) = NULL; RCLASS_EXT(obj)->module_subclasses = NULL; */ RCLASS_SET_ORIGIN((VALUE)obj, (VALUE)obj); diff --git a/internal/class.h b/internal/class.h index eade920..da1df19 100644 --- a/internal/class.h +++ b/internal/class.h @@ -92,6 +92,7 @@ typedef struct rb_classext_struct rb_classext_t; https://github.com/ruby/ruby/blob/trunk/internal/class.h#L92 # define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial) #endif #define RCLASS_INCLUDER(c) (RCLASS_EXT(c)->includer) +#define RCLASS_PARENT_SUBCLASSES(c) (RCLASS_EXT(c)->parent_subclasses) #define RICLASS_IS_ORIGIN FL_USER5 #define RCLASS_CLONED FL_USER6 -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/