Explorar el Código

Correct return value of regerror

Ian Douglas Scott hace 6 años
padre
commit
f5f561424a
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/header/regex/mod.rs

+ 4 - 2
src/header/regex/mod.rs

@@ -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()
 }