1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Hoisted out rb_digest_namespace

This commit is contained in:
Nobuyoshi Nakada 2019-08-21 16:31:26 +09:00
parent c030cec7ca
commit 74c6662af5
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
5 changed files with 11 additions and 12 deletions

View file

@ -49,3 +49,10 @@ rb_digest_##name##_finish(void *ctx, unsigned char *ptr) \
{ \
return name##_Final(ptr, ctx); \
}
static inline VALUE
rb_digest_namespace(void)
{
rb_require("digest");
return rb_path2class("Digest");
}

View file

@ -51,12 +51,10 @@ Init_md5(void)
{
VALUE mDigest, cDigest_Base, cDigest_MD5;
rb_require("digest");
#if 0
mDigest = rb_define_module("Digest"); /* let rdoc know */
#endif
mDigest = rb_path2class("Digest");
mDigest = rb_digest_namespace();
cDigest_Base = rb_path2class("Digest::Base");
cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);

View file

@ -49,12 +49,10 @@ Init_rmd160(void)
{
VALUE mDigest, cDigest_Base, cDigest_RMD160;
rb_require("digest");
#if 0
mDigest = rb_define_module("Digest"); /* let rdoc know */
#endif
mDigest = rb_path2class("Digest");
mDigest = rb_digest_namespace();
cDigest_Base = rb_path2class("Digest::Base");
cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);

View file

@ -53,12 +53,10 @@ Init_sha1(void)
{
VALUE mDigest, cDigest_Base, cDigest_SHA1;
rb_require("digest");
#if 0
mDigest = rb_define_module("Digest"); /* let rdoc know */
#endif
mDigest = rb_path2class("Digest");
mDigest = rb_digest_namespace();
cDigest_Base = rb_path2class("Digest::Base");
cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);

View file

@ -42,11 +42,9 @@ Init_sha2(void)
FOREACH_BITLEN(DECLARE_ALGO_CLASS)
rb_require("digest");
id_metadata = rb_intern_const("metadata");
mDigest = rb_path2class("Digest");
mDigest = rb_digest_namespace();
cDigest_Base = rb_path2class("Digest::Base");
#define DEFINE_ALGO_CLASS(bitlen) \