From 28c2711230240fde0a9f66effbbd71108b4b0dfd Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 1 Jan 2009 19:43:49 +0000 Subject: * ext/socket/mkconstants.rb: check duplicates. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/mkconstants.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/socket') 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| -- cgit v1.2.3