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

ruby-changes:67195

From: Mike <ko1@a...>
Date: Fri, 20 Aug 2021 08:30:26 +0900 (JST)
Subject: [ruby-changes:67195] c0f4e4ca6d (master): undefine alloc functions for C extensions

https://git.ruby-lang.org/ruby.git/commit/?id=c0f4e4ca6d

From c0f4e4ca6d0f76985bca79314b232b787c8f008e Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@g...>
Date: Fri, 28 May 2021 02:50:37 -0400
Subject: undefine alloc functions for C extensions

per guidance in doc/extension.rdoc, these classes now undefine their
alloc functions:

- ObjectSpace::InternalObjectWrapper
- Socket::Ifaddr
---
 ext/objspace/objspace.c | 1 +
 ext/socket/ifaddr.c     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 2784a88..72d1eb8 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -998,6 +998,7 @@ Init_objspace(void) https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L998
      * You can use the #type method to check the type of the internal object.
      */
     rb_cInternalObjectWrapper = rb_define_class_under(rb_mObjSpace, "InternalObjectWrapper", rb_cObject);
+    rb_undef_alloc_func(rb_cInternalObjectWrapper);
     rb_define_method(rb_cInternalObjectWrapper, "type", iow_type, 0);
     rb_define_method(rb_cInternalObjectWrapper, "inspect", iow_inspect, 0);
     rb_define_method(rb_cInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
diff --git a/ext/socket/ifaddr.c b/ext/socket/ifaddr.c
index da01325..1da259b 100644
--- a/ext/socket/ifaddr.c
+++ b/ext/socket/ifaddr.c
@@ -460,6 +460,7 @@ rsock_init_sockifaddr(void) https://github.com/ruby/ruby/blob/trunk/ext/socket/ifaddr.c#L460
      * Socket::Ifaddr represents a result of getifaddrs() function.
      */
     rb_cSockIfaddr = rb_define_class_under(rb_cSocket, "Ifaddr", rb_cObject);
+    rb_undef_alloc_func(rb_cSockIfaddr);
     rb_define_method(rb_cSockIfaddr, "inspect", ifaddr_inspect, 0);
     rb_define_method(rb_cSockIfaddr, "name", ifaddr_name, 0);
     rb_define_method(rb_cSockIfaddr, "ifindex", ifaddr_ifindex, 0);
-- 
cgit v1.1


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

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