mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/digest/digest.c (get_digest_base_metadata): Allow inheriting
Digest::Base subclasses, which was unintentionally made impossible while restructuring Digest classes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
50d3ece900
commit
04cd7cc62d
2 changed files with 14 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Mar 1 02:55:25 2007 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* ext/digest/digest.c (get_digest_base_metadata): Allow inheriting
|
||||||
|
Digest::Base subclasses, which was unintentionally made
|
||||||
|
impossible while restructuring Digest classes.
|
||||||
|
|
||||||
Thu Mar 1 02:05:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Mar 1 02:05:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* mkconfig.rb (patchlevel): read from version.h.
|
* mkconfig.rb (patchlevel): read from version.h.
|
||||||
|
|
|
@ -423,15 +423,19 @@ rb_digest_class_s_hexdigest(int argc, VALUE *argv, VALUE klass)
|
||||||
static rb_digest_metadata_t *
|
static rb_digest_metadata_t *
|
||||||
get_digest_base_metadata(VALUE klass)
|
get_digest_base_metadata(VALUE klass)
|
||||||
{
|
{
|
||||||
|
VALUE p;
|
||||||
VALUE obj;
|
VALUE obj;
|
||||||
rb_digest_metadata_t *algo;
|
rb_digest_metadata_t *algo;
|
||||||
|
|
||||||
if (rb_ivar_defined(klass, id_metadata) == Qfalse) {
|
for (p = klass; p; p = RCLASS(p)->super) {
|
||||||
/* This class should not be subclassed in Ruby */
|
if (rb_ivar_defined(p, id_metadata)) {
|
||||||
rb_notimplement();
|
obj = rb_ivar_get(p, id_metadata);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = rb_ivar_get(klass, id_metadata);
|
if (!p)
|
||||||
|
rb_raise(rb_eRuntimeError, "Digest::Base cannot be inherited in Ruby");
|
||||||
|
|
||||||
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
|
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue