Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with newer digest gems #29

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*.gem
*.log
*.rbc
*.bundle
*.bundle.dSYM
/.config
/.rake_tasks~
/coverage/
Expand Down
1 change: 1 addition & 0 deletions ext/digest/extconf.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ def have_func!(header, *args)
have_header! "string.h"

have_func! "rb_str_set_len"
have_func "rb_digest_make_metadata", "ruby/digest.h"

create_makefile "digest/keccak" or exit 1
4 changes: 4 additions & 0 deletions ext/digest/keccak.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ Init_keccak() {

cKeccak = rb_define_class_under(mDigest, "Keccak", cDigest_Base);

#ifdef HAVE_RB_DIGEST_MAKE_METADATA
rb_iv_set(cKeccak, "metadata", rb_digest_make_metadata(&keccak));
#else
rb_iv_set(cKeccak, "metadata", Data_Wrap_Struct(0, 0, 0, (void *)&keccak));
#endif

rb_define_method(cKeccak, "initialize", rb_keccak_initialize, -1);
rb_define_method(cKeccak, "digest_length", rb_keccak_digest_length, 0);
Expand Down
Loading