string.h: don't pollute the namespace with locale.h
Previously, we included all of `<locale.h>` in order to get `locale_t`. This commit separates it into a `<bits/locale-t.h>` header (generated by cbindgen) to better deal with this.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
sys_includes = []
|
||||
include_guard = "_RELIBC_BITS_LOCALE_T_H"
|
||||
language = "C"
|
||||
style = "type"
|
||||
no_includes = true
|
||||
cpp_compat = true
|
||||
|
||||
[export]
|
||||
include = [
|
||||
"locale_t"
|
||||
]
|
||||
|
||||
[enum]
|
||||
prefix_with_name = true
|
||||
@@ -0,0 +1 @@
|
||||
pub type locale_t = *mut core::ffi::c_void;
|
||||
@@ -1,4 +1,7 @@
|
||||
include_guard = "_RELIBC_LOCALE_H"
|
||||
after_includes = """
|
||||
#include <bits/locale-t.h> // for locale_t
|
||||
"""
|
||||
trailer = "#include <bits/locale.h>"
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
|
||||
@@ -27,7 +27,7 @@ use constants::*;
|
||||
mod data;
|
||||
use data::*;
|
||||
|
||||
pub type locale_t = *mut c_void;
|
||||
use super::bits_locale_t::locale_t;
|
||||
/// constant struct to "C" or "POSIX" locale
|
||||
/// mutable because POSIX demands a mutable pointer
|
||||
static mut POSIX_LOCALE: lconv = posix_lconv();
|
||||
|
||||
@@ -4,6 +4,8 @@ pub mod _aio;
|
||||
pub mod _fenv;
|
||||
pub mod arpa_inet;
|
||||
pub mod assert;
|
||||
#[path = "bits_locale-t/mod.rs"]
|
||||
pub mod bits_locale_t;
|
||||
pub mod bits_pthread;
|
||||
pub mod bits_sched;
|
||||
// complex.h implemented in C
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
sys_includes = ["stddef.h", "stdint.h", "strings.h", "locale.h"]
|
||||
sys_includes = ["stddef.h", "stdint.h", "strings.h"]
|
||||
include_guard = "_RELIBC_STRING_H"
|
||||
after_includes = """
|
||||
#include <bits/locale-t.h> // for locale_t
|
||||
"""
|
||||
language = "C"
|
||||
style = "Tag"
|
||||
no_includes = true
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::{
|
||||
raw_cell::RawCell,
|
||||
};
|
||||
|
||||
use super::locale::{THREAD_LOCALE, locale_t};
|
||||
use super::{bits_locale_t::locale_t, locale::THREAD_LOCALE};
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/memccpy.html>.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user