Skip to content

Commit 962ede5

Browse files
authored
Merge pull request #1 from 42-technology-ltd/add_strchr
Add strchr
2 parents 66890fb + 52e3189 commit 962ede5

File tree

13 files changed

+578
-511
lines changed

13 files changed

+578
-511
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This crate basically came about so that the [nrfxlib](https://github.com/NordicP
1515
* strlen
1616
* strtol
1717
* strstr
18+
* strchr
1819
* snprintf
1920
* vsnprintf
2021

build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use cc;
22

33
fn main() {
4-
// Build our snprintf substitute (which has to be C as Rust doesn't do varargs)
5-
cc::Build::new()
6-
.warnings(true)
7-
.extra_warnings(true)
8-
.file("./src/snprintf.c")
9-
.compile("clocal");
4+
// Build our snprintf substitute (which has to be C as Rust doesn't do varargs)
5+
cc::Build::new()
6+
.warnings(true)
7+
.extra_warnings(true)
8+
.file("./src/snprintf.c")
9+
.compile("clocal");
1010
}

rustfmt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
hard_tabs = true
2+
3+

src/atoi.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ use crate::{strtol, CChar, CInt, CLong};
1616
/// ```
1717
#[no_mangle]
1818
pub unsafe extern "C" fn atoi(s: *const CChar) -> CInt {
19-
let result = strtol(s);
20-
if result > CInt::max_value() as CLong {
21-
CInt::max_value()
22-
} else if result < CInt::min_value() as CLong {
23-
CInt::min_value()
24-
} else {
25-
result as CInt
26-
}
19+
let result = strtol(s);
20+
if result > CInt::max_value() as CLong {
21+
CInt::max_value()
22+
} else if result < CInt::min_value() as CLong {
23+
CInt::min_value()
24+
} else {
25+
result as CInt
26+
}
2727
}

0 commit comments

Comments
 (0)