Skip to content
Snippets Groups Projects
Unverified Commit f5f56142 authored by Ian Douglas Scott's avatar Ian Douglas Scott
Browse files

Correct return value of regerror

parent fc0b7b91
No related branches found
No related tags found
1 merge request!181Some type signature fixes found using script in #111
......@@ -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()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment