summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error.c7
-rw-r--r--file.c4
2 files changed, 5 insertions, 6 deletions
diff --git a/error.c b/error.c
index bb7cb1c4af..07b04a1036 100644
--- a/error.c
+++ b/error.c
@@ -1155,16 +1155,13 @@ static const rb_data_type_t name_err_mesg_data_type = {
VALUE
rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
{
+ VALUE result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, 0);
VALUE *ptr = ALLOC_N(VALUE, NAME_ERR_MESG_COUNT);
- VALUE result;
ptr[0] = mesg;
ptr[1] = recv;
ptr[2] = method;
- result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, ptr);
- RB_GC_GUARD(mesg);
- RB_GC_GUARD(recv);
- RB_GC_GUARD(method);
+ RTYPEDDATA_DATA(result) = ptr;
return result;
}
diff --git a/file.c b/file.c
index c724a4b97c..ac99de6043 100644
--- a/file.c
+++ b/file.c
@@ -406,12 +406,14 @@ static VALUE
stat_new_0(VALUE klass, const struct stat *st)
{
struct stat *nst = 0;
+ VALUE obj = TypedData_Wrap_Struct(klass, &stat_data_type, 0);
if (st) {
nst = ALLOC(struct stat);
*nst = *st;
+ RTYPEDDATA_DATA(obj) = nst;
}
- return TypedData_Wrap_Struct(klass, &stat_data_type, nst);
+ return obj;
}
VALUE