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

ruby-changes:43779

From: nobu <ko1@a...>
Date: Wed, 10 Aug 2016 20:11:41 +0900 (JST)
Subject: [ruby-changes:43779] nobu:r55852 (trunk): win32/resolv: fix for cygwin

nobu	2016-08-10 20:11:36 +0900 (Wed, 10 Aug 2016)

  New Revision: 55852

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

  Log:
    win32/resolv: fix for cygwin
    
    * ext/win32/resolv/resolv.c: needs windows.h for iphlpapi.h on
      cygwin.  [ruby-core:76791] [Bug #12663]
    
    * ext/win32/resolv/resolv.c (w32error_make_error): use
      Win32::Resolv::Error, an alias of Win32::Registry::Error.

  Modified files:
    trunk/ext/win32/resolv/resolv.c
Index: ext/win32/resolv/resolv.c
===================================================================
--- ext/win32/resolv/resolv.c	(revision 55851)
+++ ext/win32/resolv/resolv.c	(revision 55852)
@@ -1,20 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ext/win32/resolv/resolv.c#L1
 #include <ruby.h>
 #include <ruby/encoding.h>
+#include <windows.h>
+#ifndef NTDDI_VERSION
+#define NTDDI_VERSION 0x06000000
+#endif
 #include <iphlpapi.h>
 
 static VALUE
-w32error_init(VALUE self, VALUE code)
-{
-    VALUE str = rb_str_new_cstr(rb_w32_strerror(NUM2INT(code)));
-    rb_ivar_set(self, rb_intern("@code"), code);
-    return rb_call_super(1, &str);
-}
-
-static VALUE
 w32error_make_error(DWORD e)
 {
     VALUE code = ULONG2NUM(e);
-    return rb_class_new_instance(1, &code, rb_path2class("Win32::Error"));
+    return rb_class_new_instance(1, &code, rb_path2class("Win32::Resolv::Error"));
 }
 
 static void
@@ -59,8 +55,6 @@ InitVM_resolv(void) https://github.com/ruby/ruby/blob/trunk/ext/win32/resolv/resolv.c#L55
     VALUE mWin32 = rb_define_module("Win32");
     VALUE resolv = rb_define_module_under(mWin32, "Resolv");
     VALUE singl = rb_singleton_class(resolv);
-    VALUE eclass = rb_define_class_under(mWin32, "Error", rb_eStandardError);
-    rb_define_method(eclass, "initialize", w32error_init, 1);
     rb_define_private_method(singl, "get_dns_server_list", get_dns_server_list, 0);
 }
 

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

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