This commit is contained in:
nora 2023-10-08 11:25:39 +02:00
parent 9e2cf38cd5
commit 8d1795ad1a
8 changed files with 126 additions and 5 deletions

View file

@ -1,4 +1,4 @@
use libuwuc::error::Error;
use libuwuc::{error::Error, utils::SharedThinCstr};
#[no_mangle]
pub unsafe extern "C" fn memset(ptr: *mut u8, constant: u8, len: usize) {
@ -25,6 +25,17 @@ pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, size: usize) -> i32
libuwuc::mem::memcmp(s1, s2, size)
}
#[no_mangle]
pub unsafe extern "C" fn strcmp(s1: SharedThinCstr<'_>, s2: SharedThinCstr<'_>) -> i32 {
libuwuc::mem::strcmp(s1, s2)
}
// This technically violates the safety precondition of SharedThinCstr but that's fine, we're careful.
#[no_mangle]
pub unsafe extern "C" fn strncmp(s1: SharedThinCstr<'_>, s2: SharedThinCstr<'_>, n: usize) -> i32 {
libuwuc::mem::strncmp(s1, s2, n)
}
#[no_mangle]
pub unsafe extern "C" fn strlen(s: *const u8) -> usize {
libuwuc::mem::strlen(s)