Use crates.io posix-regex and support extended regex

This commit is contained in:
Jeremy Soller
2025-05-03 16:31:04 -06:00
parent 0f3f6f3c15
commit f8da7399d8
5 changed files with 5 additions and 15 deletions
-4
View File
@@ -2,10 +2,6 @@
path = openlibm
url = https://github.com/JuliaMath/openlibm.git
branch = master
[submodule "posix-regex"]
path = posix-regex
url = https://gitlab.redox-os.org/redox-os/posix-regex.git
branch = master
[submodule "compiler-builtins"]
path = compiler-builtins
url = https://gitlab.redox-os.org/redox-os/compiler-builtins.git
Generated
+3 -1
View File
@@ -373,7 +373,9 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "posix-regex"
version = "0.1.2"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66df580334caab2f744839ab1be85493d7ec731a92d6cf928008ab0b212bf3bc"
[[package]]
name = "proc-macro2"
+1 -1
View File
@@ -25,7 +25,7 @@ cc = "1"
[dependencies]
bitflags = "2"
cbitset = "0.2"
posix-regex = { path = "posix-regex", features = ["no_std"] }
posix-regex = { version = "0.1.4", features = ["no_std"] }
# TODO: For some reason, rand_jitter hasn't been updated to use the latest rand_core
rand = { version = "0.8", default-features = false, features = ["small_rng"] }
Submodule posix-regex deleted from f42f21519d
+1 -8
View File
@@ -46,13 +46,10 @@ pub const REG_BADRPT: c_int = 14;
#[no_mangle]
#[linkage = "weak"] // redefined in GIT
pub unsafe extern "C" fn regcomp(out: *mut regex_t, pat: *const c_char, cflags: c_int) -> c_int {
if cflags & REG_EXTENDED == REG_EXTENDED {
return REG_ENOSYS;
}
let pat = slice::from_raw_parts(pat as *const u8, strlen(pat));
let res = PosixRegexBuilder::new(pat)
.with_default_classes()
.extended(cflags & REG_EXTENDED == REG_EXTENDED)
.compile_tokens();
match res {
@@ -92,10 +89,6 @@ pub unsafe extern "C" fn regexec(
pmatch: *mut regmatch_t,
eflags: c_int,
) -> c_int {
if eflags & REG_EXTENDED == REG_EXTENDED {
return REG_ENOSYS;
}
let regex = &*regex;
// Allow specifying a compiler argument to the executor and viceversa