ruby-changes:48625
From: suke <ko1@a...>
Date: Sat, 11 Nov 2017 12:57:08 +0900 (JST)
Subject: [ruby-changes:48625] suke:r60740 (trunk): * ext/win32ole/win32ole.c(ole_const_load): suppress constant redefinition
suke 2017-11-11 12:57:02 +0900 (Sat, 11 Nov 2017) New Revision: 60740 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60740 Log: * ext/win32ole/win32ole.c(ole_const_load): suppress constant redefinition warnings when WIN32OLE.const_load [Bug #14085] Modified files: trunk/ext/win32ole/win32ole.c Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 60739) +++ ext/win32ole/win32ole.c (revision 60740) @@ -26,7 +26,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L26 const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}}; #endif -#define WIN32OLE_VERSION "1.8.6" +#define WIN32OLE_VERSION "1.8.7" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -1809,7 +1809,9 @@ ole_const_load(ITypeLib *pTypeLib, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1809 *pName = toupper((int)*pName); id = rb_intern(pName); if (rb_is_const_id(id)) { - rb_define_const(klass, pName, val); + if(!rb_const_defined_at(klass, id)) { + rb_define_const(klass, pName, val); + } } else { rb_hash_aset(constant, rb_str_new2(pName), val); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/