diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-09-08 18:11:12 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-09-08 18:21:39 +0900 |
commit | 34e7fe34ee326d8d0ceb594d0fe5a90c22d91c63 (patch) | |
tree | 5d0d5aa2bdca8d8e7363c6acbb7aecccf23d9ea4 /ext/openssl/ossl_x509name.c | |
parent | a7940a22e0a5caeab4f0d8b96b9a977f6bf31133 (diff) | |
download | ruby-openssl-34e7fe34ee326d8d0ceb594d0fe5a90c22d91c63.tar.gz |
Use rb_obj_class() instead of CLASS_OF()
CLASS_OF() (or, rb_class_of()) may return the singleton class of the
object; so avoid using it and replace with rb_obj_class() that returns
the actual class of the object.
Diffstat (limited to 'ext/openssl/ossl_x509name.c')
-rw-r--r-- | ext/openssl/ossl_x509name.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c index abbdc3b1..4523e0d7 100644 --- a/ext/openssl/ossl_x509name.c +++ b/ext/openssl/ossl_x509name.c @@ -372,12 +372,10 @@ ossl_x509name_cmp(VALUE self, VALUE other) static VALUE ossl_x509name_eql(VALUE self, VALUE other) { - int result; - - if(CLASS_OF(other) != cX509Name) return Qfalse; - result = ossl_x509name_cmp0(self, other); + if (!rb_obj_is_kind_of(other, cX509Name)) + return Qfalse; - return (result == 0) ? Qtrue : Qfalse; + return ossl_x509name_cmp0(self, other) ? Qtrue : Qfalse; } /* |