locale fnmatch dirent and ctype header cleanup

This commit is contained in:
auronandace
2025-12-30 20:57:47 +00:00
parent 0e506e97af
commit 6696d26eb4
4 changed files with 17 additions and 14 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
// TODO: *_l functions
use crate::platform::types::*;
use crate::platform::types::c_int;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/isalnum.html>.
#[unsafe(no_mangle)]
+12 -11
View File
@@ -4,10 +4,6 @@
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{
header::unistd::{SEEK_CUR, SEEK_SET},
platform::types::{c_int, c_void, off_t, size_t, ssize_t},
};
use alloc::{boxed::Box, vec::Vec};
use core::{mem, ptr, slice};
@@ -16,14 +12,19 @@ use crate::{
c_vec::CVec,
error::{Errno, ResultExt, ResultExtPtrMut},
fs::File,
header::{fcntl, stdlib, string},
header::{
errno::{self, EINVAL, EIO, ENOMEM, ENOTDIR},
fcntl, stdlib, string, sys_stat,
unistd::{SEEK_CUR, SEEK_SET},
},
out::Out,
platform::{self, Pal, Sys, types::*},
};
use super::{
errno::{self, EINVAL, EIO, ENOMEM, ENOTDIR},
sys_stat,
platform::{
self, Pal, Sys,
types::{
c_char, c_int, c_long, c_uchar, c_ushort, c_void, ino_t, off_t, reclen_t, size_t,
ssize_t,
},
},
};
const INITIAL_BUFSIZE: usize = 512;
+3 -2
View File
@@ -1,4 +1,4 @@
//! fnmatch implementation
//! `fnmatch.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fnmatch.h.html>.
@@ -7,7 +7,7 @@
use alloc::{borrow::Cow, vec::Vec};
use core::slice;
use crate::platform::types::*;
use crate::platform::types::{c_char, c_int};
use posix_regex::{
PosixRegex,
compile::{Collation, Range, Token},
@@ -126,6 +126,7 @@ unsafe fn tokenize(mut pattern: *const u8, flags: c_int) -> Tree {
builder.finish()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fnmatch.html>.
#[unsafe(no_mangle)]
#[linkage = "weak"] // often redefined in GNU programs
pub unsafe extern "C" fn fnmatch(
+1
View File
@@ -84,6 +84,7 @@ pub unsafe extern "C" fn setlocale(category: c_int, locale: *const c_char) -> *m
}
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/uselocale.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn uselocale(newloc: locale_t) -> locale_t {
let old_loc = if THREAD_LOCALE.is_null() {