Skip to content
Snippets Groups Projects
Commit 9d46fa4d authored by Tom Almeida's avatar Tom Almeida
Browse files

Missed having both loops look at themselves. I'm not sure how long this has been here.

parent 1f9f9f7d
No related branches found
No related tags found
1 merge request!78Yet another fix for strcspn and strspn.
......@@ -8,6 +8,8 @@ extern crate errno;
extern crate platform;
extern crate stdlib;
pub use compiler_builtins::mem::*;
use platform::types::*;
use errno::*;
use core::cmp;
......@@ -135,9 +137,9 @@ pub unsafe extern "C" fn strcspn(s1: *const c_char, s2: *const c_char) -> c_ulon
}
i = 0; // reset
while *s2.offset(i) != 0 {
if byteset[(*s2.offset(i) as usize) / (8 * byteset.len())]
& 1 << (*s2.offset(i) as usize % (8 * byteset.len())) > 0
while *s1.offset(i) != 0 {
if byteset[(*s1.offset(i) as usize) / (8 * byteset.len())]
& 1 << (*s1.offset(i) as usize % (8 * byteset.len())) > 0
{
break;
}
......@@ -287,9 +289,9 @@ pub unsafe extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> c_ulong
}
i = 0; // reset
while *s2.offset(i) != 0 {
if byteset[(*s2.offset(i) as usize) / (8 * byteset.len())]
& 1 << (*s2.offset(i) as usize % (8 * byteset.len())) < 1
while *s1.offset(i) != 0 {
if byteset[(*s1.offset(i) as usize) / (8 * byteset.len())]
& 1 << (*s1.offset(i) as usize % (8 * byteset.len())) < 1
{
break;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment