summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 19:43:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 19:43:49 +0000
commit28c2711230240fde0a9f66effbbd71108b4b0dfd (patch)
tree6ac588c430e5a22ed1dab0ecbe5f8bec343a45e9 /ext/socket/mkconstants.rb
parentaa0ae0d3b6ab8d6c3143960bd0b3d154bd96d10e (diff)
* ext/socket/mkconstants.rb: check duplicates.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-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|