Skip to content

Commit ba6a36e

Browse files
nobumatzbot
authored andcommitted
[ruby/digest] Fix --without-common-digest option
In `digest_conf`, "no implicit conversion of false into String" TypeError is raised. ruby/digest@89e5e5fe3a
1 parent 430789d commit ba6a36e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ext/digest/digest_conf.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
def digest_conf(name)
44
unless with_config("bundled-#{name}")
5-
cc = with_config("common-digest")
6-
if cc != false or /\b#{name}\b/ =~ cc
7-
if File.exist?("#$srcdir/#{name}cc.h") and
8-
have_header("CommonCrypto/CommonDigest.h")
9-
$defs << "-D#{name.upcase}_USE_COMMONDIGEST"
10-
$headers << "#{name}cc.h"
11-
return :commondigest
12-
end
5+
case cc = with_config("common-digest", true)
6+
when true, false
7+
else
8+
cc = cc.split(/[\s,]++/).any? {|pat| File.fnmatch?(pat, name)}
9+
end
10+
if cc and File.exist?("#$srcdir/#{name}cc.h") and
11+
have_header("CommonCrypto/CommonDigest.h")
12+
$defs << "-D#{name.upcase}_USE_COMMONDIGEST"
13+
$headers << "#{name}cc.h"
14+
return :commondigest
1315
end
1416
end
1517
$objs << "#{name}.#{$OBJEXT}"

0 commit comments

Comments
 (0)