1
0
Fork 0
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): Use an instance

variable of a class object instead of a class variable for
  metadata.  This change is crucial for ruby 1.8 and applying it
  also to the trunk will assure compatibilities.

* ext/digest/md5/md5init.c (Init_md5): Ditto.

* ext/digest/rmd160/rmd160init.c (Init_rmd160): Ditto.

* ext/digest/sha1/sha1init.c (Init_sha1): Ditto.

* ext/digest/sha2/sha2init.c (Init_sha2): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2006-10-11 17:14:54 +00:00
parent a0d758f824
commit 9b81e26df2
6 changed files with 25 additions and 10 deletions

View file

@ -1,3 +1,18 @@
Thu Oct 12 02:12:31 2006 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (get_digest_base_metadata): Use an instance
variable of a class object instead of a class variable for
metadata. This change is crucial for ruby 1.8 and applying it
also to the trunk will assure compatibilities.
* ext/digest/md5/md5init.c (Init_md5): Ditto.
* ext/digest/rmd160/rmd160init.c (Init_rmd160): Ditto.
* ext/digest/sha1/sha1init.c (Init_sha1): Ditto.
* ext/digest/sha2/sha2init.c (Init_sha2): Ditto.
Wed Oct 11 21:36:47 2006 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_base_alloc,

View file

@ -28,11 +28,11 @@ get_digest_base_metadata(VALUE klass)
VALUE obj;
algo_t *algo;
if (rb_cvar_defined(klass, id_metadata) == Qfalse) {
if (rb_ivar_defined(klass, id_metadata) == Qfalse) {
return NULL;
}
obj = rb_cvar_get(klass, id_metadata);
obj = rb_ivar_get(klass, id_metadata);
Data_Get_Struct(obj, algo_t, algo);

View file

@ -31,6 +31,6 @@ Init_md5()
rb_define_const(cDigest_MD5, "DIGEST_LENGTH", INT2NUM(MD5_DIGEST_LENGTH));
rb_define_const(cDigest_MD5, "BLOCK_LENGTH", INT2NUM(MD5_BLOCK_LENGTH));
rb_cvar_set(cDigest_MD5, rb_intern("metadata"),
Data_Wrap_Struct(rb_cObject, 0, 0, &md5), Qtrue);
rb_ivar_set(cDigest_MD5, rb_intern("metadata"),
Data_Wrap_Struct(rb_cObject, 0, 0, &md5));
}

View file

@ -34,6 +34,6 @@ Init_rmd160()
id_metadata = rb_intern("metadata");
rb_cvar_set(cDigest_RMD160, id_metadata,
Data_Wrap_Struct(rb_cObject, 0, 0, &rmd160), Qtrue);
rb_ivar_set(cDigest_RMD160, id_metadata,
Data_Wrap_Struct(rb_cObject, 0, 0, &rmd160));
}

View file

@ -31,6 +31,6 @@ Init_sha1()
rb_define_const(cDigest_SHA1, "DIGEST_LENGTH", INT2NUM(SHA1_DIGEST_LENGTH));
rb_define_const(cDigest_SHA1, "BLOCK_LENGTH", INT2NUM(SHA1_BLOCK_LENGTH));
rb_cvar_set(cDigest_SHA1, rb_intern("metadata"),
Data_Wrap_Struct(rb_cObject, 0, 0, &sha1), Qtrue);
rb_ivar_set(cDigest_SHA1, rb_intern("metadata"),
Data_Wrap_Struct(rb_cObject, 0, 0, &sha1));
}

View file

@ -41,8 +41,8 @@ Init_sha2()
rb_define_const(cDigest_SHA##bitlen, "DIGEST_LENGTH", INT2NUM(SHA##bitlen##_DIGEST_LENGTH)); \
rb_define_const(cDigest_SHA##bitlen, "BLOCK_LENGTH", INT2NUM(SHA##bitlen##_BLOCK_LENGTH)); \
\
rb_cvar_set(cDigest_SHA##bitlen, id_metadata, \
Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen), Qtrue);
rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen));
FOREACH_BITLEN(DEFINE_ALGO_CLASS)
}