ruby-changes:35043
From: suke <ko1@a...>
Date: Sun, 10 Aug 2014 12:23:44 +0900 (JST)
Subject: [ruby-changes:35043] suke:r47125 (trunk): * ext/win32ole/win32ole_type.c: refactoring.
suke 2014-08-10 12:23:39 +0900 (Sun, 10 Aug 2014) New Revision: 47125 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47125 Log: * ext/win32ole/win32ole_type.c: refactoring. Modified files: trunk/ChangeLog trunk/ext/win32ole/win32ole_type.c Index: ChangeLog =================================================================== --- ChangeLog (revision 47124) +++ ChangeLog (revision 47125) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Aug 10 12:22:43 2014 Masaki Suketa <masaki.suketa@n...> + + * ext/win32ole/win32ole_type.c: refactoring. + Sun Aug 10 10:34:00 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> * lib/cgi/session/pstore.rb: separated sample code. Index: ext/win32ole/win32ole_type.c =================================================================== --- ext/win32ole/win32ole_type.c (revision 47124) +++ ext/win32ole/win32ole_type.c (revision 47125) @@ -315,9 +315,8 @@ ole_ole_type(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L315 static VALUE foletype_ole_type(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_ole_type(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_ole_type(pTypeInfo); } static VALUE @@ -350,9 +349,8 @@ ole_type_guid(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L349 static VALUE foletype_guid(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_guid(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_guid(pTypeInfo); } static VALUE @@ -385,9 +383,8 @@ ole_type_progid(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L383 static VALUE foletype_progid(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_progid(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_progid(pTypeInfo); } @@ -420,9 +417,8 @@ ole_type_visible(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L417 static VALUE foletype_visible(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_visible(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_visible(pTypeInfo); } static VALUE @@ -450,9 +446,8 @@ ole_type_major_version(ITypeInfo *pTypeI https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L446 static VALUE foletype_major_version(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_major_version(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_major_version(pTypeInfo); } static VALUE @@ -480,9 +475,8 @@ ole_type_minor_version(ITypeInfo *pTypeI https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L475 static VALUE foletype_minor_version(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_minor_version(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_minor_version(pTypeInfo); } static VALUE @@ -511,9 +505,8 @@ ole_type_typekind(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L505 static VALUE foletype_typekind(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_typekind(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_typekind(pTypeInfo); } static VALUE @@ -539,9 +532,8 @@ ole_type_helpstring(ITypeInfo *pTypeInfo https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L532 static VALUE foletype_helpstring(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_helpstring(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_helpstring(pTypeInfo); } static VALUE @@ -574,9 +566,8 @@ ole_type_src_type(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L566 static VALUE foletype_src_type(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_src_type(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_src_type(pTypeInfo); } static VALUE @@ -603,9 +594,8 @@ ole_type_helpfile(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L594 static VALUE foletype_helpfile(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_helpfile(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_helpfile(pTypeInfo); } static VALUE @@ -631,9 +621,8 @@ ole_type_helpcontext(ITypeInfo *pTypeInf https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L621 static VALUE foletype_helpcontext(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_helpcontext(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_helpcontext(pTypeInfo); } static VALUE @@ -695,9 +684,8 @@ ole_variables(ITypeInfo *pTypeInfo) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L684 static VALUE foletype_variables(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_variables(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_variables(pTypeInfo); } /* @@ -715,9 +703,8 @@ foletype_variables(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L703 static VALUE foletype_methods(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_methods_from_typeinfo(ptype->pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_methods_from_typeinfo(pTypeInfo, INVOKE_FUNC | INVOKE_PROPERTYGET | INVOKE_PROPERTYPUT | INVOKE_PROPERTYPUTREF); } /* @@ -732,9 +719,8 @@ foletype_methods(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L719 static VALUE foletype_ole_typelib(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_typelib_from_itypeinfo(ptype->pTypeInfo); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_typelib_from_itypeinfo(pTypeInfo); } static VALUE @@ -790,9 +776,8 @@ ole_type_impl_ole_types(ITypeInfo *pType https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L776 static VALUE foletype_impl_ole_types(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_impl_ole_types(ptype->pTypeInfo, 0); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_impl_ole_types(pTypeInfo, 0); } /* @@ -808,9 +793,8 @@ foletype_impl_ole_types(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L793 static VALUE foletype_source_ole_types(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_impl_ole_types(ptype->pTypeInfo, IMPLTYPEFLAG_FSOURCE); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FSOURCE); } /* @@ -825,9 +809,8 @@ foletype_source_ole_types(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L809 static VALUE foletype_default_event_sources(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_impl_ole_types(ptype->pTypeInfo, IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FSOURCE|IMPLTYPEFLAG_FDEFAULT); } /* @@ -843,9 +826,8 @@ foletype_default_event_sources(VALUE sel https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole_type.c#L826 static VALUE foletype_default_ole_types(VALUE self) { - struct oletypedata *ptype; - Data_Get_Struct(self, struct oletypedata, ptype); - return ole_type_impl_ole_types(ptype->pTypeInfo, IMPLTYPEFLAG_FDEFAULT); + ITypeInfo *pTypeInfo = itypeinfo(self); + return ole_type_impl_ole_types(pTypeInfo, IMPLTYPEFLAG_FDEFAULT); } /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/