From a63633edeaa949d5931d437f8210cfa02ca4e61f Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 14 Apr 2025 21:50:51 +0200 Subject: [PATCH] Remove redundant code in parse_codepoint --- src/input_common.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/input_common.rs b/src/input_common.rs index 4162b8312..5d9b954df 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -1019,15 +1019,15 @@ fn parse_codepoint( return ControlFlow::Continue(true); } let mut codepoint = u32::from(res); - let sz = unsafe { + match unsafe { mbrtowc( std::ptr::addr_of_mut!(codepoint), std::ptr::addr_of!(read_byte).cast(), 1, state, ) - } as isize; - match sz { + } as isize + { -1 => { FLOG!(reader, "Illegal input"); *consumed += 1; @@ -1038,12 +1038,6 @@ fn parse_codepoint( // Sequence not yet complete. return ControlFlow::Continue(false); } - 0 => { - // Actual nul char. - *consumed += 1; - out_seq.push('\0'); - return ControlFlow::Continue(true); - } _ => (), } if let Some(res) = char::from_u32(codepoint) {