diff options
author | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2003-07-02 16:42:50 +0000 |
---|---|---|
committer | GOTOU Yuuzou <gotoyuzo@notwork.org> | 2003-07-02 16:42:50 +0000 |
commit | c779992cf6ca8daf1747d8557c82aeed013d492e (patch) | |
tree | e86566d7170c53302a0f5d840581a7f6a7397874 | |
parent | 8c3c826d7027238478c065ff5966ac25097e7b7f (diff) | |
download | ruby-openssl-history-c779992cf6ca8daf1747d8557c82aeed013d492e.tar.gz |
* ossl_x509name.c: add X509::Name::eql? (ossl_x509name_eql).
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | ossl_x509name.c | 30 |
2 files changed, 27 insertions, 6 deletions
@@ -1,3 +1,6 @@ +Thu, 03 Jul 2003 01:37:28 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org> + * ossl_x509name.c: add X509::Name::eql? (ossl_x509name_eql). + Wed, 03 Jul 2003 00:42:15 +0900 -- NAKAMURA, Hiroshi <nahi@ruby-lang.org> * examples/c_rehash.rb: Illegal symlink. diff --git a/ossl_x509name.c b/ossl_x509name.c index a5ba953..c329039 100644 --- a/ossl_x509name.c +++ b/ossl_x509name.c @@ -184,22 +184,40 @@ ossl_x509name_digest(VALUE self, VALUE digest) } #endif -static VALUE -ossl_x509name_cmp(VALUE self, VALUE other) +static int +ossl_x509name_cmp0(VALUE self, VALUE other) { X509_NAME *name1, *name2; - int result; GetX509Name(self, name1); SafeGetX509Name(other, name2); - result = X509_NAME_cmp(name1, name2); + + return X509_NAME_cmp(name1, name2); +} + +static VALUE +ossl_x509name_cmp(VALUE self, VALUE other) +{ + int result; + + result = ossl_x509name_cmp0(self, other); if (result < 0) return INT2FIX(-1); - if (result >= 1) return INT2FIX(1); + if (result > 1) return INT2FIX(1); return INT2FIX(0); } static VALUE +ossl_x509name_eql(VALUE self, VALUE other) +{ + int result; + + result = ossl_x509name_cmp0(self, other); + + return (result == 0) ? Qtrue : Qfalse; +} + +static VALUE ossl_x509name_hash(VALUE self) { X509_NAME *name; @@ -230,7 +248,7 @@ Init_ossl_x509name() rb_define_method(cX509Name, "cmp", ossl_x509name_cmp, 1); rb_define_alias(cX509Name, "<=>", "cmp"); + rb_define_method(cX509Name, "eql?", ossl_x509name_eql, 1); rb_define_method(cX509Name, "hash", ossl_x509name_hash, 0); } - |