summaryrefslogtreecommitdiff
path: root/ext/digest/digest.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest/digest.c')
-rw-r--r--ext/digest/digest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 6f9149c..d535b35 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -436,14 +436,14 @@ get_digest_base_metadata(VALUE klass)
VALUE obj;
rb_digest_metadata_t *algo;
- for (p = klass; p; p = RCLASS_SUPER(p)) {
+ for (p = klass; !NIL_P(p); p = rb_class_superclass(p)) {
if (rb_ivar_defined(p, id_metadata)) {
obj = rb_ivar_get(p, id_metadata);
break;
}
}
- if (!p)
+ if (NIL_P(p))
rb_raise(rb_eRuntimeError, "Digest::Base cannot be directly inherited in Ruby");
Data_Get_Struct(obj, rb_digest_metadata_t, algo);