diff --git a/src/api.rs b/src/api.rs index 32d451c..00a8980 100644 --- a/src/api.rs +++ b/src/api.rs @@ -78,9 +78,9 @@ pub(crate) unsafe fn yaml_string_join( b_start: *mut *mut yaml_char_t, b_pointer: *mut *mut yaml_char_t, _b_end: *mut *mut yaml_char_t, -) -> Success { +) { if *b_start == *b_pointer { - return OK; + return; } while (*a_end).c_offset_from(*a_pointer) as libc::c_long <= (*b_pointer).c_offset_from(*b_start) as libc::c_long @@ -94,7 +94,6 @@ pub(crate) unsafe fn yaml_string_join( ); *a_pointer = (*a_pointer).wrapping_offset((*b_pointer).c_offset_from(*b_start) as libc::c_long as isize); - OK } pub(crate) unsafe fn yaml_stack_extend( diff --git a/src/macros.rs b/src/macros.rs index 74bc600..789aa7a 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -75,24 +75,17 @@ macro_rules! CLEAR { } macro_rules! JOIN { - ($context:expr, $string_a:expr, $string_b:expr) => { - if yaml_string_join( + ($context:expr, $string_a:expr, $string_b:expr) => {{ + yaml_string_join( addr_of_mut!($string_a.start), addr_of_mut!($string_a.pointer), addr_of_mut!($string_a.end), addr_of_mut!($string_b.start), addr_of_mut!($string_b.pointer), addr_of_mut!($string_b.end), - ) - .ok - { - $string_b.pointer = $string_b.start; - OK - } else { - (*$context).error = YAML_MEMORY_ERROR; - FAIL - } - }; + ); + $string_b.pointer = $string_b.start; + }}; } macro_rules! CHECK_AT { diff --git a/src/scanner.rs b/src/scanner.rs index ad9a2dc..315c59b 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -1878,7 +1878,7 @@ unsafe fn yaml_parser_scan_uri_escapes( } unsafe fn yaml_parser_scan_block_scalar( - mut parser: *mut yaml_parser_t, + parser: *mut yaml_parser_t, mut token: *mut yaml_token_t, literal: bool, ) -> Success { @@ -2060,30 +2060,14 @@ unsafe fn yaml_parser_scan_block_scalar( } CLEAR!(leading_break); } else { - if JOIN!( + JOIN!( parser, string, leading_break - ) - .fail - { - current_block = - 14984465786483313892; - break; - } + ); CLEAR!(leading_break); } - if JOIN!( - parser, - string, - trailing_breaks - ) - .fail - { - current_block = - 14984465786483313892; - break; - } + JOIN!(parser, string, trailing_breaks); CLEAR!(trailing_breaks); leading_blank = IS_BLANK!((*parser).buffer) @@ -2120,19 +2104,13 @@ unsafe fn yaml_parser_scan_block_scalar( 14984465786483313892 => {} _ => { if chomping != -1 { - if JOIN!( + JOIN!( parser, string, leading_break - ) - .fail - { - current_block = - 14984465786483313892; - } else { - current_block = - 17787701279558130514; - } + ); + current_block = + 17787701279558130514; } else { current_block = 17787701279558130514; @@ -2141,17 +2119,12 @@ unsafe fn yaml_parser_scan_block_scalar( 14984465786483313892 => {} _ => { if chomping == 1 { - if JOIN!( + JOIN!( parser, string, trailing_breaks - ) - .fail - { - current_block = 14984465786483313892; - } else { - current_block = 14648606000749551097; - } + ); + current_block = 14648606000749551097; } else { current_block = 14648606000749551097; } @@ -2267,7 +2240,7 @@ unsafe fn yaml_parser_scan_block_scalar_breaks( } unsafe fn yaml_parser_scan_flow_scalar( - mut parser: *mut yaml_parser_t, + parser: *mut yaml_parser_t, mut token: *mut yaml_token_t, single: bool, ) -> Success { @@ -2619,30 +2592,18 @@ unsafe fn yaml_parser_scan_flow_scalar( string.pointer = string.pointer.wrapping_offset(1); *fresh711 = b' '; } else { - if JOIN!(parser, string, trailing_breaks).fail { - current_block = 8114179180390253173; - break; - } + JOIN!(parser, string, trailing_breaks); CLEAR!(trailing_breaks); } CLEAR!(leading_break); } else { - if JOIN!(parser, string, leading_break).fail { - current_block = 8114179180390253173; - break; - } - if JOIN!(parser, string, trailing_breaks).fail { - current_block = 8114179180390253173; - break; - } + JOIN!(parser, string, leading_break); + JOIN!(parser, string, trailing_breaks); CLEAR!(leading_break); CLEAR!(trailing_breaks); } } else { - if JOIN!(parser, string, whitespaces).fail { - current_block = 8114179180390253173; - break; - } + JOIN!(parser, string, whitespaces); CLEAR!(whitespaces); } } @@ -2759,31 +2720,19 @@ unsafe fn yaml_parser_scan_plain_scalar( string.pointer = string.pointer.wrapping_offset(1); *fresh717 = b' '; } else { - if JOIN!(parser, string, trailing_breaks).fail { - current_block = 16642808987012640029; - break 's_57; - } + JOIN!(parser, string, trailing_breaks); CLEAR!(trailing_breaks); } CLEAR!(leading_break); } else { - if JOIN!(parser, string, leading_break).fail { - current_block = 16642808987012640029; - break 's_57; - } - if JOIN!(parser, string, trailing_breaks).fail { - current_block = 16642808987012640029; - break 's_57; - } + JOIN!(parser, string, leading_break); + JOIN!(parser, string, trailing_breaks); CLEAR!(leading_break); CLEAR!(trailing_breaks); } leading_blanks = 0; } else { - if JOIN!(parser, string, whitespaces).fail { - current_block = 16642808987012640029; - break 's_57; - } + JOIN!(parser, string, whitespaces); CLEAR!(whitespaces); } }