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

ruby-changes:36728

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 08:39:00 +0900 (JST)
Subject: [ruby-changes:36728] nobu:r48809 (trunk): ossl_x509attr.c: typed data

nobu	2014-12-13 08:38:44 +0900 (Sat, 13 Dec 2014)

  New Revision: 48809

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

  Log:
    ossl_x509attr.c: typed data
    
    * ext/openssl/ossl_x509attr.c (ossl_x509attr_type): use typed data.

  Modified files:
    trunk/ext/openssl/ossl_x509attr.c
Index: ext/openssl/ossl_x509attr.c
===================================================================
--- ext/openssl/ossl_x509attr.c	(revision 48808)
+++ ext/openssl/ossl_x509attr.c	(revision 48809)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509attr.c#L14
     if (!(attr)) { \
 	ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, X509_ATTRIBUTE_free, (attr)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_x509attr_type, (attr)); \
 } while (0)
 #define GetX509Attr(obj, attr) do { \
-    Data_Get_Struct((obj), X509_ATTRIBUTE, (attr)); \
+    TypedData_Get_Struct((obj), X509_ATTRIBUTE, &ossl_x509attr_type, (attr)); \
     if (!(attr)) { \
 	ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
     } \
@@ -33,6 +33,20 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509attr.c#L33
 VALUE cX509Attr;
 VALUE eX509AttrError;
 
+static void
+ossl_x509attr_free(void *ptr)
+{
+    X509_ATTRIBUTE_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509attr_type = {
+    "OpenSSL/X509/ATTRIBUTE",
+    {
+	0, ossl_x509attr_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * Public
  */

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

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