Procházet zdrojové kódy

Correct return value of regerror

Ian Douglas Scott před 6 roky
rodič
revize
f5f561424a
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  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()
 }