aboutsummaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
authorAlan Wu <alanwu@ruby-lang.org>2020-11-25 17:05:06 -0500
committerAlan Wu <alanwu@ruby-lang.org>2020-11-25 17:05:06 -0500
commite0944bde9178fda7281717a159d0ffbfd3154f47 (patch)
treef1640da9a1f3207f36fa4530d83c8358b362b190 /class.c
parent526d0f46f3c6de931ecb1d7c3d5f089a9e2c8074 (diff)
downloadruby-e0944bde9178fda7281717a159d0ffbfd3154f47.tar.gz
Prefer rb_module_new() over rb_define_module_id()
rb_define_module_id() doesn't do anything with its parameter so it's a bit confusing.
Diffstat (limited to 'class.c')
-rw-r--r--class.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/class.c b/class.c
index 1f56385ca3..45c9c6a87f 100644
--- a/class.c
+++ b/class.c
@@ -859,6 +859,7 @@ rb_module_new(void)
return (VALUE)mdl;
}
+// Kept for compatibility. Use rb_module_new() instead.
VALUE
rb_define_module_id(ID id)
{
@@ -882,7 +883,7 @@ rb_define_module(const char *name)
rb_vm_add_root_module(module);
return module;
}
- module = rb_define_module_id(id);
+ module = rb_module_new();
rb_vm_add_root_module(module);
rb_const_set(rb_cObject, id, module);
@@ -909,7 +910,7 @@ rb_define_module_id_under(VALUE outer, ID id)
}
return module;
}
- module = rb_define_module_id(id);
+ module = rb_module_new();
rb_const_set(outer, id, module);
rb_set_class_path_string(module, outer, rb_id2str(id));
rb_gc_register_mark_object(module);