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

ruby-changes:38425

From: nobu <ko1@a...>
Date: Sat, 16 May 2015 21:17:51 +0900 (JST)
Subject: [ruby-changes:38425] nobu:r50506 (trunk): gc.c: rename alloc as wrap

nobu	2015-05-16 21:17:14 +0900 (Sat, 16 May 2015)

  New Revision: 50506

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

  Log:
    gc.c: rename alloc as wrap
    
    * gc.c (rb_data_object_wrap, rb_data_typed_object_wrap): rename
      alloc as wrap.  these functions do not allocate data pointers
      but just wrap the given pointers.

  Modified files:
    trunk/ChangeLog
    trunk/ext/objspace/objspace.c
    trunk/gc.c
    trunk/include/ruby/ruby.h
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 50505)
+++ include/ruby/ruby.h	(revision 50506)
@@ -1010,9 +1010,9 @@ typedef void (*RUBY_DATA_FUNC)(void*); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1010
 #   define RUBY_UNTYPED_DATA_WARNING 0
 # endif
 #endif
-VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
+VALUE rb_data_object_wrap(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
 VALUE rb_data_object_zalloc(VALUE,size_t,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
-VALUE rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *);
+VALUE rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *);
 VALUE rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type);
 int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent);
 int rb_typeddata_is_kind_of(VALUE, const rb_data_type_t *);
@@ -1029,7 +1029,7 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1029
 #define RUBY_TYPED_PROMOTED1         FL_PROMOTED1    /* THIS FLAG DEPENDS ON Ruby version */
 
 #define Data_Wrap_Struct(klass,mark,free,sval)\
-    rb_data_object_alloc((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
+    rb_data_object_wrap((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
 
 #define Data_Make_Struct0(result, klass, size, mark, free, sval) \
     VALUE result = rb_data_object_zalloc(klass, size, mark, free); \
@@ -1042,12 +1042,12 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1042
 })
 #else
 #define Data_Make_Struct(klass,type,mark,free,sval) (\
-    rb_data_struct_make((klass),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free),(void **)&(sval),sizeof(type)) \
+    rb_data_object_make((klass),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free),(void **)&(sval),sizeof(type)) \
 )
 #endif
 
 #define TypedData_Wrap_Struct(klass,data_type,sval)\
-  rb_data_typed_object_alloc((klass),(sval),(data_type))
+  rb_data_typed_object_wrap((klass),(sval),(data_type))
 
 #define TypedData_Make_Struct0(result, klass, size, data_type, sval) \
     VALUE result = rb_data_typed_object_zalloc(klass, size, data_type); \
@@ -1060,7 +1060,7 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1060
 })
 #else
 #define TypedData_Make_Struct(klass, type, data_type, sval) (\
-    rb_data_typed_struct_make((klass),(data_type),(void **)&(sval),sizeof(type)) \
+    rb_data_typed_object_make((klass),(data_type),(void **)&(sval),sizeof(type)) \
 )
 #endif
 
@@ -1192,23 +1192,23 @@ rb_obj_freeze_inline(VALUE x) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1192
 #endif
 
 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
-RUBY_UNTYPED_DATA_FUNC(static inline VALUE rb_data_object_alloc_warning(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
+RUBY_UNTYPED_DATA_FUNC(static inline VALUE rb_data_object_wrap_warning(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
 #endif
 RUBY_UNTYPED_DATA_FUNC(static inline void *rb_data_object_get_warning(VALUE));
 
 static inline VALUE
-rb_data_object_alloc_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
+rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
 {
-    return rb_data_object_alloc(klass, ptr, mark, free);
+    return rb_data_object_wrap(klass, ptr, mark, free);
 }
 
 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
-#define rb_data_object_alloc_warning(klass, ptr, mark, free) \
+#define rb_data_object_wrap_warning(klass, ptr, mark, free) \
     __extension__( \
 	__builtin_choose_expr( \
 	    __builtin_constant_p(klass) && !(klass), \
-	    rb_data_object_alloc(klass, ptr, mark, free), \
-	    rb_data_object_alloc_warning(klass, ptr, mark, free)))
+	    rb_data_object_wrap(klass, ptr, mark, free), \
+	    rb_data_object_wrap_warning(klass, ptr, mark, free)))
 #endif
 
 static inline void *
@@ -1225,28 +1225,28 @@ rb_data_object_get_warning(VALUE obj) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1225
 }
 
 static inline VALUE
-rb_data_struct_make(VALUE klass, RUBY_DATA_FUNC mark_func, RUBY_DATA_FUNC free_func, void **datap, size_t size)
+rb_data_object_make(VALUE klass, RUBY_DATA_FUNC mark_func, RUBY_DATA_FUNC free_func, void **datap, size_t size)
 {
     Data_Make_Struct0(result, klass, size, mark_func, free_func, *datap);
     return result;
 }
 
 static inline VALUE
-rb_data_typed_struct_make(VALUE klass, const rb_data_type_t *type, void **datap, size_t size)
+rb_data_typed_object_make(VALUE klass, const rb_data_type_t *type, void **datap, size_t size)
 {
     TypedData_Make_Struct0(result, klass, size, type, *datap);
     return result;
 }
 
-#define rb_data_object_alloc_0 rb_data_object_alloc
-#define rb_data_object_alloc_1 rb_data_object_alloc_warning
-#define rb_data_object_alloc  RUBY_MACRO_SELECT(rb_data_object_alloc_, RUBY_UNTYPED_DATA_WARNING)
+#define rb_data_object_wrap_0 rb_data_object_wrap
+#define rb_data_object_wrap_1 rb_data_object_wrap_warning
+#define rb_data_object_wrap  RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)
 #define rb_data_object_get_0 rb_data_object_get
 #define rb_data_object_get_1 rb_data_object_get_warning
 #define rb_data_object_get  RUBY_MACRO_SELECT(rb_data_object_get_, RUBY_UNTYPED_DATA_WARNING)
-#define rb_data_struct_make_0 rb_data_struct_make
-#define rb_data_struct_make_1 rb_data_struct_make_warning
-#define rb_data_struct_make   RUBY_MACRO_SELECT(rb_data_struct_make_, RUBY_UNTYPED_DATA_WARNING)
+#define rb_data_object_make_0 rb_data_object_make
+#define rb_data_object_make_1 rb_data_object_make_warning
+#define rb_data_object_make   RUBY_MACRO_SELECT(rb_data_object_make_, RUBY_UNTYPED_DATA_WARNING)
 
 #if USE_RGENGC
 #define OBJ_PROMOTED_RAW(x)         ((RBASIC(x)->flags & (FL_PROMOTED0|FL_PROMOTED1)) == (FL_PROMOTED0|FL_PROMOTED1))
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50505)
+++ ChangeLog	(revision 50506)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May 16 21:17:11 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* gc.c (rb_data_object_wrap, rb_data_typed_object_wrap): rename
+	  alloc as wrap.  these functions do not allocate data pointers
+	  but just wrap the given pointers.
+
 Sat May 16 19:59:24 2015  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (rb_w32_accept): simplified.
Index: gc.c
===================================================================
--- gc.c	(revision 50505)
+++ gc.c	(revision 50506)
@@ -30,7 +30,7 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L30
 #include <sys/types.h>
 #include <assert.h>
 
-#undef rb_data_object_alloc
+#undef rb_data_object_wrap
 
 #ifndef __has_feature
 # define __has_feature(x) 0
@@ -1806,7 +1806,7 @@ rb_imemo_new_debug(enum imemo_type type, https://github.com/ruby/ruby/blob/trunk/gc.c#L1806
 #endif
 
 VALUE
-rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
+rb_data_object_wrap(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
 {
     if (klass) Check_Type(klass, T_CLASS);
     return newobj_of(klass, T_DATA, (VALUE)dmark, (VALUE)dfree, (VALUE)datap);
@@ -1815,13 +1815,13 @@ rb_data_object_alloc(VALUE klass, void * https://github.com/ruby/ruby/blob/trunk/gc.c#L1815
 VALUE
 rb_data_object_zalloc(VALUE klass, size_t size, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
 {
-    VALUE obj = rb_data_object_alloc(klass, 0, dmark, dfree);
+    VALUE obj = rb_data_object_wrap(klass, 0, dmark, dfree);
     DATA_PTR(obj) = xcalloc(1, size);
     return obj;
 }
 
 VALUE
-rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
+rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *type)
 {
     if (klass) Check_Type(klass, T_CLASS);
     return newobj_of(klass, T_DATA | (type->flags & ~T_MASK), (VALUE)type, (VALUE)1, (VALUE)datap);
@@ -1830,7 +1830,7 @@ rb_data_typed_object_alloc(VALUE klass, https://github.com/ruby/ruby/blob/trunk/gc.c#L1830
 VALUE
 rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type)
 {
-    VALUE obj = rb_data_typed_object_alloc(klass, 0, type);
+    VALUE obj = rb_data_typed_object_wrap(klass, 0, type);
     DATA_PTR(obj) = xcalloc(1, size);
     return obj;
 }
Index: ext/objspace/objspace.c
===================================================================
--- ext/objspace/objspace.c	(revision 50505)
+++ ext/objspace/objspace.c	(revision 50506)
@@ -600,7 +600,7 @@ static VALUE rb_mInternalObjectWrapper; https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L600
 static VALUE
 iow_newobj(VALUE obj)
 {
-    return rb_data_typed_object_alloc(rb_mInternalObjectWrapper, (void *)obj, &iow_data_type);
+    return TypedData_Wrap_Struct(rb_mInternalObjectWrapper, &iow_data_type, (void *)obj);
 }
 
 /* Returns the type of the internal object. */

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

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