From 6696d26eb440a37ffae08e23d03491acce69ed06 Mon Sep 17 00:00:00 2001 From: auronandace Date: Tue, 30 Dec 2025 20:57:47 +0000 Subject: [PATCH] locale fnmatch dirent and ctype header cleanup --- src/header/ctype/mod.rs | 2 +- src/header/dirent/mod.rs | 23 ++++++++++++----------- src/header/fnmatch/mod.rs | 5 +++-- src/header/locale/mod.rs | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/header/ctype/mod.rs b/src/header/ctype/mod.rs index 0590d5a2ac..9f6cd192d5 100644 --- a/src/header/ctype/mod.rs +++ b/src/header/ctype/mod.rs @@ -7,7 +7,7 @@ // TODO: *_l functions -use crate::platform::types::*; +use crate::platform::types::c_int; /// See . #[unsafe(no_mangle)] diff --git a/src/header/dirent/mod.rs b/src/header/dirent/mod.rs index 4de934d6df..1d2912d332 100644 --- a/src/header/dirent/mod.rs +++ b/src/header/dirent/mod.rs @@ -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; diff --git a/src/header/fnmatch/mod.rs b/src/header/fnmatch/mod.rs index cee47bebd6..2f45056482 100644 --- a/src/header/fnmatch/mod.rs +++ b/src/header/fnmatch/mod.rs @@ -1,4 +1,4 @@ -//! fnmatch implementation +//! `fnmatch.h` implementation. //! //! See . @@ -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 . #[unsafe(no_mangle)] #[linkage = "weak"] // often redefined in GNU programs pub unsafe extern "C" fn fnmatch( diff --git a/src/header/locale/mod.rs b/src/header/locale/mod.rs index f03ac3560f..a44fd83908 100644 --- a/src/header/locale/mod.rs +++ b/src/header/locale/mod.rs @@ -84,6 +84,7 @@ pub unsafe extern "C" fn setlocale(category: c_int, locale: *const c_char) -> *m } } +/// See . #[unsafe(no_mangle)] pub unsafe extern "C" fn uselocale(newloc: locale_t) -> locale_t { let old_loc = if THREAD_LOCALE.is_null() {