diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-01-26 12:15:59 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-01-28 06:49:28 +0000 |
commit | d3e6bcd37fd10a0356a0d07d079670bb7247299b () | |
tree | 209d956730d950c614370ccadfb49858c4defc5f | |
parent | 81702b4b873c0e2b4247095b3b9462bcf34166ff (diff) |
[ruby/digest] [DOC] Expand `Digest::SHA2` definitions for RDoc
Since RDoc searches `var = rb_define_class_under(...)` statements literally, they cannot be built by macros. https://.com/ruby/digest/commit/d39b684f91
-rw-r--r-- | ext/digest/sha2/sha2init.c | 42 |
1 files changed, 30 insertions, 12 deletions
@@ -25,32 +25,50 @@ static const rb_digest_metadata_t sha##bitlen = { \ FOREACH_BITLEN(DEFINE_ALGO_METADATA) /* * Classes for calculating message digests using the SHA-256/384/512 * Secure Hash Algorithm(s) by NIST (the US' National Institute of * Standards and Technology), described in FIPS PUB 180-2. */ void Init_sha2(void) { - VALUE mDigest, cDigest_Base; ID id_metadata = rb_id_metadata(); -#define DECLARE_ALGO_CLASS(bitlen) \ - VALUE cDigest_SHA##bitlen; - - FOREACH_BITLEN(DECLARE_ALGO_CLASS) - #if 0 mDigest = rb_define_module("Digest"); /* let rdoc know */ #endif mDigest = rb_digest_namespace(); cDigest_Base = rb_const_get(mDigest, rb_intern_const("Base")); -#define DEFINE_ALGO_CLASS(bitlen) \ - cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \ -\ - rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \ - rb_digest_make_metadata(&sha##bitlen)); - FOREACH_BITLEN(DEFINE_ALGO_CLASS) } |