Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This crate basically came about so that the [nrfxlib](https://github.com/NordicP
* strlen
* strtol
* strstr
* strchr
* snprintf
* vsnprintf

Expand Down
12 changes: 6 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use cc;

fn main() {
// Build our snprintf substitute (which has to be C as Rust doesn't do varargs)
cc::Build::new()
.warnings(true)
.extra_warnings(true)
.file("./src/snprintf.c")
.compile("clocal");
// Build our snprintf substitute (which has to be C as Rust doesn't do varargs)
cc::Build::new()
.warnings(true)
.extra_warnings(true)
.file("./src/snprintf.c")
.compile("clocal");
}
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hard_tabs = true


16 changes: 8 additions & 8 deletions src/atoi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ use crate::{strtol, CChar, CInt, CLong};
/// ```
#[no_mangle]
pub unsafe extern "C" fn atoi(s: *const CChar) -> CInt {
let result = strtol(s);
if result > CInt::max_value() as CLong {
CInt::max_value()
} else if result < CInt::min_value() as CLong {
CInt::min_value()
} else {
result as CInt
}
let result = strtol(s);
if result > CInt::max_value() as CLong {
CInt::max_value()
} else if result < CInt::min_value() as CLong {
CInt::min_value()
} else {
result as CInt
}
}
Loading