summaryrefslogtreecommitdiff
path: root/ext/win32/resolv/resolv.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-10 11:11:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-10 11:11:36 +0000
commit27863a0ccd4350670b246e35085f97a9de7c057e (patch)
treecb4df2cffaca00a653ecf0a897f8bbbc51d2e0cd /ext/win32/resolv/resolv.c
parent064ed74be4a4d0d03a2de13f5d6732e62b959930 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32/resolv/resolv.c')
-rw-r--r--ext/win32/resolv/resolv.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/ext/win32/resolv/resolv.c b/ext/win32/resolv/resolv.c
index 436d62cc7b..f19243ccc1 100644
--- a/ext/win32/resolv/resolv.c
+++ b/ext/win32/resolv/resolv.c
@@ -1,20 +1,16 @@
#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)
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);
}