mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
4d49ec8d3f
commit
8eb7570850
2 changed files with 15 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue