summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
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 905140ac48..3dfeb54b65 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);