summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/mkconstants.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 318ffde678..82718b400e 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -34,12 +34,14 @@ result = ''
# workaround for NetBSD, OpenBSD and etc.
result << "#define pseudo_AF_FTIP pseudo_AF_RTIP\n"
-DEFS = []
+h = {}
DATA.each_line {|s|
name, default_value = s.scan(/\S+/)
next unless name && name[0] != ?#
- DEFS << [name, default_value]
+ raise "duplicate name: #{name}" if h.has_key? name
+ h[name] = default_value
}
+DEFS = h.to_a
def each_const
DEFS.each {|name, default_value|