summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-11 06:05:32 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-11 06:05:32 +0000
commitb6ad741c966ffee19634f5abbb223ffee8e7f5bf (patch)
treef5e4bff506c65054aeabe9d3a887dd31e4034988 /ext
parente4151dcf5b0b87465bee51df0af2e1216a11735f (diff)
downloadruby-b6ad741c966ffee19634f5abbb223ffee8e7f5bf.tar.gz
ruby-b6ad741c966ffee19634f5abbb223ffee8e7f5bf.tar.xz
ruby-b6ad741c966ffee19634f5abbb223ffee8e7f5bf.zip
* ext/digest/digest.c (rb_digest_base_reset): Do not make
recursive calls, but call initialize() when reset() is not defined in a subclass. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/digest/digest.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 0e3bf47a2..d95f8a697 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -16,7 +16,7 @@
#include "digest.h"
static VALUE mDigest, cDigest_Base;
-static ID id_metadata, id_new, id_reset, id_update, id_digest;
+static ID id_metadata, id_new, id_initialize, id_update, id_digest;
/*
* Digest::Base
@@ -207,8 +207,10 @@ rb_digest_base_copy(VALUE copy, VALUE obj)
rb_check_frozen(copy);
algo = get_digest_base_metadata(rb_obj_class(copy));
- if (algo == NULL)
+ if (algo == NULL) {
+ /* subclasses must define initialize_copy() */
rb_notimplement();
+ }
/* get_digest_base_metadata() may return a NULL */
if (algo != get_digest_base_metadata(rb_obj_class(obj))) {
@@ -230,7 +232,7 @@ rb_digest_base_reset(VALUE self)
algo = get_digest_base_metadata(rb_obj_class(self));
if (algo == NULL) {
- rb_funcall(self, id_reset, 0);
+ rb_funcall(self, id_initialize, 0);
return self;
}
@@ -309,8 +311,10 @@ rb_digest_base_digest(VALUE self)
algo = get_digest_base_metadata(rb_obj_class(self));
- if (algo == NULL)
+ if (algo == NULL) {
+ /* subclasses must define update() */
rb_notimplement();
+ }
Data_Get_Struct(self, void, pctx1);
@@ -441,7 +445,7 @@ Init_digest(void)
id_metadata = rb_intern("metadata");
id_new = rb_intern("new");
- id_reset = rb_intern("reset");
+ id_initialize = rb_intern("initialize");
id_update = rb_intern("update");
id_digest = rb_intern("digest");
}