summaryrefslogtreecommitdiff
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
commit8eb7570850980e1849f07bbed57d1bda8351f064 (patch)
treef5e4bff506c65054aeabe9d3a887dd31e4034988
parent4d49ec8d3f96d2d675cbeb930bd548739e123240 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@11125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--ext/digest/digest.c14
2 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 93a17fb6e5..5772392272 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Oct 11 15:03:55 2006 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/digest/digest.c (rb_digest_base_reset): Do not make
+ recursive calls, but call initialize() when reset() is not
+ defined in a subclass.
+
Wed Oct 11 14:58:44 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_each): prohibit array modification during each
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index 0e3bf47a20..d95f8a6976 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");
}