diff --git a/src/header/regex/mod.rs b/src/header/regex/mod.rs index f0abbe7089..c76eba7256 100644 --- a/src/header/regex/mod.rs +++ b/src/header/regex/mod.rs @@ -1,12 +1,16 @@ -//! regex.h implementation, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/regex.h.html +//! `regex.h` implementation. +//! +//! See . use crate::{header::string::strlen, platform::types::*}; use alloc::{borrow::Cow, boxed::Box}; use core::{mem, ptr, slice}; use posix_regex::{PosixRegex, PosixRegexBuilder, compile::Error as CompileError, tree::Tree}; +/// See . pub type regoff_t = size_t; +/// See . #[repr(C)] pub struct regex_t { // Points to a posix_regex::Tree @@ -15,6 +19,7 @@ pub struct regex_t { re_nsub: size_t, } +/// See . #[repr(C)] pub struct regmatch_t { rm_so: regoff_t, @@ -43,6 +48,7 @@ pub const REG_ERANGE: c_int = 12; pub const REG_ESPACE: c_int = 13; pub const REG_BADRPT: c_int = 14; +/// See . #[unsafe(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 { @@ -74,12 +80,14 @@ pub unsafe extern "C" fn regcomp(out: *mut regex_t, pat: *const c_char, cflags: } } +/// See . #[unsafe(no_mangle)] #[linkage = "weak"] // redefined in GIT pub unsafe extern "C" fn regfree(regex: *mut regex_t) { Box::from_raw((*regex).ptr); } +/// See . #[unsafe(no_mangle)] #[linkage = "weak"] // redefined in GIT pub unsafe extern "C" fn regexec( @@ -120,6 +128,7 @@ pub unsafe extern "C" fn regexec( if matches.is_empty() { REG_NOMATCH } else { 0 } } +/// See . #[unsafe(no_mangle)] #[linkage = "weak"] // redefined in GIT pub extern "C" fn regerror(