summaryrefslogtreecommitdiffstats
path: root/ext/socket
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/mkconstants.rb4
-rw-r--r--ext/socket/socket.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 02d7e17b7..257b315c1 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -53,6 +53,9 @@ def each_data
end
result << ERB.new(<<'EOS', nil, '%').result(binding)
+static void
+init_constants(VALUE mConst)
+{
% each_data {|guard, define, name, default_value|
% if guard
#if <%=guard%>
@@ -69,6 +72,7 @@ result << ERB.new(<<'EOS', nil, '%').result(binding)
% end
% }
+}
EOS
if opt_o
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index b91e1396c..fe972ce5f 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -3592,6 +3592,8 @@ sock_define_uconst(const char *name, unsigned int value, VALUE mConst)
#define sock_define_const(name, value) sock_define_const(name, value, mConst)
#define sock_define_uconst(name, value) sock_define_uconst(name, value, mConst)
+#include "constants.h"
+
/*
* Class +Socket+ provides access to the underlying operating system
* socket implementations. It can be used to provide more operating system
@@ -3732,5 +3734,5 @@ Init_socket()
/* constants */
mConst = rb_define_module_under(rb_cSocket, "Constants");
-#include "constants.h"
+ init_constants(mConst);
}