string: fix a couple minor issues in strncmp()

This commit is contained in:
Alex Lyon
2018-03-09 20:50:19 -08:00
parent 50f79e9a0e
commit cfc1014c6e
2 changed files with 1 additions and 3 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ pub unsafe extern "C" fn strncmp(s1: *const c_char, s2: *const c_char, n: usize)
for (&a, &b) in s1.iter().zip(s2.iter()) {
let val = (a as c_int) - (b as c_int);
if val != 0 || a == 0 {
if a != b || a == 0 {
return val;
}
}