summaryrefslogtreecommitdiffstats
path: root/ext/socket
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
commit0aca84d0884e41217a1d9e2a5532befd2d61a442 (patch)
tree6ac588c430e5a22ed1dab0ecbe5f8bec343a45e9 /ext/socket
parenteb70912842b06794bcb51f0b3acee0ab4657a43c (diff)
downloadruby-0aca84d0884e41217a1d9e2a5532befd2d61a442.tar.gz
ruby-0aca84d0884e41217a1d9e2a5532befd2d61a442.tar.xz
ruby-0aca84d0884e41217a1d9e2a5532befd2d61a442.zip
* ext/socket/mkconstants.rb: check duplicates.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 318ffde67..82718b400 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|