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

ruby-changes:36713

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 06:58:24 +0900 (JST)
Subject: [ruby-changes:36713] nobu:r48794 (trunk): ossl_ns_spki.c: typed data

nobu	2014-12-13 06:58:03 +0900 (Sat, 13 Dec 2014)

  New Revision: 48794

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

  Log:
    ossl_ns_spki.c: typed data
    
    * ext/openssl/ossl_ns_spki.c (ossl_netscape_spki_type): use typed
      data.

  Modified files:
    trunk/ext/openssl/ossl_ns_spki.c
Index: ext/openssl/ossl_ns_spki.c
===================================================================
--- ext/openssl/ossl_ns_spki.c	(revision 48793)
+++ ext/openssl/ossl_ns_spki.c	(revision 48794)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ns_spki.c#L14
     if (!(spki)) { \
 	ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, NETSCAPE_SPKI_free, (spki)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_netscape_spki_type, (spki)); \
 } while (0)
 #define GetSPKI(obj, spki) do { \
-    Data_Get_Struct((obj), NETSCAPE_SPKI, (spki)); \
+    TypedData_Get_Struct((obj), NETSCAPE_SPKI, &ossl_netscape_spki_type, (spki)); \
     if (!(spki)) { \
 	ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
     } \
@@ -37,6 +37,21 @@ VALUE eSPKIError; https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ns_spki.c#L37
 /*
  * Private functions
  */
+
+static void
+ossl_netscape_spki_free(void *spki)
+{
+    NETSCAPE_SPKI_free(spki);
+}
+
+static const rb_data_type_t ossl_netscape_spki_type = {
+    "OpenSSL/NETSCAPE_SPKI",
+    {
+	0, ossl_netscape_spki_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 static VALUE
 ossl_spki_alloc(VALUE klass)
 {

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

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