summaryrefslogtreecommitdiff
path: root/ext/digest
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest')
-rw-r--r--ext/digest/digest.c14
-rw-r--r--ext/digest/sha1/sha1init.c5
2 files changed, 8 insertions, 11 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index c5700553223..70f986327af 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -149,8 +149,8 @@ rb_digest_base_copy(copy, obj)
if (copy == obj) return copy;
rb_check_frozen(copy);
- algo = get_digest_base_metadata(CLASS_OF(copy));
- if (algo != get_digest_base_metadata(CLASS_OF(obj))) {
+ algo = get_digest_base_metadata(rb_obj_class(copy));
+ if (algo != get_digest_base_metadata(rb_obj_class(obj))) {
rb_raise(rb_eTypeError, "wrong argument class");
}
Data_Get_Struct(obj, void, pctx1);
@@ -168,7 +168,7 @@ rb_digest_base_update(self, str)
void *pctx;
StringValue(str);
- algo = get_digest_base_metadata(CLASS_OF(self));
+ algo = get_digest_base_metadata(rb_obj_class(self));
Data_Get_Struct(self, void, pctx);
algo->update_func(pctx, RSTRING(str)->ptr, RSTRING(str)->len);
@@ -201,7 +201,7 @@ rb_digest_base_digest(self)
size_t len;
VALUE str;
- algo = get_digest_base_metadata(CLASS_OF(self));
+ algo = get_digest_base_metadata(rb_obj_class(self));
Data_Get_Struct(self, void, pctx1);
len = algo->ctx_size;
@@ -232,7 +232,7 @@ rb_digest_base_hexdigest(self)
size_t len;
VALUE str;
- algo = get_digest_base_metadata(CLASS_OF(self));
+ algo = get_digest_base_metadata(rb_obj_class(self));
Data_Get_Struct(self, void, pctx1);
len = algo->ctx_size;
@@ -261,10 +261,10 @@ rb_digest_base_equal(self, other)
VALUE klass;
VALUE str1, str2;
- klass = CLASS_OF(self);
+ klass = rb_obj_class(self);
algo = get_digest_base_metadata(klass);
- if (CLASS_OF(other) == klass) {
+ if (rb_obj_class(other) == klass) {
void *pctx1, *pctx2;
Data_Get_Struct(self, void, pctx1);
diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c
index 426afb7cd0e..ffa342d3149 100644
--- a/ext/digest/sha1/sha1init.c
+++ b/ext/digest/sha1/sha1init.c
@@ -22,7 +22,6 @@ void
Init_sha1()
{
VALUE mDigest, cDigest_Base, cDigest_SHA1;
- ID id_metadata;
rb_require("digest.so");
@@ -31,8 +30,6 @@ Init_sha1()
cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);
- id_metadata = rb_intern("metadata");
-
- rb_cvar_set(cDigest_SHA1, id_metadata,
+ rb_cvar_set(cDigest_SHA1, rb_intern("metadata"),
Data_Wrap_Struct(rb_cObject, 0, 0, &sha1), Qtrue);
}