diff --git a/src/scanner.rs b/src/scanner.rs index a15788d..f4316a7 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -29,49 +29,40 @@ unsafe fn CACHE(parser: *mut yaml_parser_t, length: size_t) -> i32 { } unsafe fn SKIP(parser: *mut yaml_parser_t) { - let index = addr_of_mut!((*parser).mark.index); - *index = (*index).wrapping_add(1); - let column = addr_of_mut!((*parser).mark.column); - *column = (*column).wrapping_add(1); - let unread = addr_of_mut!((*parser).unread); - *unread = (*unread).wrapping_sub(1); - let pointer = addr_of_mut!((*parser).buffer.pointer); - *pointer = (*pointer).wrapping_offset(WIDTH!((*parser).buffer) as isize); + (*parser).mark.index = (*parser).mark.index.wrapping_add(1); + (*parser).mark.column = (*parser).mark.column.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(1); + (*parser).buffer.pointer = (*parser) + .buffer + .pointer + .wrapping_offset(WIDTH!((*parser).buffer) as isize); } unsafe fn SKIP_LINE(parser: *mut yaml_parser_t) { if IS_CRLF!((*parser).buffer) { - let index = addr_of_mut!((*parser).mark.index); - *index = (*index as libc::c_ulong).wrapping_add(2_u64) as size_t as size_t; - (*parser).mark.column = 0_u64; - let line = addr_of_mut!((*parser).mark.line); - *line = (*line).wrapping_add(1); - let unread = addr_of_mut!((*parser).unread); - *unread = (*unread as libc::c_ulong).wrapping_sub(2_u64) as size_t as size_t; - let pointer = addr_of_mut!((*parser).buffer.pointer); - *pointer = (*pointer).wrapping_offset(2_isize); + (*parser).mark.index = (*parser).mark.index.wrapping_add(2); + (*parser).mark.column = 0; + (*parser).mark.line = (*parser).mark.line.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(2); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(2); } else if IS_BREAK!((*parser).buffer) { - let index = addr_of_mut!((*parser).mark.index); - *index = (*index).wrapping_add(1); - (*parser).mark.column = 0_u64; - let line = addr_of_mut!((*parser).mark.line); - *line = (*line).wrapping_add(1); - let unread = addr_of_mut!((*parser).unread); - *unread = (*unread).wrapping_sub(1); - let pointer = addr_of_mut!((*parser).buffer.pointer); - *pointer = (*pointer).wrapping_offset(WIDTH!((*parser).buffer) as isize); + (*parser).mark.index = (*parser).mark.index.wrapping_add(1); + (*parser).mark.column = 0; + (*parser).mark.line = (*parser).mark.line.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(1); + (*parser).buffer.pointer = (*parser) + .buffer + .pointer + .wrapping_offset(WIDTH!((*parser).buffer) as isize); }; } unsafe fn READ(parser: *mut yaml_parser_t, string: *mut yaml_string_t) -> i32 { if STRING_EXTEND!(parser, *string) != 0 { COPY!(*string, (*parser).buffer); - let fresh160 = addr_of_mut!((*parser).mark.index); - *fresh160 = (*fresh160).wrapping_add(1); - let fresh161 = addr_of_mut!((*parser).mark.column); - *fresh161 = (*fresh161).wrapping_add(1); - let fresh162 = addr_of_mut!((*parser).unread); - *fresh162 = (*fresh162).wrapping_sub(1); + (*parser).mark.index = (*parser).mark.index.wrapping_add(1); + (*parser).mark.column = (*parser).mark.column.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(1); 1_i32 } else { 0_i32 @@ -81,80 +72,47 @@ unsafe fn READ(parser: *mut yaml_parser_t, string: *mut yaml_string_t) -> i32 { unsafe fn READ_LINE(parser: *mut yaml_parser_t, string: *mut yaml_string_t) -> i32 { if STRING_EXTEND!(parser, *string) != 0 { if CHECK_AT!((*parser).buffer, b'\r', 0) && CHECK_AT!((*parser).buffer, b'\n', 1) { - let fresh484 = addr_of_mut!((*string).pointer); - let fresh485 = *fresh484; - *fresh484 = (*fresh484).wrapping_offset(1); - *fresh485 = b'\n'; - let fresh486 = addr_of_mut!((*parser).buffer.pointer); - *fresh486 = (*fresh486).wrapping_offset(2_isize); - let fresh487 = addr_of_mut!((*parser).mark.index); - *fresh487 = (*fresh487 as libc::c_ulong).wrapping_add(2_u64) as size_t as size_t; - (*parser).mark.column = 0_u64; - let fresh488 = addr_of_mut!((*parser).mark.line); - *fresh488 = (*fresh488).wrapping_add(1); - let fresh489 = addr_of_mut!((*parser).unread); - *fresh489 = (*fresh489 as libc::c_ulong).wrapping_sub(2_u64) as size_t as size_t; + *(*string).pointer = b'\n'; + (*string).pointer = (*string).pointer.wrapping_offset(1); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(2); + (*parser).mark.index = (*parser).mark.index.wrapping_add(2); + (*parser).mark.column = 0; + (*parser).mark.line = (*parser).mark.line.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(2); } else if CHECK_AT!((*parser).buffer, b'\r', 0) || CHECK_AT!((*parser).buffer, b'\n', 0) { - let fresh490 = addr_of_mut!((*string).pointer); - let fresh491 = *fresh490; - *fresh490 = (*fresh490).wrapping_offset(1); - *fresh491 = b'\n'; - let fresh492 = addr_of_mut!((*parser).buffer.pointer); - *fresh492 = (*fresh492).wrapping_offset(1); - let fresh493 = addr_of_mut!((*parser).mark.index); - *fresh493 = (*fresh493).wrapping_add(1); - (*parser).mark.column = 0_u64; - let fresh494 = addr_of_mut!((*parser).mark.line); - *fresh494 = (*fresh494).wrapping_add(1); - let fresh495 = addr_of_mut!((*parser).unread); - *fresh495 = (*fresh495).wrapping_sub(1); + *(*string).pointer = b'\n'; + (*string).pointer = (*string).pointer.wrapping_offset(1); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(1); + (*parser).mark.index = (*parser).mark.index.wrapping_add(1); + (*parser).mark.column = 0; + (*parser).mark.line = (*parser).mark.line.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(1); } else if CHECK_AT!((*parser).buffer, b'\xC2', 0) && CHECK_AT!((*parser).buffer, b'\x85', 1) { - let fresh496 = addr_of_mut!((*string).pointer); - let fresh497 = *fresh496; - *fresh496 = (*fresh496).wrapping_offset(1); - *fresh497 = b'\n'; - let fresh498 = addr_of_mut!((*parser).buffer.pointer); - *fresh498 = (*fresh498).wrapping_offset(2_isize); - let fresh499 = addr_of_mut!((*parser).mark.index); - *fresh499 = (*fresh499).wrapping_add(1); - (*parser).mark.column = 0_u64; - let fresh500 = addr_of_mut!((*parser).mark.line); - *fresh500 = (*fresh500).wrapping_add(1); - let fresh501 = addr_of_mut!((*parser).unread); - *fresh501 = (*fresh501).wrapping_sub(1); + *(*string).pointer = b'\n'; + (*string).pointer = (*string).pointer.wrapping_offset(1); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(2); + (*parser).mark.index = (*parser).mark.index.wrapping_add(1); + (*parser).mark.column = 0; + (*parser).mark.line = (*parser).mark.line.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(1); } else if CHECK_AT!((*parser).buffer, b'\xE2', 0) && CHECK_AT!((*parser).buffer, b'\x80', 1) && (CHECK_AT!((*parser).buffer, b'\xA8', 2) || CHECK_AT!((*parser).buffer, b'\xA9', 2)) { - let fresh502 = addr_of_mut!((*parser).buffer.pointer); - let fresh503 = *fresh502; - *fresh502 = (*fresh502).wrapping_offset(1); - let fresh504 = addr_of_mut!((*string).pointer); - let fresh505 = *fresh504; - *fresh504 = (*fresh504).wrapping_offset(1); - *fresh505 = *fresh503; - let fresh506 = addr_of_mut!((*parser).buffer.pointer); - let fresh507 = *fresh506; - *fresh506 = (*fresh506).wrapping_offset(1); - let fresh508 = addr_of_mut!((*string).pointer); - let fresh509 = *fresh508; - *fresh508 = (*fresh508).wrapping_offset(1); - *fresh509 = *fresh507; - let fresh510 = addr_of_mut!((*parser).buffer.pointer); - let fresh511 = *fresh510; - *fresh510 = (*fresh510).wrapping_offset(1); - let fresh512 = addr_of_mut!((*string).pointer); - let fresh513 = *fresh512; - *fresh512 = (*fresh512).wrapping_offset(1); - *fresh513 = *fresh511; - let fresh514 = addr_of_mut!((*parser).mark.index); - *fresh514 = (*fresh514).wrapping_add(1); - (*parser).mark.column = 0_u64; - let fresh515 = addr_of_mut!((*parser).mark.line); - *fresh515 = (*fresh515).wrapping_add(1); - let fresh516 = addr_of_mut!((*parser).unread); - *fresh516 = (*fresh516).wrapping_sub(1); + *(*string).pointer = *(*parser).buffer.pointer; + (*string).pointer = (*string).pointer.wrapping_offset(1); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(1); + *(*string).pointer = *(*parser).buffer.pointer; + (*string).pointer = (*string).pointer.wrapping_offset(1); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(1); + *(*string).pointer = *(*parser).buffer.pointer; + (*string).pointer = (*string).pointer.wrapping_offset(1); + (*parser).buffer.pointer = (*parser).buffer.pointer.wrapping_offset(1); + (*parser).mark.index = (*parser).mark.index.wrapping_add(1); + (*parser).mark.column = 0; + (*parser).mark.line = (*parser).mark.line.wrapping_add(1); + (*parser).unread = (*parser).unread.wrapping_sub(1); }; 1_i32 } else {