summaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-29 10:31:31 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-29 10:31:31 +0000
commit1b940f5fa0674dfaf57e64ff332e0df6d106f069 (patch)
tree4ba2629e28731f544c1fae9980ba5c6a308e64c7 /dir.c
parent2d82f11ff3726f21afca6d06f0bc043e778e2d4f (diff)
downloadruby-1b940f5fa0674dfaf57e64ff332e0df6d106f069.tar.gz
ruby-1b940f5fa0674dfaf57e64ff332e0df6d106f069.tar.xz
ruby-1b940f5fa0674dfaf57e64ff332e0df6d106f069.zip
* dir.c (char_casecmp): fix: return 0 if either of characters is NUL.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/dir.c b/dir.c
index 905140ac4..3dfeb54b6 100644
--- a/dir.c
+++ b/dir.c
@@ -89,8 +89,7 @@ char_casecmp(const char *p1, const char *p2, rb_encoding *enc, const int nocase)
const char *p1end, *p2end;
int c1, c2;
- if (!*p1) return *p1;
- if (!*p2) return -*p2;
+ if (!*p1 || !*p2) return !!*p1 - !!*p2;
p1end = p1 + strlen(p1);
p2end = p2 + strlen(p2);
c1 = rb_enc_codepoint(p1, p1end, enc);