summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-10-28 16:58:17 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2020-10-28 18:35:22 -0700
commit9f3adaf5293d6347250df218bad9dcd3cd8da9ba (patch)
tree4128d9eda3dc0686cdcdf99964acafc2e7b6a478 /ext
parentd8b0f1f7a84bf1ad85d649b125986ce181e79a58 (diff)
Use public allocators for creating new T_OBJECT objects
This way the header flags and object internals are set correctly
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3719
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/ancdata.c4
-rw-r--r--ext/socket/option.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index e0fc247..546a971 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -88,9 +88,9 @@ ancillary_initialize(VALUE self, VALUE vfamily, VALUE vlevel, VALUE vtype, VALUE
static VALUE
ancdata_new(int family, int level, int type, VALUE data)
{
- NEWOBJ_OF(obj, struct RObject, rb_cAncillaryData, T_OBJECT);
+ VALUE obj = rb_obj_alloc(rb_cAncillaryData);
StringValue(data);
- ancillary_initialize((VALUE)obj, INT2NUM(family), INT2NUM(level), INT2NUM(type), data);
+ ancillary_initialize(obj, INT2NUM(family), INT2NUM(level), INT2NUM(type), data);
return (VALUE)obj;
}
diff --git a/ext/socket/option.c b/ext/socket/option.c
index 5ad44cd..4b33b3f 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -106,9 +106,9 @@ sockopt_initialize(VALUE self, VALUE vfamily, VALUE vlevel, VALUE voptname, VALU
VALUE
rsock_sockopt_new(int family, int level, int optname, VALUE data)
{
- NEWOBJ_OF(obj, struct RObject, rb_cSockOpt, T_OBJECT);
+ VALUE obj = rb_obj_alloc(rb_cSockOpt);
StringValue(data);
- sockopt_initialize((VALUE)obj, INT2NUM(family), INT2NUM(level), INT2NUM(optname), data);
+ sockopt_initialize(obj, INT2NUM(family), INT2NUM(level), INT2NUM(optname), data);
return (VALUE)obj;
}