|
@@ -149,7 +149,7 @@ pub extern "C" fn regexec(
|
|
|
|
|
|
#[no_mangle]
|
|
|
#[linkage = "weak"] // redefined in GIT
|
|
|
-pub extern "C" fn regerror(code: c_int, _regex: *const regex_t, out: *mut c_char, max: size_t) {
|
|
|
+pub extern "C" fn regerror(code: c_int, _regex: *const regex_t, out: *mut c_char, max: size_t) -> size_t {
|
|
|
let string = match code {
|
|
|
0 => "No error\0",
|
|
|
REG_NOMATCH => "No match\0",
|
|
@@ -174,6 +174,8 @@ pub extern "C" fn regerror(code: c_int, _regex: *const regex_t, out: *mut c_char
|
|
|
string.as_ptr(),
|
|
|
out as *mut u8,
|
|
|
string.len().min(max as usize),
|
|
|
- )
|
|
|
+ );
|
|
|
}
|
|
|
+
|
|
|
+ string.len()
|
|
|
}
|