[前][次][番号順一覧][スレッド一覧]

ruby-changes:36733

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 09:00:15 +0900 (JST)
Subject: [ruby-changes:36733] nobu:r48814 (trunk): ossl_x509name.c: typed data

nobu	2014-12-13 08:59:19 +0900 (Sat, 13 Dec 2014)

  New Revision: 48814

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48814

  Log:
    ossl_x509name.c: typed data
    
    * ext/openssl/ossl_x509name.c (ossl_x509name_type): use typed data.

  Modified files:
    trunk/ext/openssl/ossl_x509name.c
Index: ext/openssl/ossl_x509name.c
===================================================================
--- ext/openssl/ossl_x509name.c	(revision 48813)
+++ ext/openssl/ossl_x509name.c	(revision 48814)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509name.c#L14
     if (!(name)) { \
 	ossl_raise(rb_eRuntimeError, "Name wasn't initialized."); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, X509_NAME_free, (name)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_x509name_type, (name)); \
 } while (0)
 #define GetX509Name(obj, name) do { \
-    Data_Get_Struct((obj), X509_NAME, (name)); \
+    TypedData_Get_Struct((obj), X509_NAME, &ossl_x509name_type, (name)); \
     if (!(name)) { \
 	ossl_raise(rb_eRuntimeError, "Name wasn't initialized."); \
     } \
@@ -38,6 +38,20 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509name.c#L38
 VALUE cX509Name;
 VALUE eX509NameError;
 
+static void
+ossl_x509name_free(void *ptr)
+{
+    X509_NAME_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509name_type = {
+    "OpenSSL/X509/NAME",
+    {
+	0, ossl_x509name_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * Public
  */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]