Skip to content

Commit

Permalink
* file.c (rb_file_s_basename): rb_enc_asciicompat() evaluates the arg…
Browse files Browse the repository at this point in the history
…ument multiple times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Mar 23, 2012
1 parent ee3e7dc commit 2bf3b20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3640,9 +3640,9 @@ rb_file_s_basename(int argc, VALUE *argv)
rb_encoding *enc;

if (rb_scan_args(argc, argv, "11", &fname, &fext) == 2) {
rb_encoding *enc;
StringValue(fext);
if (!rb_enc_asciicompat(enc = rb_enc_get(fext))) {
enc = rb_enc_get(fext);
if (!rb_enc_asciicompat(enc)) {
rb_raise(rb_eEncCompatError, "ascii incompatible character encodings: %s",
rb_enc_name(enc));
}
Expand Down

0 comments on commit 2bf3b20

Please sign in to comment.