Remove many c2rust artifacts

This commit is contained in:
Simon Ask Ulsnes 2024-01-26 13:24:40 +01:00
parent 7e8bd8c8b7
commit d9ceee9d89
10 changed files with 209 additions and 347 deletions

View file

@ -228,8 +228,7 @@ unsafe fn yaml_string_read_handler(
parser.input.string.current as *const libc::c_void, parser.input.string.current as *const libc::c_void,
size, size,
); );
let fresh80 = addr_of_mut!(parser.input.string.current); parser.input.string.current = parser.input.string.current.wrapping_offset(size as isize);
*fresh80 = (*fresh80).wrapping_offset(size as isize);
*size_read = size; *size_read = size;
1 1
} }
@ -246,19 +245,15 @@ pub unsafe fn yaml_parser_set_input_string(
) { ) {
__assert!((parser.read_handler).is_none()); __assert!((parser.read_handler).is_none());
__assert!(!input.is_null()); __assert!(!input.is_null());
let fresh81 = addr_of_mut!(parser.read_handler); parser.read_handler = Some(
*fresh81 = Some(
yaml_string_read_handler yaml_string_read_handler
as unsafe fn(*mut libc::c_void, *mut libc::c_uchar, size_t, *mut size_t) -> libc::c_int, as unsafe fn(*mut libc::c_void, *mut libc::c_uchar, size_t, *mut size_t) -> libc::c_int,
); );
let fresh82 = addr_of_mut!(parser.read_handler_data); let parser_ptr = parser as *mut _ as *mut libc::c_void;
*fresh82 = parser as *mut _ as *mut libc::c_void; parser.read_handler_data = parser_ptr;
let fresh83 = addr_of_mut!(parser.input.string.start); *(&mut parser.input.string.start) = input;
*fresh83 = input; *(&mut parser.input.string.current) = input;
let fresh84 = addr_of_mut!(parser.input.string.current); *(&mut parser.input.string.end) = input.wrapping_offset(size as isize);
*fresh84 = input;
let fresh85 = addr_of_mut!(parser.input.string.end);
*fresh85 = input.wrapping_offset(size as isize);
} }
/// Set a generic input handler. /// Set a generic input handler.
@ -268,10 +263,8 @@ pub unsafe fn yaml_parser_set_input(
data: *mut libc::c_void, data: *mut libc::c_void,
) { ) {
__assert!((parser.read_handler).is_none()); __assert!((parser.read_handler).is_none());
let fresh89 = addr_of_mut!(parser.read_handler); parser.read_handler = Some(handler);
*fresh89 = Some(handler); parser.read_handler_data = data;
let fresh90 = addr_of_mut!(parser.read_handler_data);
*fresh90 = data;
} }
/// Set the source encoding. /// Set the source encoding.
@ -358,7 +351,7 @@ unsafe fn yaml_string_write_handler(
buffer as *const libc::c_void, buffer as *const libc::c_void,
size, size,
); );
let fresh153 = addr_of_mut!((*emitter.output.string.size_written)); let fresh153 = &mut (*emitter.output.string.size_written);
*fresh153 = (*fresh153 as libc::c_ulong).force_add(size) as size_t; *fresh153 = (*fresh153 as libc::c_ulong).force_add(size) as size_t;
1 1
} }
@ -377,18 +370,14 @@ pub unsafe fn yaml_emitter_set_output_string(
) { ) {
__assert!((emitter.write_handler).is_none()); __assert!((emitter.write_handler).is_none());
__assert!(!output.is_null()); __assert!(!output.is_null());
let fresh154 = addr_of_mut!(emitter.write_handler); emitter.write_handler = Some(
*fresh154 = Some(
yaml_string_write_handler yaml_string_write_handler
as unsafe fn(*mut libc::c_void, *mut libc::c_uchar, size_t) -> libc::c_int, as unsafe fn(*mut libc::c_void, *mut libc::c_uchar, size_t) -> libc::c_int,
); );
let fresh155 = addr_of_mut!(emitter.write_handler_data); emitter.write_handler_data = emitter as *mut _ as *mut libc::c_void;
*fresh155 = emitter as *mut _ as *mut libc::c_void; emitter.output.string.buffer = output;
let fresh156 = addr_of_mut!(emitter.output.string.buffer);
*fresh156 = output;
emitter.output.string.size = size; emitter.output.string.size = size;
let fresh157 = addr_of_mut!(emitter.output.string.size_written); emitter.output.string.size_written = size_written;
*fresh157 = size_written;
*size_written = 0_u64; *size_written = 0_u64;
} }
@ -399,10 +388,8 @@ pub unsafe fn yaml_emitter_set_output(
data: *mut libc::c_void, data: *mut libc::c_void,
) { ) {
__assert!(emitter.write_handler.is_none()); __assert!(emitter.write_handler.is_none());
let fresh161 = addr_of_mut!(emitter.write_handler); emitter.write_handler = Some(handler);
*fresh161 = Some(handler); emitter.write_handler_data = data;
let fresh162 = addr_of_mut!(emitter.write_handler_data);
*fresh162 = data;
} }
/// Set the output encoding. /// Set the output encoding.
@ -643,12 +630,9 @@ pub unsafe fn yaml_document_start_event_initialize(
event.type_ = YAML_DOCUMENT_START_EVENT; event.type_ = YAML_DOCUMENT_START_EVENT;
event.start_mark = mark; event.start_mark = mark;
event.end_mark = mark; event.end_mark = mark;
let fresh164 = addr_of_mut!(event.data.document_start.version_directive); event.data.document_start.version_directive = version_directive_copy;
*fresh164 = version_directive_copy; event.data.document_start.tag_directives.start = tag_directives_copy.start;
let fresh165 = addr_of_mut!(event.data.document_start.tag_directives.start); event.data.document_start.tag_directives.end = tag_directives_copy.top;
*fresh165 = tag_directives_copy.start;
let fresh166 = addr_of_mut!(event.data.document_start.tag_directives.end);
*fresh166 = tag_directives_copy.top;
event.data.document_start.implicit = implicit; event.data.document_start.implicit = implicit;
return Ok(()); return Ok(());
} }
@ -705,8 +689,7 @@ pub unsafe fn yaml_alias_event_initialize(
event.type_ = YAML_ALIAS_EVENT; event.type_ = YAML_ALIAS_EVENT;
event.start_mark = mark; event.start_mark = mark;
event.end_mark = mark; event.end_mark = mark;
let fresh167 = addr_of_mut!(event.data.alias.anchor); event.data.alias.anchor = anchor_copy;
*fresh167 = anchor_copy;
Ok(()) Ok(())
} }
@ -782,12 +765,9 @@ pub unsafe fn yaml_scalar_event_initialize(
event.type_ = YAML_SCALAR_EVENT; event.type_ = YAML_SCALAR_EVENT;
event.start_mark = mark; event.start_mark = mark;
event.end_mark = mark; event.end_mark = mark;
let fresh168 = addr_of_mut!(event.data.scalar.anchor); event.data.scalar.anchor = anchor_copy;
*fresh168 = anchor_copy; event.data.scalar.tag = tag_copy;
let fresh169 = addr_of_mut!(event.data.scalar.tag); event.data.scalar.value = value_copy;
*fresh169 = tag_copy;
let fresh170 = addr_of_mut!(event.data.scalar.value);
*fresh170 = value_copy;
event.data.scalar.length = length as size_t; event.data.scalar.length = length as size_t;
event.data.scalar.plain_implicit = plain_implicit; event.data.scalar.plain_implicit = plain_implicit;
event.data.scalar.quoted_implicit = quoted_implicit; event.data.scalar.quoted_implicit = quoted_implicit;
@ -857,10 +837,8 @@ pub unsafe fn yaml_sequence_start_event_initialize(
event.type_ = YAML_SEQUENCE_START_EVENT; event.type_ = YAML_SEQUENCE_START_EVENT;
event.start_mark = mark; event.start_mark = mark;
event.end_mark = mark; event.end_mark = mark;
let fresh171 = addr_of_mut!(event.data.sequence_start.anchor); event.data.sequence_start.anchor = anchor_copy;
*fresh171 = anchor_copy; event.data.sequence_start.tag = tag_copy;
let fresh172 = addr_of_mut!(event.data.sequence_start.tag);
*fresh172 = tag_copy;
event.data.sequence_start.implicit = implicit; event.data.sequence_start.implicit = implicit;
event.data.sequence_start.style = style; event.data.sequence_start.style = style;
return Ok(()); return Ok(());
@ -941,10 +919,8 @@ pub unsafe fn yaml_mapping_start_event_initialize(
event.type_ = YAML_MAPPING_START_EVENT; event.type_ = YAML_MAPPING_START_EVENT;
event.start_mark = mark; event.start_mark = mark;
event.end_mark = mark; event.end_mark = mark;
let fresh173 = addr_of_mut!(event.data.mapping_start.anchor); event.data.mapping_start.anchor = anchor_copy;
*fresh173 = anchor_copy; event.data.mapping_start.tag = tag_copy;
let fresh174 = addr_of_mut!(event.data.mapping_start.tag);
*fresh174 = tag_copy;
event.data.mapping_start.implicit = implicit; event.data.mapping_start.implicit = implicit;
event.data.mapping_start.style = style; event.data.mapping_start.style = style;
return Ok(()); return Ok(());
@ -1006,7 +982,7 @@ pub unsafe fn yaml_event_delete(event: &mut yaml_event_t) {
/// Create a YAML document. /// Create a YAML document.
pub unsafe fn yaml_document_initialize( pub unsafe fn yaml_document_initialize(
document: *mut yaml_document_t, document: &mut yaml_document_t,
version_directive: *mut yaml_version_directive_t, version_directive: *mut yaml_version_directive_t,
tag_directives_start: *mut yaml_tag_directive_t, tag_directives_start: *mut yaml_tag_directive_t,
tag_directives_end: *mut yaml_tag_directive_t, tag_directives_end: *mut yaml_tag_directive_t,
@ -1045,7 +1021,6 @@ pub unsafe fn yaml_document_initialize(
line: 0_u64, line: 0_u64,
column: 0_u64, column: 0_u64,
}; };
__assert!(!document.is_null());
__assert!( __assert!(
!tag_directives_start.is_null() && !tag_directives_end.is_null() !tag_directives_start.is_null() && !tag_directives_end.is_null()
|| tag_directives_start == tag_directives_end || tag_directives_start == tag_directives_end
@ -1101,27 +1076,17 @@ pub unsafe fn yaml_document_initialize(
current_block = 14818589718467733107; current_block = 14818589718467733107;
} }
if current_block != 8142820162064489797 { if current_block != 8142820162064489797 {
memset( *document = core::mem::MaybeUninit::zeroed().assume_init();
document as *mut libc::c_void, document.nodes.start = nodes.start;
0, document.nodes.end = nodes.end;
size_of::<yaml_document_t>() as libc::c_ulong, document.nodes.top = nodes.start;
); document.version_directive = version_directive_copy;
let fresh176 = addr_of_mut!((*document).nodes.start); document.tag_directives.start = tag_directives_copy.start;
*fresh176 = nodes.start; document.tag_directives.end = tag_directives_copy.top;
let fresh177 = addr_of_mut!((*document).nodes.end); document.start_implicit = start_implicit;
*fresh177 = nodes.end; document.end_implicit = end_implicit;
let fresh178 = addr_of_mut!((*document).nodes.top); document.start_mark = mark;
*fresh178 = nodes.start; document.end_mark = mark;
let fresh179 = addr_of_mut!((*document).version_directive);
*fresh179 = version_directive_copy;
let fresh180 = addr_of_mut!((*document).tag_directives.start);
*fresh180 = tag_directives_copy.start;
let fresh181 = addr_of_mut!((*document).tag_directives.end);
*fresh181 = tag_directives_copy.top;
(*document).start_implicit = start_implicit;
(*document).end_implicit = end_implicit;
(*document).start_mark = mark;
(*document).end_mark = mark;
return Ok(()); return Ok(());
} }
STACK_DEL!(nodes); STACK_DEL!(nodes);
@ -1138,11 +1103,10 @@ pub unsafe fn yaml_document_initialize(
} }
/// Delete a YAML document and all its nodes. /// Delete a YAML document and all its nodes.
pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) { pub unsafe fn yaml_document_delete(document: &mut yaml_document_t) {
let mut tag_directive: *mut yaml_tag_directive_t; let mut tag_directive: *mut yaml_tag_directive_t;
__assert!(!document.is_null()); while !STACK_EMPTY!(document.nodes) {
while !STACK_EMPTY!((*document).nodes) { let mut node = POP!(document.nodes);
let mut node = POP!((*document).nodes);
yaml_free(node.tag as *mut libc::c_void); yaml_free(node.tag as *mut libc::c_void);
match node.type_ { match node.type_ {
YAML_SCALAR_NODE => { YAML_SCALAR_NODE => {
@ -1159,20 +1123,16 @@ pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) {
} }
} }
} }
STACK_DEL!((*document).nodes); STACK_DEL!(document.nodes);
yaml_free((*document).version_directive as *mut libc::c_void); yaml_free(document.version_directive as *mut libc::c_void);
tag_directive = (*document).tag_directives.start; tag_directive = document.tag_directives.start;
while tag_directive != (*document).tag_directives.end { while tag_directive != document.tag_directives.end {
yaml_free((*tag_directive).handle as *mut libc::c_void); yaml_free((*tag_directive).handle as *mut libc::c_void);
yaml_free((*tag_directive).prefix as *mut libc::c_void); yaml_free((*tag_directive).prefix as *mut libc::c_void);
tag_directive = tag_directive.wrapping_offset(1); tag_directive = tag_directive.wrapping_offset(1);
} }
yaml_free((*document).tag_directives.start as *mut libc::c_void); yaml_free(document.tag_directives.start as *mut libc::c_void);
memset( *document = MaybeUninit::zeroed().assume_init();
document as *mut libc::c_void,
0,
size_of::<yaml_document_t>() as libc::c_ulong,
);
} }
/// Get a node of a YAML document. /// Get a node of a YAML document.
@ -1182,12 +1142,10 @@ pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) {
/// ///
/// Returns the node objct or NULL if `node_id` is out of range. /// Returns the node objct or NULL if `node_id` is out of range.
pub unsafe fn yaml_document_get_node( pub unsafe fn yaml_document_get_node(
document: *mut yaml_document_t, document: &mut yaml_document_t,
index: libc::c_int, index: libc::c_int,
) -> *mut yaml_node_t { ) -> *mut yaml_node_t {
__assert!(!document.is_null()); if index > 0 && document.nodes.start.wrapping_offset(index as isize) <= document.nodes.top {
if index > 0 && (*document).nodes.start.wrapping_offset(index as isize) <= (*document).nodes.top
{
return (*document) return (*document)
.nodes .nodes
.start .start
@ -1207,10 +1165,9 @@ pub unsafe fn yaml_document_get_node(
/// An empty document produced by the parser signifies the end of a YAML stream. /// An empty document produced by the parser signifies the end of a YAML stream.
/// ///
/// Returns the node object or NULL if the document is empty. /// Returns the node object or NULL if the document is empty.
pub unsafe fn yaml_document_get_root_node(document: *mut yaml_document_t) -> *mut yaml_node_t { pub unsafe fn yaml_document_get_root_node(document: &mut yaml_document_t) -> *mut yaml_node_t {
__assert!(!document.is_null()); if document.nodes.top != document.nodes.start {
if (*document).nodes.top != (*document).nodes.start { return document.nodes.start;
return (*document).nodes.start;
} }
ptr::null_mut::<yaml_node_t>() ptr::null_mut::<yaml_node_t>()
} }
@ -1222,7 +1179,7 @@ pub unsafe fn yaml_document_get_root_node(document: *mut yaml_document_t) -> *mu
/// Returns the node id or 0 on error. /// Returns the node id or 0 on error.
#[must_use] #[must_use]
pub unsafe fn yaml_document_add_scalar( pub unsafe fn yaml_document_add_scalar(
document: *mut yaml_document_t, document: &mut yaml_document_t,
mut tag: *const yaml_char_t, mut tag: *const yaml_char_t,
value: *const yaml_char_t, value: *const yaml_char_t,
mut length: libc::c_int, mut length: libc::c_int,
@ -1237,7 +1194,6 @@ pub unsafe fn yaml_document_add_scalar(
let mut value_copy: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>(); let mut value_copy: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
let mut node = MaybeUninit::<yaml_node_t>::uninit(); let mut node = MaybeUninit::<yaml_node_t>::uninit();
let node = node.as_mut_ptr(); let node = node.as_mut_ptr();
__assert!(!document.is_null());
__assert!(!value.is_null()); __assert!(!value.is_null());
if tag.is_null() { if tag.is_null() {
tag = b"tag:yaml.org,2002:str\0" as *const u8 as *const libc::c_char as *mut yaml_char_t; tag = b"tag:yaml.org,2002:str\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
@ -1268,8 +1224,8 @@ pub unsafe fn yaml_document_add_scalar(
(*node).data.scalar.value = value_copy; (*node).data.scalar.value = value_copy;
(*node).data.scalar.length = length as size_t; (*node).data.scalar.length = length as size_t;
(*node).data.scalar.style = style; (*node).data.scalar.style = style;
PUSH!((*document).nodes, *node); PUSH!(document.nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int; return document.nodes.top.c_offset_from(document.nodes.start) as libc::c_int;
} }
} }
} }
@ -1285,7 +1241,7 @@ pub unsafe fn yaml_document_add_scalar(
/// Returns the node id or 0 on error. /// Returns the node id or 0 on error.
#[must_use] #[must_use]
pub unsafe fn yaml_document_add_sequence( pub unsafe fn yaml_document_add_sequence(
document: *mut yaml_document_t, document: &mut yaml_document_t,
mut tag: *const yaml_char_t, mut tag: *const yaml_char_t,
style: yaml_sequence_style_t, style: yaml_sequence_style_t,
) -> libc::c_int { ) -> libc::c_int {
@ -1307,7 +1263,6 @@ pub unsafe fn yaml_document_add_sequence(
}; };
let mut node = MaybeUninit::<yaml_node_t>::uninit(); let mut node = MaybeUninit::<yaml_node_t>::uninit();
let node = node.as_mut_ptr(); let node = node.as_mut_ptr();
__assert!(!document.is_null());
if tag.is_null() { if tag.is_null() {
tag = b"tag:yaml.org,2002:seq\0" as *const u8 as *const libc::c_char as *mut yaml_char_t; tag = b"tag:yaml.org,2002:seq\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
} }
@ -1328,8 +1283,8 @@ pub unsafe fn yaml_document_add_sequence(
(*node).data.sequence.items.end = items.end; (*node).data.sequence.items.end = items.end;
(*node).data.sequence.items.top = items.start; (*node).data.sequence.items.top = items.start;
(*node).data.sequence.style = style; (*node).data.sequence.style = style;
PUSH!((*document).nodes, *node); PUSH!(document.nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int; return document.nodes.top.c_offset_from(document.nodes.start) as libc::c_int;
} }
} }
STACK_DEL!(items); STACK_DEL!(items);
@ -1344,7 +1299,7 @@ pub unsafe fn yaml_document_add_sequence(
/// Returns the node id or 0 on error. /// Returns the node id or 0 on error.
#[must_use] #[must_use]
pub unsafe fn yaml_document_add_mapping( pub unsafe fn yaml_document_add_mapping(
document: *mut yaml_document_t, document: &mut yaml_document_t,
mut tag: *const yaml_char_t, mut tag: *const yaml_char_t,
style: yaml_mapping_style_t, style: yaml_mapping_style_t,
) -> libc::c_int { ) -> libc::c_int {
@ -1366,7 +1321,6 @@ pub unsafe fn yaml_document_add_mapping(
}; };
let mut node = MaybeUninit::<yaml_node_t>::uninit(); let mut node = MaybeUninit::<yaml_node_t>::uninit();
let node = node.as_mut_ptr(); let node = node.as_mut_ptr();
__assert!(!document.is_null());
if tag.is_null() { if tag.is_null() {
tag = b"tag:yaml.org,2002:map\0" as *const u8 as *const libc::c_char as *mut yaml_char_t; tag = b"tag:yaml.org,2002:map\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
} }
@ -1387,8 +1341,8 @@ pub unsafe fn yaml_document_add_mapping(
(*node).data.mapping.pairs.end = pairs.end; (*node).data.mapping.pairs.end = pairs.end;
(*node).data.mapping.pairs.top = pairs.start; (*node).data.mapping.pairs.top = pairs.start;
(*node).data.mapping.style = style; (*node).data.mapping.style = style;
PUSH!((*document).nodes, *node); PUSH!(document.nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int; return document.nodes.top.c_offset_from(document.nodes.start) as libc::c_int;
} }
} }
STACK_DEL!(pairs); STACK_DEL!(pairs);
@ -1398,26 +1352,23 @@ pub unsafe fn yaml_document_add_mapping(
/// Add an item to a SEQUENCE node. /// Add an item to a SEQUENCE node.
pub unsafe fn yaml_document_append_sequence_item( pub unsafe fn yaml_document_append_sequence_item(
document: *mut yaml_document_t, document: &mut yaml_document_t,
sequence: libc::c_int, sequence: libc::c_int,
item: libc::c_int, item: libc::c_int,
) -> Result<(), ()> { ) -> Result<(), ()> {
__assert!(!document.is_null());
__assert!( __assert!(
sequence > 0 sequence > 0
&& ((*document).nodes.start).wrapping_offset(sequence as isize) && (document.nodes.start).wrapping_offset(sequence as isize) <= document.nodes.top
<= (*document).nodes.top
); );
__assert!( __assert!(
(*((*document).nodes.start).wrapping_offset((sequence - 1) as isize)).type_ (*(document.nodes.start).wrapping_offset((sequence - 1) as isize)).type_
== YAML_SEQUENCE_NODE == YAML_SEQUENCE_NODE
); );
__assert!( __assert!(
item > 0 item > 0 && (document.nodes.start).wrapping_offset(item as isize) <= document.nodes.top
&& ((*document).nodes.start).wrapping_offset(item as isize) <= (*document).nodes.top
); );
PUSH!( PUSH!(
(*((*document).nodes.start).wrapping_offset((sequence - 1) as isize)) (*(document.nodes.start).wrapping_offset((sequence - 1) as isize))
.data .data
.sequence .sequence
.items, .items,
@ -1428,30 +1379,28 @@ pub unsafe fn yaml_document_append_sequence_item(
/// Add a pair of a key and a value to a MAPPING node. /// Add a pair of a key and a value to a MAPPING node.
pub unsafe fn yaml_document_append_mapping_pair( pub unsafe fn yaml_document_append_mapping_pair(
document: *mut yaml_document_t, document: &mut yaml_document_t,
mapping: libc::c_int, mapping: libc::c_int,
key: libc::c_int, key: libc::c_int,
value: libc::c_int, value: libc::c_int,
) -> Result<(), ()> { ) -> Result<(), ()> {
__assert!(!document.is_null());
__assert!( __assert!(
mapping > 0 mapping > 0
&& ((*document).nodes.start).wrapping_offset(mapping as isize) <= (*document).nodes.top && (document.nodes.start).wrapping_offset(mapping as isize) <= document.nodes.top
); );
__assert!( __assert!(
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize)).type_ (*(document.nodes.start).wrapping_offset((mapping - 1) as isize)).type_
== YAML_MAPPING_NODE == YAML_MAPPING_NODE
); );
__assert!( __assert!(
key > 0 && ((*document).nodes.start).wrapping_offset(key as isize) <= (*document).nodes.top key > 0 && (document.nodes.start).wrapping_offset(key as isize) <= document.nodes.top
); );
__assert!( __assert!(
value > 0 value > 0 && (document.nodes.start).wrapping_offset(value as isize) <= document.nodes.top
&& ((*document).nodes.start).wrapping_offset(value as isize) <= (*document).nodes.top
); );
let pair = yaml_node_pair_t { key, value }; let pair = yaml_node_pair_t { key, value };
PUSH!( PUSH!(
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize)) (*(document.nodes.start).wrapping_offset((mapping - 1) as isize))
.data .data
.mapping .mapping
.pairs, .pairs,

View file

@ -72,8 +72,7 @@ pub unsafe fn yaml_emitter_dump(
column: 0_u64, column: 0_u64,
}; };
__assert!(!document.is_null()); __assert!(!document.is_null());
let fresh0 = addr_of_mut!(emitter.document); emitter.document = document;
*fresh0 = document;
if !emitter.opened { if !emitter.opened {
if yaml_emitter_open(emitter).is_err() { if yaml_emitter_open(emitter).is_err() {
current_block = 5018439318894558507; current_block = 5018439318894558507;
@ -92,8 +91,7 @@ pub unsafe fn yaml_emitter_dump(
} }
} else { } else {
__assert!(emitter.opened); __assert!(emitter.opened);
let fresh1 = addr_of_mut!(emitter.anchors); emitter.anchors = yaml_malloc(
*fresh1 = yaml_malloc(
(size_of::<yaml_anchors_t>() as libc::c_ulong) (size_of::<yaml_anchors_t>() as libc::c_ulong)
.force_mul((*document).nodes.top.c_offset_from((*document).nodes.start) .force_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
as libc::c_ulong), as libc::c_ulong),
@ -138,9 +136,8 @@ pub unsafe fn yaml_emitter_dump(
unsafe fn yaml_emitter_delete_document_and_anchors(emitter: &mut yaml_emitter_t) { unsafe fn yaml_emitter_delete_document_and_anchors(emitter: &mut yaml_emitter_t) {
let mut index: libc::c_int; let mut index: libc::c_int;
if emitter.anchors.is_null() { if emitter.anchors.is_null() {
yaml_document_delete(emitter.document); yaml_document_delete(&mut *emitter.document);
let fresh2 = addr_of_mut!(emitter.document); emitter.document = ptr::null_mut::<yaml_document_t>();
*fresh2 = ptr::null_mut::<yaml_document_t>();
return; return;
} }
index = 0; index = 0;
@ -170,11 +167,9 @@ unsafe fn yaml_emitter_delete_document_and_anchors(emitter: &mut yaml_emitter_t)
} }
STACK_DEL!((*emitter.document).nodes); STACK_DEL!((*emitter.document).nodes);
yaml_free(emitter.anchors as *mut libc::c_void); yaml_free(emitter.anchors as *mut libc::c_void);
let fresh6 = addr_of_mut!(emitter.anchors); emitter.anchors = ptr::null_mut::<yaml_anchors_t>();
*fresh6 = ptr::null_mut::<yaml_anchors_t>();
emitter.last_anchor_id = 0; emitter.last_anchor_id = 0;
let fresh7 = addr_of_mut!(emitter.document); emitter.document = ptr::null_mut::<yaml_document_t>();
*fresh7 = ptr::null_mut::<yaml_document_t>();
} }
unsafe fn yaml_emitter_anchor_node_sub(emitter: &mut yaml_emitter_t, index: libc::c_int) { unsafe fn yaml_emitter_anchor_node_sub(emitter: &mut yaml_emitter_t, index: libc::c_int) {
@ -216,7 +211,7 @@ unsafe fn yaml_emitter_anchor_node(emitter: &mut yaml_emitter_t, index: libc::c_
_ => {} _ => {}
} }
} else if (*emitter.anchors.wrapping_offset((index - 1) as isize)).references == 2 { } else if (*emitter.anchors.wrapping_offset((index - 1) as isize)).references == 2 {
let fresh9 = addr_of_mut!(emitter.last_anchor_id); let fresh9 = &mut emitter.last_anchor_id;
*fresh9 += 1; *fresh9 += 1;
(*emitter.anchors.wrapping_offset((index - 1) as isize)).anchor = *fresh9; (*emitter.anchors.wrapping_offset((index - 1) as isize)).anchor = *fresh9;
} }

View file

@ -33,11 +33,11 @@ unsafe fn FLUSH(emitter: &mut yaml_emitter_t) -> Result<(), ()> {
unsafe fn PUT(emitter: &mut yaml_emitter_t, value: u8) -> Result<(), ()> { unsafe fn PUT(emitter: &mut yaml_emitter_t, value: u8) -> Result<(), ()> {
FLUSH(emitter)?; FLUSH(emitter)?;
let fresh40 = addr_of_mut!(emitter.buffer.pointer); let fresh40 = &mut emitter.buffer.pointer;
let fresh41 = *fresh40; let fresh41 = *fresh40;
*fresh40 = (*fresh40).wrapping_offset(1); *fresh40 = (*fresh40).wrapping_offset(1);
*fresh41 = value; *fresh41 = value;
let fresh42 = addr_of_mut!(emitter.column); let fresh42 = &mut emitter.column;
*fresh42 += 1; *fresh42 += 1;
Ok(()) Ok(())
} }
@ -45,27 +45,27 @@ unsafe fn PUT(emitter: &mut yaml_emitter_t, value: u8) -> Result<(), ()> {
unsafe fn PUT_BREAK(emitter: &mut yaml_emitter_t) -> Result<(), ()> { unsafe fn PUT_BREAK(emitter: &mut yaml_emitter_t) -> Result<(), ()> {
FLUSH(emitter)?; FLUSH(emitter)?;
if emitter.line_break == YAML_CR_BREAK { if emitter.line_break == YAML_CR_BREAK {
let fresh62 = addr_of_mut!(emitter.buffer.pointer); let fresh62 = &mut emitter.buffer.pointer;
let fresh63 = *fresh62; let fresh63 = *fresh62;
*fresh62 = (*fresh62).wrapping_offset(1); *fresh62 = (*fresh62).wrapping_offset(1);
*fresh63 = b'\r'; *fresh63 = b'\r';
} else if emitter.line_break == YAML_LN_BREAK { } else if emitter.line_break == YAML_LN_BREAK {
let fresh64 = addr_of_mut!(emitter.buffer.pointer); let fresh64 = &mut emitter.buffer.pointer;
let fresh65 = *fresh64; let fresh65 = *fresh64;
*fresh64 = (*fresh64).wrapping_offset(1); *fresh64 = (*fresh64).wrapping_offset(1);
*fresh65 = b'\n'; *fresh65 = b'\n';
} else if emitter.line_break == YAML_CRLN_BREAK { } else if emitter.line_break == YAML_CRLN_BREAK {
let fresh66 = addr_of_mut!(emitter.buffer.pointer); let fresh66 = &mut emitter.buffer.pointer;
let fresh67 = *fresh66; let fresh67 = *fresh66;
*fresh66 = (*fresh66).wrapping_offset(1); *fresh66 = (*fresh66).wrapping_offset(1);
*fresh67 = b'\r'; *fresh67 = b'\r';
let fresh68 = addr_of_mut!(emitter.buffer.pointer); let fresh68 = &mut emitter.buffer.pointer;
let fresh69 = *fresh68; let fresh69 = *fresh68;
*fresh68 = (*fresh68).wrapping_offset(1); *fresh68 = (*fresh68).wrapping_offset(1);
*fresh69 = b'\n'; *fresh69 = b'\n';
}; };
emitter.column = 0; emitter.column = 0;
let fresh70 = addr_of_mut!(emitter.line); let fresh70 = &mut emitter.line;
*fresh70 += 1; *fresh70 += 1;
Ok(()) Ok(())
} }
@ -73,7 +73,7 @@ unsafe fn PUT_BREAK(emitter: &mut yaml_emitter_t) -> Result<(), ()> {
unsafe fn WRITE(emitter: &mut yaml_emitter_t, string: &mut yaml_string_t) -> Result<(), ()> { unsafe fn WRITE(emitter: &mut yaml_emitter_t, string: &mut yaml_string_t) -> Result<(), ()> {
FLUSH(emitter)?; FLUSH(emitter)?;
COPY!(emitter.buffer, *string); COPY!(emitter.buffer, *string);
let fresh107 = addr_of_mut!(emitter.column); let fresh107 = &mut emitter.column;
*fresh107 += 1; *fresh107 += 1;
Ok(()) Ok(())
} }
@ -86,7 +86,7 @@ unsafe fn WRITE_BREAK(emitter: &mut yaml_emitter_t, string: &mut yaml_string_t)
} else { } else {
COPY!(emitter.buffer, *string); COPY!(emitter.buffer, *string);
emitter.column = 0; emitter.column = 0;
let fresh300 = addr_of_mut!(emitter.line); let fresh300 = &mut emitter.line;
*fresh300 += 1; *fresh300 += 1;
} }
Ok(()) Ok(())
@ -97,8 +97,7 @@ unsafe fn yaml_emitter_set_emitter_error(
problem: *const libc::c_char, problem: *const libc::c_char,
) -> Result<(), ()> { ) -> Result<(), ()> {
emitter.error = YAML_EMITTER_ERROR; emitter.error = YAML_EMITTER_ERROR;
let fresh0 = addr_of_mut!(emitter.problem); emitter.problem = problem;
*fresh0 = problem;
Err(()) Err(())
} }
@ -513,11 +512,11 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
false, false,
)?; )?;
yaml_emitter_increase_indent(emitter, true, false); yaml_emitter_increase_indent(emitter, true, false);
let fresh12 = addr_of_mut!(emitter.flow_level); let fresh12 = &mut emitter.flow_level;
*fresh12 += 1; *fresh12 += 1;
} }
if (*event).type_ == YAML_SEQUENCE_END_EVENT { if (*event).type_ == YAML_SEQUENCE_END_EVENT {
let fresh13 = addr_of_mut!(emitter.flow_level); let fresh13 = &mut emitter.flow_level;
*fresh13 -= 1; *fresh13 -= 1;
emitter.indent = POP!(emitter.indents); emitter.indent = POP!(emitter.indents);
if emitter.canonical && !first { if emitter.canonical && !first {
@ -570,14 +569,14 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
false, false,
)?; )?;
yaml_emitter_increase_indent(emitter, true, false); yaml_emitter_increase_indent(emitter, true, false);
let fresh18 = addr_of_mut!(emitter.flow_level); let fresh18 = &mut emitter.flow_level;
*fresh18 += 1; *fresh18 += 1;
} }
if (*event).type_ == YAML_MAPPING_END_EVENT { if (*event).type_ == YAML_MAPPING_END_EVENT {
if STACK_EMPTY!(emitter.indents) { if STACK_EMPTY!(emitter.indents) {
return Err(()); return Err(());
} }
let fresh19 = addr_of_mut!(emitter.flow_level); let fresh19 = &mut emitter.flow_level;
*fresh19 -= 1; *fresh19 -= 1;
emitter.indent = POP!(emitter.indents); emitter.indent = POP!(emitter.indents);
if emitter.canonical && !first { if emitter.canonical && !first {
@ -944,8 +943,7 @@ unsafe fn yaml_emitter_select_scalar_style(
} }
} }
if no_tag && !(*event).data.scalar.quoted_implicit && style != YAML_PLAIN_SCALAR_STYLE { if no_tag && !(*event).data.scalar.quoted_implicit && style != YAML_PLAIN_SCALAR_STYLE {
let fresh46 = addr_of_mut!(emitter.tag_data.handle); emitter.tag_data.handle = b"!\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
*fresh46 = b"!\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
emitter.tag_data.handle_length = 1_u64; emitter.tag_data.handle_length = 1_u64;
} }
emitter.scalar_data.style = style; emitter.scalar_data.style = style;
@ -1154,8 +1152,7 @@ unsafe fn yaml_emitter_analyze_anchor(
} }
MOVE!(string); MOVE!(string);
} }
let fresh47 = addr_of_mut!(emitter.anchor_data.anchor); emitter.anchor_data.anchor = string.start;
*fresh47 = string.start;
emitter.anchor_data.anchor_length = string.end.c_offset_from(string.start) as size_t; emitter.anchor_data.anchor_length = string.end.c_offset_from(string.start) as size_t;
emitter.anchor_data.alias = alias; emitter.anchor_data.alias = alias;
Ok(()) Ok(())
@ -1184,11 +1181,9 @@ unsafe fn yaml_emitter_analyze_tag(
prefix_length, prefix_length,
) == 0 ) == 0
{ {
let fresh48 = addr_of_mut!(emitter.tag_data.handle); emitter.tag_data.handle = (*tag_directive).handle;
*fresh48 = (*tag_directive).handle;
emitter.tag_data.handle_length = strlen((*tag_directive).handle as *mut libc::c_char); emitter.tag_data.handle_length = strlen((*tag_directive).handle as *mut libc::c_char);
let fresh49 = addr_of_mut!(emitter.tag_data.suffix); emitter.tag_data.suffix = string.start.wrapping_offset(prefix_length as isize);
*fresh49 = string.start.wrapping_offset(prefix_length as isize);
emitter.tag_data.suffix_length = (string.end.c_offset_from(string.start) emitter.tag_data.suffix_length = (string.end.c_offset_from(string.start)
as libc::c_ulong) as libc::c_ulong)
.wrapping_sub(prefix_length); .wrapping_sub(prefix_length);
@ -1196,8 +1191,7 @@ unsafe fn yaml_emitter_analyze_tag(
} }
tag_directive = tag_directive.wrapping_offset(1); tag_directive = tag_directive.wrapping_offset(1);
} }
let fresh50 = addr_of_mut!(emitter.tag_data.suffix); emitter.tag_data.suffix = string.start;
*fresh50 = string.start;
emitter.tag_data.suffix_length = string.end.c_offset_from(string.start) as size_t; emitter.tag_data.suffix_length = string.end.c_offset_from(string.start) as size_t;
Ok(()) Ok(())
} }
@ -1222,8 +1216,7 @@ unsafe fn yaml_emitter_analyze_scalar(
let mut previous_space = false; let mut previous_space = false;
let mut previous_break = false; let mut previous_break = false;
let mut string = STRING_ASSIGN!(value, length); let mut string = STRING_ASSIGN!(value, length);
let fresh51 = addr_of_mut!(emitter.scalar_data.value); emitter.scalar_data.value = value;
*fresh51 = value;
emitter.scalar_data.length = length; emitter.scalar_data.length = length;
if string.start == string.end { if string.start == string.end {
emitter.scalar_data.multiline = false; emitter.scalar_data.multiline = false;
@ -1374,17 +1367,13 @@ unsafe fn yaml_emitter_analyze_event(
emitter: &mut yaml_emitter_t, emitter: &mut yaml_emitter_t,
event: *mut yaml_event_t, event: *mut yaml_event_t,
) -> Result<(), ()> { ) -> Result<(), ()> {
let fresh52 = addr_of_mut!(emitter.anchor_data.anchor); emitter.anchor_data.anchor = ptr::null_mut::<yaml_char_t>();
*fresh52 = ptr::null_mut::<yaml_char_t>();
emitter.anchor_data.anchor_length = 0_u64; emitter.anchor_data.anchor_length = 0_u64;
let fresh53 = addr_of_mut!(emitter.tag_data.handle); emitter.tag_data.handle = ptr::null_mut::<yaml_char_t>();
*fresh53 = ptr::null_mut::<yaml_char_t>();
emitter.tag_data.handle_length = 0_u64; emitter.tag_data.handle_length = 0_u64;
let fresh54 = addr_of_mut!(emitter.tag_data.suffix); emitter.tag_data.suffix = ptr::null_mut::<yaml_char_t>();
*fresh54 = ptr::null_mut::<yaml_char_t>();
emitter.tag_data.suffix_length = 0_u64; emitter.tag_data.suffix_length = 0_u64;
let fresh55 = addr_of_mut!(emitter.scalar_data.value); emitter.scalar_data.value = ptr::null_mut::<yaml_char_t>();
*fresh55 = ptr::null_mut::<yaml_char_t>();
emitter.scalar_data.length = 0_u64; emitter.scalar_data.length = 0_u64;
match (*event).type_ { match (*event).type_ {
YAML_ALIAS_EVENT => yaml_emitter_analyze_anchor(emitter, (*event).data.alias.anchor, true), YAML_ALIAS_EVENT => yaml_emitter_analyze_anchor(emitter, (*event).data.alias.anchor, true),
@ -1433,15 +1422,15 @@ unsafe fn yaml_emitter_analyze_event(
unsafe fn yaml_emitter_write_bom(emitter: &mut yaml_emitter_t) -> Result<(), ()> { unsafe fn yaml_emitter_write_bom(emitter: &mut yaml_emitter_t) -> Result<(), ()> {
FLUSH(emitter)?; FLUSH(emitter)?;
let fresh56 = addr_of_mut!(emitter.buffer.pointer); let fresh56 = &mut emitter.buffer.pointer;
let fresh57 = *fresh56; let fresh57 = *fresh56;
*fresh56 = (*fresh56).wrapping_offset(1); *fresh56 = (*fresh56).wrapping_offset(1);
*fresh57 = b'\xEF'; *fresh57 = b'\xEF';
let fresh58 = addr_of_mut!(emitter.buffer.pointer); let fresh58 = &mut emitter.buffer.pointer;
let fresh59 = *fresh58; let fresh59 = *fresh58;
*fresh58 = (*fresh58).wrapping_offset(1); *fresh58 = (*fresh58).wrapping_offset(1);
*fresh59 = b'\xBB'; *fresh59 = b'\xBB';
let fresh60 = addr_of_mut!(emitter.buffer.pointer); let fresh60 = &mut emitter.buffer.pointer;
let fresh61 = *fresh60; let fresh61 = *fresh60;
*fresh60 = (*fresh60).wrapping_offset(1); *fresh60 = (*fresh60).wrapping_offset(1);
*fresh61 = b'\xBF'; *fresh61 = b'\xBF';

View file

@ -35,16 +35,11 @@ struct loader_ctx {
/// the parser. /// the parser.
pub unsafe fn yaml_parser_load( pub unsafe fn yaml_parser_load(
parser: &mut yaml_parser_t, parser: &mut yaml_parser_t,
document: *mut yaml_document_t, document: &mut yaml_document_t,
) -> Result<(), ()> { ) -> Result<(), ()> {
let current_block: u64; let current_block: u64;
let mut event = yaml_event_t::default(); let mut event = yaml_event_t::default();
__assert!(!document.is_null()); *document = core::mem::MaybeUninit::zeroed().assume_init();
memset(
document as *mut libc::c_void,
0,
size_of::<yaml_document_t>() as libc::c_ulong,
);
STACK_INIT!((*document).nodes, yaml_node_t); STACK_INIT!((*document).nodes, yaml_node_t);
if !parser.stream_start_produced { if !parser.stream_start_produced {
if let Err(()) = yaml_parser_parse(parser, &mut event) { if let Err(()) = yaml_parser_parse(parser, &mut event) {
@ -65,20 +60,17 @@ pub unsafe fn yaml_parser_load(
return Ok(()); return Ok(());
} }
STACK_INIT!(parser.aliases, yaml_alias_data_t); STACK_INIT!(parser.aliases, yaml_alias_data_t);
let fresh6 = addr_of_mut!(parser.document); parser.document = document;
*fresh6 = document;
if let Ok(()) = yaml_parser_load_document(parser, &mut event) { if let Ok(()) = yaml_parser_load_document(parser, &mut event) {
yaml_parser_delete_aliases(parser); yaml_parser_delete_aliases(parser);
let fresh7 = addr_of_mut!(parser.document); parser.document = ptr::null_mut::<yaml_document_t>();
*fresh7 = ptr::null_mut::<yaml_document_t>();
return Ok(()); return Ok(());
} }
} }
} }
yaml_parser_delete_aliases(parser); yaml_parser_delete_aliases(parser);
yaml_document_delete(document); yaml_document_delete(document);
let fresh8 = addr_of_mut!(parser.document); parser.document = ptr::null_mut::<yaml_document_t>();
*fresh8 = ptr::null_mut::<yaml_document_t>();
Err(()) Err(())
} }
@ -88,8 +80,7 @@ unsafe fn yaml_parser_set_composer_error(
problem_mark: yaml_mark_t, problem_mark: yaml_mark_t,
) -> Result<(), ()> { ) -> Result<(), ()> {
parser.error = YAML_COMPOSER_ERROR; parser.error = YAML_COMPOSER_ERROR;
let fresh9 = addr_of_mut!(parser.problem); parser.problem = problem;
*fresh9 = problem;
parser.problem_mark = problem_mark; parser.problem_mark = problem_mark;
Err(()) Err(())
} }
@ -102,11 +93,9 @@ unsafe fn yaml_parser_set_composer_error_context(
problem_mark: yaml_mark_t, problem_mark: yaml_mark_t,
) -> Result<(), ()> { ) -> Result<(), ()> {
parser.error = YAML_COMPOSER_ERROR; parser.error = YAML_COMPOSER_ERROR;
let fresh10 = addr_of_mut!(parser.context); parser.context = context;
*fresh10 = context;
parser.context_mark = context_mark; parser.context_mark = context_mark;
let fresh11 = addr_of_mut!(parser.problem); parser.problem = problem;
*fresh11 = problem;
parser.problem_mark = problem_mark; parser.problem_mark = problem_mark;
Err(()) Err(())
} }
@ -128,12 +117,9 @@ unsafe fn yaml_parser_load_document(
top: ptr::null_mut::<libc::c_int>(), top: ptr::null_mut::<libc::c_int>(),
}; };
__assert!(event.type_ == YAML_DOCUMENT_START_EVENT); __assert!(event.type_ == YAML_DOCUMENT_START_EVENT);
let fresh16 = addr_of_mut!((*parser.document).version_directive); (*parser.document).version_directive = event.data.document_start.version_directive;
*fresh16 = event.data.document_start.version_directive; (*parser.document).tag_directives.start = event.data.document_start.tag_directives.start;
let fresh17 = addr_of_mut!((*parser.document).tag_directives.start); (*parser.document).tag_directives.end = event.data.document_start.tag_directives.end;
*fresh17 = event.data.document_start.tag_directives.start;
let fresh18 = addr_of_mut!((*parser.document).tag_directives.end);
*fresh18 = event.data.document_start.tag_directives.end;
(*parser.document).start_implicit = event.data.document_start.implicit; (*parser.document).start_implicit = event.data.document_start.implicit;
(*parser.document).start_mark = event.start_mark; (*parser.document).start_mark = event.start_mark;
STACK_INIT!(ctx, libc::c_int); STACK_INIT!(ctx, libc::c_int);

View file

@ -508,7 +508,7 @@ macro_rules! QUEUE_INSERT {
.wrapping_mul(size_of::<yaml_token_t>() as libc::c_ulong), .wrapping_mul(size_of::<yaml_token_t>() as libc::c_ulong),
); );
*$queue.head.wrapping_offset($index as isize) = $value; *$queue.head.wrapping_offset($index as isize) = $value;
let fresh14 = addr_of_mut!($queue.tail); let fresh14 = &mut $queue.tail;
*fresh14 = (*fresh14).wrapping_offset(1); *fresh14 = (*fresh14).wrapping_offset(1);
}}; }};
} }

View file

@ -43,11 +43,9 @@ unsafe fn PEEK_TOKEN(parser: &mut yaml_parser_t) -> *mut yaml_token_t {
unsafe fn SKIP_TOKEN(parser: &mut yaml_parser_t) { unsafe fn SKIP_TOKEN(parser: &mut yaml_parser_t) {
parser.token_available = false; parser.token_available = false;
let fresh3 = addr_of_mut!(parser.tokens_parsed); parser.tokens_parsed = parser.tokens_parsed.wrapping_add(1);
*fresh3 = (*fresh3).wrapping_add(1);
parser.stream_end_produced = (*parser.tokens.head).type_ == YAML_STREAM_END_TOKEN; parser.stream_end_produced = (*parser.tokens.head).type_ == YAML_STREAM_END_TOKEN;
let fresh4 = addr_of_mut!(parser.tokens.head); parser.tokens.head = parser.tokens.head.wrapping_offset(1);
*fresh4 = (*fresh4).wrapping_offset(1);
} }
/// Parse the input stream and produce the next parsing event. /// Parse the input stream and produce the next parsing event.
@ -82,8 +80,7 @@ unsafe fn yaml_parser_set_parser_error(
problem_mark: yaml_mark_t, problem_mark: yaml_mark_t,
) { ) {
parser.error = YAML_PARSER_ERROR; parser.error = YAML_PARSER_ERROR;
let fresh0 = addr_of_mut!(parser.problem); parser.problem = problem;
*fresh0 = problem;
parser.problem_mark = problem_mark; parser.problem_mark = problem_mark;
} }
@ -95,11 +92,9 @@ unsafe fn yaml_parser_set_parser_error_context(
problem_mark: yaml_mark_t, problem_mark: yaml_mark_t,
) { ) {
parser.error = YAML_PARSER_ERROR; parser.error = YAML_PARSER_ERROR;
let fresh1 = addr_of_mut!(parser.context); parser.context = context;
*fresh1 = context;
parser.context_mark = context_mark; parser.context_mark = context_mark;
let fresh2 = addr_of_mut!(parser.problem); parser.problem = problem;
*fresh2 = problem;
parser.problem_mark = problem_mark; parser.problem_mark = problem_mark;
} }
@ -242,12 +237,9 @@ unsafe fn yaml_parser_parse_document_start(
event.type_ = YAML_DOCUMENT_START_EVENT; event.type_ = YAML_DOCUMENT_START_EVENT;
event.start_mark = (*token).start_mark; event.start_mark = (*token).start_mark;
event.end_mark = (*token).start_mark; event.end_mark = (*token).start_mark;
let fresh9 = addr_of_mut!(event.data.document_start.version_directive); event.data.document_start.version_directive = ptr::null_mut();
*fresh9 = ptr::null_mut::<yaml_version_directive_t>(); event.data.document_start.tag_directives.start = ptr::null_mut();
let fresh10 = addr_of_mut!(event.data.document_start.tag_directives.start); event.data.document_start.tag_directives.end = ptr::null_mut();
*fresh10 = ptr::null_mut::<yaml_tag_directive_t>();
let fresh11 = addr_of_mut!(event.data.document_start.tag_directives.end);
*fresh11 = ptr::null_mut::<yaml_tag_directive_t>();
event.data.document_start.implicit = true; event.data.document_start.implicit = true;
Ok(()) Ok(())
} else if (*token).type_ != YAML_STREAM_END_TOKEN { } else if (*token).type_ != YAML_STREAM_END_TOKEN {
@ -275,12 +267,9 @@ unsafe fn yaml_parser_parse_document_start(
event.type_ = YAML_DOCUMENT_START_EVENT; event.type_ = YAML_DOCUMENT_START_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh14 = addr_of_mut!(event.data.document_start.version_directive); event.data.document_start.version_directive = version_directive;
*fresh14 = version_directive; event.data.document_start.tag_directives.start = tag_directives.start;
let fresh15 = addr_of_mut!(event.data.document_start.tag_directives.start); event.data.document_start.tag_directives.end = tag_directives.end;
*fresh15 = tag_directives.start;
let fresh16 = addr_of_mut!(event.data.document_start.tag_directives.end);
*fresh16 = tag_directives.end;
event.data.document_start.implicit = false; event.data.document_start.implicit = false;
SKIP_TOKEN(parser); SKIP_TOKEN(parser);
tag_directives.end = ptr::null_mut::<yaml_tag_directive_t>(); tag_directives.end = ptr::null_mut::<yaml_tag_directive_t>();
@ -389,8 +378,7 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_ALIAS_EVENT; event.type_ = YAML_ALIAS_EVENT;
event.start_mark = (*token).start_mark; event.start_mark = (*token).start_mark;
event.end_mark = (*token).end_mark; event.end_mark = (*token).end_mark;
let fresh26 = addr_of_mut!(event.data.alias.anchor); event.data.alias.anchor = (*token).data.alias.value;
*fresh26 = (*token).data.alias.value;
SKIP_TOKEN(parser); SKIP_TOKEN(parser);
Ok(()) Ok(())
} else { } else {
@ -519,10 +507,8 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_SEQUENCE_START_EVENT; event.type_ = YAML_SEQUENCE_START_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh37 = addr_of_mut!(event.data.sequence_start.anchor); event.data.sequence_start.anchor = anchor;
*fresh37 = anchor; event.data.sequence_start.tag = tag;
let fresh38 = addr_of_mut!(event.data.sequence_start.tag);
*fresh38 = tag;
event.data.sequence_start.implicit = implicit; event.data.sequence_start.implicit = implicit;
event.data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE; event.data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE;
return Ok(()); return Ok(());
@ -546,12 +532,9 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_SCALAR_EVENT; event.type_ = YAML_SCALAR_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh40 = addr_of_mut!(event.data.scalar.anchor); event.data.scalar.anchor = anchor;
*fresh40 = anchor; event.data.scalar.tag = tag;
let fresh41 = addr_of_mut!(event.data.scalar.tag); event.data.scalar.value = (*token).data.scalar.value;
*fresh41 = tag;
let fresh42 = addr_of_mut!(event.data.scalar.value);
*fresh42 = (*token).data.scalar.value;
event.data.scalar.length = (*token).data.scalar.length; event.data.scalar.length = (*token).data.scalar.length;
event.data.scalar.plain_implicit = plain_implicit; event.data.scalar.plain_implicit = plain_implicit;
event.data.scalar.quoted_implicit = quoted_implicit; event.data.scalar.quoted_implicit = quoted_implicit;
@ -565,10 +548,8 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_SEQUENCE_START_EVENT; event.type_ = YAML_SEQUENCE_START_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh45 = addr_of_mut!(event.data.sequence_start.anchor); event.data.sequence_start.anchor = anchor;
*fresh45 = anchor; event.data.sequence_start.tag = tag;
let fresh46 = addr_of_mut!(event.data.sequence_start.tag);
*fresh46 = tag;
event.data.sequence_start.implicit = implicit; event.data.sequence_start.implicit = implicit;
event.data.sequence_start.style = YAML_FLOW_SEQUENCE_STYLE; event.data.sequence_start.style = YAML_FLOW_SEQUENCE_STYLE;
return Ok(()); return Ok(());
@ -579,10 +560,8 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_MAPPING_START_EVENT; event.type_ = YAML_MAPPING_START_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh47 = addr_of_mut!(event.data.mapping_start.anchor); event.data.mapping_start.anchor = anchor;
*fresh47 = anchor; event.data.mapping_start.tag = tag;
let fresh48 = addr_of_mut!(event.data.mapping_start.tag);
*fresh48 = tag;
event.data.mapping_start.implicit = implicit; event.data.mapping_start.implicit = implicit;
event.data.mapping_start.style = YAML_FLOW_MAPPING_STYLE; event.data.mapping_start.style = YAML_FLOW_MAPPING_STYLE;
return Ok(()); return Ok(());
@ -593,10 +572,8 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_SEQUENCE_START_EVENT; event.type_ = YAML_SEQUENCE_START_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh49 = addr_of_mut!(event.data.sequence_start.anchor); event.data.sequence_start.anchor = anchor;
*fresh49 = anchor; event.data.sequence_start.tag = tag;
let fresh50 = addr_of_mut!(event.data.sequence_start.tag);
*fresh50 = tag;
event.data.sequence_start.implicit = implicit; event.data.sequence_start.implicit = implicit;
event.data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE; event.data.sequence_start.style = YAML_BLOCK_SEQUENCE_STYLE;
return Ok(()); return Ok(());
@ -607,10 +584,8 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_MAPPING_START_EVENT; event.type_ = YAML_MAPPING_START_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh51 = addr_of_mut!(event.data.mapping_start.anchor); event.data.mapping_start.anchor = anchor;
*fresh51 = anchor; event.data.mapping_start.tag = tag;
let fresh52 = addr_of_mut!(event.data.mapping_start.tag);
*fresh52 = tag;
event.data.mapping_start.implicit = implicit; event.data.mapping_start.implicit = implicit;
event.data.mapping_start.style = YAML_BLOCK_MAPPING_STYLE; event.data.mapping_start.style = YAML_BLOCK_MAPPING_STYLE;
return Ok(()); return Ok(());
@ -622,12 +597,9 @@ unsafe fn yaml_parser_parse_node(
event.type_ = YAML_SCALAR_EVENT; event.type_ = YAML_SCALAR_EVENT;
event.start_mark = start_mark; event.start_mark = start_mark;
event.end_mark = end_mark; event.end_mark = end_mark;
let fresh54 = addr_of_mut!(event.data.scalar.anchor); event.data.scalar.anchor = anchor;
*fresh54 = anchor; event.data.scalar.tag = tag;
let fresh55 = addr_of_mut!(event.data.scalar.tag); event.data.scalar.value = value;
*fresh55 = tag;
let fresh56 = addr_of_mut!(event.data.scalar.value);
*fresh56 = value;
event.data.scalar.length = 0_u64; event.data.scalar.length = 0_u64;
event.data.scalar.plain_implicit = implicit; event.data.scalar.plain_implicit = implicit;
event.data.scalar.quoted_implicit = false; event.data.scalar.quoted_implicit = false;
@ -871,10 +843,8 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
event.type_ = YAML_MAPPING_START_EVENT; event.type_ = YAML_MAPPING_START_EVENT;
event.start_mark = (*token).start_mark; event.start_mark = (*token).start_mark;
event.end_mark = (*token).end_mark; event.end_mark = (*token).end_mark;
let fresh99 = addr_of_mut!(event.data.mapping_start.anchor); event.data.mapping_start.anchor = ptr::null_mut();
*fresh99 = ptr::null_mut::<yaml_char_t>(); event.data.mapping_start.tag = ptr::null_mut();
let fresh100 = addr_of_mut!(event.data.mapping_start.tag);
*fresh100 = ptr::null_mut::<yaml_char_t>();
event.data.mapping_start.implicit = true; event.data.mapping_start.implicit = true;
event.data.mapping_start.style = YAML_FLOW_MAPPING_STYLE; event.data.mapping_start.style = YAML_FLOW_MAPPING_STYLE;
SKIP_TOKEN(parser); SKIP_TOKEN(parser);
@ -1069,12 +1039,9 @@ unsafe fn yaml_parser_process_empty_scalar(
event.type_ = YAML_SCALAR_EVENT; event.type_ = YAML_SCALAR_EVENT;
event.start_mark = mark; event.start_mark = mark;
event.end_mark = mark; event.end_mark = mark;
let fresh138 = addr_of_mut!(event.data.scalar.anchor); event.data.scalar.anchor = ptr::null_mut::<yaml_char_t>();
*fresh138 = ptr::null_mut::<yaml_char_t>(); event.data.scalar.tag = ptr::null_mut::<yaml_char_t>();
let fresh139 = addr_of_mut!(event.data.scalar.tag); event.data.scalar.value = value;
*fresh139 = ptr::null_mut::<yaml_char_t>();
let fresh140 = addr_of_mut!(event.data.scalar.value);
*fresh140 = value;
event.data.scalar.length = 0_u64; event.data.scalar.length = 0_u64;
event.data.scalar.plain_implicit = true; event.data.scalar.plain_implicit = true;
event.data.scalar.quoted_implicit = false; event.data.scalar.quoted_implicit = false;

View file

@ -14,8 +14,7 @@ unsafe fn yaml_parser_set_reader_error(
value: libc::c_int, value: libc::c_int,
) -> Result<(), ()> { ) -> Result<(), ()> {
parser.error = YAML_READER_ERROR; parser.error = YAML_READER_ERROR;
let fresh0 = addr_of_mut!(parser.problem); parser.problem = problem;
*fresh0 = problem;
parser.problem_offset = offset; parser.problem_offset = offset;
parser.problem_value = value; parser.problem_value = value;
Err(()) Err(())
@ -47,9 +46,9 @@ unsafe fn yaml_parser_determine_encoding(parser: &mut yaml_parser_t) -> Result<(
) == 0 ) == 0
{ {
parser.encoding = YAML_UTF16LE_ENCODING; parser.encoding = YAML_UTF16LE_ENCODING;
let fresh1 = addr_of_mut!(parser.raw_buffer.pointer); let fresh1 = &mut parser.raw_buffer.pointer;
*fresh1 = (*fresh1).wrapping_offset(2_isize); *fresh1 = (*fresh1).wrapping_offset(2_isize);
let fresh2 = addr_of_mut!(parser.offset); let fresh2 = &mut parser.offset;
*fresh2 = (*fresh2 as libc::c_ulong).force_add(2_u64) as size_t; *fresh2 = (*fresh2 as libc::c_ulong).force_add(2_u64) as size_t;
} else if parser } else if parser
.raw_buffer .raw_buffer
@ -63,9 +62,9 @@ unsafe fn yaml_parser_determine_encoding(parser: &mut yaml_parser_t) -> Result<(
) == 0 ) == 0
{ {
parser.encoding = YAML_UTF16BE_ENCODING; parser.encoding = YAML_UTF16BE_ENCODING;
let fresh3 = addr_of_mut!(parser.raw_buffer.pointer); let fresh3 = &mut parser.raw_buffer.pointer;
*fresh3 = (*fresh3).wrapping_offset(2_isize); *fresh3 = (*fresh3).wrapping_offset(2_isize);
let fresh4 = addr_of_mut!(parser.offset); let fresh4 = &mut parser.offset;
*fresh4 = (*fresh4 as libc::c_ulong).force_add(2_u64) as size_t; *fresh4 = (*fresh4 as libc::c_ulong).force_add(2_u64) as size_t;
} else if parser } else if parser
.raw_buffer .raw_buffer
@ -79,9 +78,9 @@ unsafe fn yaml_parser_determine_encoding(parser: &mut yaml_parser_t) -> Result<(
) == 0 ) == 0
{ {
parser.encoding = YAML_UTF8_ENCODING; parser.encoding = YAML_UTF8_ENCODING;
let fresh5 = addr_of_mut!(parser.raw_buffer.pointer); let fresh5 = &mut parser.raw_buffer.pointer;
*fresh5 = (*fresh5).wrapping_offset(3_isize); *fresh5 = (*fresh5).wrapping_offset(3_isize);
let fresh6 = addr_of_mut!(parser.offset); let fresh6 = &mut parser.offset;
*fresh6 = (*fresh6 as libc::c_ulong).force_add(3_u64) as size_t; *fresh6 = (*fresh6 as libc::c_ulong).force_add(3_u64) as size_t;
} else { } else {
parser.encoding = YAML_UTF8_ENCODING; parser.encoding = YAML_UTF8_ENCODING;
@ -112,14 +111,13 @@ unsafe fn yaml_parser_update_raw_buffer(parser: &mut yaml_parser_t) -> Result<()
as libc::c_ulong, as libc::c_ulong,
); );
} }
let fresh7 = addr_of_mut!(parser.raw_buffer.last); parser.raw_buffer.last = parser.raw_buffer.last.wrapping_offset(
*fresh7 = (*fresh7).wrapping_offset(
-(parser -(parser
.raw_buffer .raw_buffer
.pointer .pointer
.c_offset_from(parser.raw_buffer.start) as libc::c_long as isize), .c_offset_from(parser.raw_buffer.start) as libc::c_long as isize),
); );
let fresh8 = addr_of_mut!(parser.raw_buffer.pointer); let fresh8 = &mut parser.raw_buffer.pointer;
*fresh8 = parser.raw_buffer.start; *fresh8 = parser.raw_buffer.start;
if parser.read_handler.expect("non-null function pointer")( if parser.read_handler.expect("non-null function pointer")(
parser.read_handler_data, parser.read_handler_data,
@ -135,7 +133,7 @@ unsafe fn yaml_parser_update_raw_buffer(parser: &mut yaml_parser_t) -> Result<()
-1, -1,
); );
} }
let fresh9 = addr_of_mut!(parser.raw_buffer.last); let fresh9 = &mut parser.raw_buffer.last;
*fresh9 = (*fresh9).wrapping_offset(size_read as isize); *fresh9 = (*fresh9).wrapping_offset(size_read as isize);
if size_read == 0 { if size_read == 0 {
parser.eof = true; parser.eof = true;
@ -165,15 +163,11 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
parser.buffer.pointer as *const libc::c_void, parser.buffer.pointer as *const libc::c_void,
size, size,
); );
let fresh10 = addr_of_mut!(parser.buffer.pointer); parser.buffer.pointer = parser.buffer.start;
*fresh10 = parser.buffer.start; parser.buffer.last = parser.buffer.start.wrapping_offset(size as isize);
let fresh11 = addr_of_mut!(parser.buffer.last);
*fresh11 = parser.buffer.start.wrapping_offset(size as isize);
} else if parser.buffer.pointer == parser.buffer.last { } else if parser.buffer.pointer == parser.buffer.last {
let fresh12 = addr_of_mut!(parser.buffer.pointer); parser.buffer.pointer = parser.buffer.start;
*fresh12 = parser.buffer.start; parser.buffer.last = parser.buffer.start;
let fresh13 = addr_of_mut!(parser.buffer.last);
*fresh13 = parser.buffer.start;
} }
while parser.unread < length { while parser.unread < length {
if !first || parser.raw_buffer.pointer == parser.raw_buffer.last { if !first || parser.raw_buffer.pointer == parser.raw_buffer.last {
@ -379,64 +373,64 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
value as libc::c_int, value as libc::c_int,
); );
} }
let fresh14 = addr_of_mut!(parser.raw_buffer.pointer); let fresh14 = &mut parser.raw_buffer.pointer;
*fresh14 = (*fresh14).wrapping_offset(width as isize); *fresh14 = (*fresh14).wrapping_offset(width as isize);
let fresh15 = addr_of_mut!(parser.offset); let fresh15 = &mut parser.offset;
*fresh15 = (*fresh15 as libc::c_ulong).force_add(width as libc::c_ulong) as size_t; *fresh15 = (*fresh15 as libc::c_ulong).force_add(width as libc::c_ulong) as size_t;
if value <= 0x7F { if value <= 0x7F {
let fresh16 = addr_of_mut!(parser.buffer.last); let fresh16 = &mut parser.buffer.last;
let fresh17 = *fresh16; let fresh17 = *fresh16;
*fresh16 = (*fresh16).wrapping_offset(1); *fresh16 = (*fresh16).wrapping_offset(1);
*fresh17 = value as yaml_char_t; *fresh17 = value as yaml_char_t;
} else if value <= 0x7FF { } else if value <= 0x7FF {
let fresh18 = addr_of_mut!(parser.buffer.last); let fresh18 = &mut parser.buffer.last;
let fresh19 = *fresh18; let fresh19 = *fresh18;
*fresh18 = (*fresh18).wrapping_offset(1); *fresh18 = (*fresh18).wrapping_offset(1);
*fresh19 = 0xC0_u32.force_add(value >> 6) as yaml_char_t; *fresh19 = 0xC0_u32.force_add(value >> 6) as yaml_char_t;
let fresh20 = addr_of_mut!(parser.buffer.last); let fresh20 = &mut parser.buffer.last;
let fresh21 = *fresh20; let fresh21 = *fresh20;
*fresh20 = (*fresh20).wrapping_offset(1); *fresh20 = (*fresh20).wrapping_offset(1);
*fresh21 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t; *fresh21 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t;
} else if value <= 0xFFFF { } else if value <= 0xFFFF {
let fresh22 = addr_of_mut!(parser.buffer.last); let fresh22 = &mut parser.buffer.last;
let fresh23 = *fresh22; let fresh23 = *fresh22;
*fresh22 = (*fresh22).wrapping_offset(1); *fresh22 = (*fresh22).wrapping_offset(1);
*fresh23 = 0xE0_u32.force_add(value >> 12) as yaml_char_t; *fresh23 = 0xE0_u32.force_add(value >> 12) as yaml_char_t;
let fresh24 = addr_of_mut!(parser.buffer.last); let fresh24 = &mut parser.buffer.last;
let fresh25 = *fresh24; let fresh25 = *fresh24;
*fresh24 = (*fresh24).wrapping_offset(1); *fresh24 = (*fresh24).wrapping_offset(1);
*fresh25 = 0x80_u32.force_add(value >> 6 & 0x3F) as yaml_char_t; *fresh25 = 0x80_u32.force_add(value >> 6 & 0x3F) as yaml_char_t;
let fresh26 = addr_of_mut!(parser.buffer.last); let fresh26 = &mut parser.buffer.last;
let fresh27 = *fresh26; let fresh27 = *fresh26;
*fresh26 = (*fresh26).wrapping_offset(1); *fresh26 = (*fresh26).wrapping_offset(1);
*fresh27 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t; *fresh27 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t;
} else { } else {
let fresh28 = addr_of_mut!(parser.buffer.last); let fresh28 = &mut parser.buffer.last;
let fresh29 = *fresh28; let fresh29 = *fresh28;
*fresh28 = (*fresh28).wrapping_offset(1); *fresh28 = (*fresh28).wrapping_offset(1);
*fresh29 = 0xF0_u32.force_add(value >> 18) as yaml_char_t; *fresh29 = 0xF0_u32.force_add(value >> 18) as yaml_char_t;
let fresh30 = addr_of_mut!(parser.buffer.last); let fresh30 = &mut parser.buffer.last;
let fresh31 = *fresh30; let fresh31 = *fresh30;
*fresh30 = (*fresh30).wrapping_offset(1); *fresh30 = (*fresh30).wrapping_offset(1);
*fresh31 = 0x80_u32.force_add(value >> 12 & 0x3F) as yaml_char_t; *fresh31 = 0x80_u32.force_add(value >> 12 & 0x3F) as yaml_char_t;
let fresh32 = addr_of_mut!(parser.buffer.last); let fresh32 = &mut parser.buffer.last;
let fresh33 = *fresh32; let fresh33 = *fresh32;
*fresh32 = (*fresh32).wrapping_offset(1); *fresh32 = (*fresh32).wrapping_offset(1);
*fresh33 = 0x80_u32.force_add(value >> 6 & 0x3F) as yaml_char_t; *fresh33 = 0x80_u32.force_add(value >> 6 & 0x3F) as yaml_char_t;
let fresh34 = addr_of_mut!(parser.buffer.last); let fresh34 = &mut parser.buffer.last;
let fresh35 = *fresh34; let fresh35 = *fresh34;
*fresh34 = (*fresh34).wrapping_offset(1); *fresh34 = (*fresh34).wrapping_offset(1);
*fresh35 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t; *fresh35 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t;
} }
let fresh36 = addr_of_mut!(parser.unread); let fresh36 = &mut parser.unread;
*fresh36 = (*fresh36).force_add(1); *fresh36 = (*fresh36).force_add(1);
} }
if parser.eof { if parser.eof {
let fresh37 = addr_of_mut!(parser.buffer.last); let fresh37 = &mut parser.buffer.last;
let fresh38 = *fresh37; let fresh38 = *fresh37;
*fresh37 = (*fresh37).wrapping_offset(1); *fresh37 = (*fresh37).wrapping_offset(1);
*fresh38 = b'\0'; *fresh38 = b'\0';
let fresh39 = addr_of_mut!(parser.unread); let fresh39 = &mut parser.unread;
*fresh39 = (*fresh39).force_add(1); *fresh39 = (*fresh39).force_add(1);
return Ok(()); return Ok(());
} }

View file

@ -137,7 +137,7 @@ pub unsafe fn yaml_parser_scan(
} }
*token = DEQUEUE!(parser.tokens); *token = DEQUEUE!(parser.tokens);
parser.token_available = false; parser.token_available = false;
let fresh2 = addr_of_mut!(parser.tokens_parsed); let fresh2 = &mut parser.tokens_parsed;
*fresh2 = (*fresh2).force_add(1); *fresh2 = (*fresh2).force_add(1);
if (*token).type_ == YAML_STREAM_END_TOKEN { if (*token).type_ == YAML_STREAM_END_TOKEN {
parser.stream_end_produced = true; parser.stream_end_produced = true;
@ -152,11 +152,9 @@ unsafe fn yaml_parser_set_scanner_error(
problem: *const libc::c_char, problem: *const libc::c_char,
) { ) {
parser.error = YAML_SCANNER_ERROR; parser.error = YAML_SCANNER_ERROR;
let fresh3 = addr_of_mut!(parser.context); parser.context = context;
*fresh3 = context;
parser.context_mark = context_mark; parser.context_mark = context_mark;
let fresh4 = addr_of_mut!(parser.problem); parser.problem = problem;
*fresh4 = problem;
parser.problem_mark = parser.mark; parser.problem_mark = parser.mark;
} }
@ -390,14 +388,14 @@ unsafe fn yaml_parser_increase_flow_level(parser: &mut yaml_parser_t) -> Result<
parser.error = YAML_MEMORY_ERROR; parser.error = YAML_MEMORY_ERROR;
return Err(()); return Err(());
} }
let fresh7 = addr_of_mut!(parser.flow_level); let fresh7 = &mut parser.flow_level;
*fresh7 += 1; *fresh7 += 1;
Ok(()) Ok(())
} }
unsafe fn yaml_parser_decrease_flow_level(parser: &mut yaml_parser_t) { unsafe fn yaml_parser_decrease_flow_level(parser: &mut yaml_parser_t) {
if parser.flow_level != 0 { if parser.flow_level != 0 {
let fresh8 = addr_of_mut!(parser.flow_level); let fresh8 = &mut parser.flow_level;
*fresh8 -= 1; *fresh8 -= 1;
let _ = POP!(parser.simple_keys); let _ = POP!(parser.simple_keys);
} }
@ -485,7 +483,7 @@ unsafe fn yaml_parser_fetch_stream_end(parser: &mut yaml_parser_t) -> Result<(),
let token = token.as_mut_ptr(); let token = token.as_mut_ptr();
if parser.mark.column != 0_u64 { if parser.mark.column != 0_u64 {
parser.mark.column = 0_u64; parser.mark.column = 0_u64;
let fresh22 = addr_of_mut!(parser.mark.line); let fresh22 = &mut parser.mark.line;
*fresh22 = (*fresh22).force_add(1); *fresh22 = (*fresh22).force_add(1);
} }
yaml_parser_unroll_indent(parser, -1_i64); yaml_parser_unroll_indent(parser, -1_i64);
@ -929,10 +927,8 @@ unsafe fn yaml_parser_scan_directive(
(*token).type_ = YAML_TAG_DIRECTIVE_TOKEN; (*token).type_ = YAML_TAG_DIRECTIVE_TOKEN;
(*token).start_mark = start_mark; (*token).start_mark = start_mark;
(*token).end_mark = end_mark; (*token).end_mark = end_mark;
let fresh112 = addr_of_mut!((*token).data.tag_directive.handle); (*token).data.tag_directive.handle = handle;
*fresh112 = handle; (*token).data.tag_directive.prefix = prefix;
let fresh113 = addr_of_mut!((*token).data.tag_directive.prefix);
*fresh113 = prefix;
current_block = 17407779659766490442; current_block = 17407779659766490442;
} }
} else { } else {
@ -1285,15 +1281,13 @@ unsafe fn yaml_parser_scan_anchor(
(*token).type_ = YAML_ANCHOR_TOKEN; (*token).type_ = YAML_ANCHOR_TOKEN;
(*token).start_mark = start_mark; (*token).start_mark = start_mark;
(*token).end_mark = end_mark; (*token).end_mark = end_mark;
let fresh220 = addr_of_mut!((*token).data.anchor.value); (*token).data.anchor.value = string.start;
*fresh220 = string.start;
} else { } else {
*token = yaml_token_t::default(); *token = yaml_token_t::default();
(*token).type_ = YAML_ALIAS_TOKEN; (*token).type_ = YAML_ALIAS_TOKEN;
(*token).start_mark = start_mark; (*token).start_mark = start_mark;
(*token).end_mark = end_mark; (*token).end_mark = end_mark;
let fresh221 = addr_of_mut!((*token).data.alias.value); (*token).data.alias.value = string.start;
*fresh221 = string.start;
} }
return Ok(()); return Ok(());
} }
@ -1412,10 +1406,8 @@ unsafe fn yaml_parser_scan_tag(
(*token).type_ = YAML_TAG_TOKEN; (*token).type_ = YAML_TAG_TOKEN;
(*token).start_mark = start_mark; (*token).start_mark = start_mark;
(*token).end_mark = end_mark; (*token).end_mark = end_mark;
let fresh234 = addr_of_mut!((*token).data.tag.handle); (*token).data.tag.handle = handle;
*fresh234 = handle; (*token).data.tag.suffix = suffix;
let fresh235 = addr_of_mut!((*token).data.tag.suffix);
*fresh235 = suffix;
return Ok(()); return Ok(());
} }
} }
@ -1674,7 +1666,7 @@ unsafe fn yaml_parser_scan_uri_escapes(
); );
return Err(()); return Err(());
} }
let fresh368 = addr_of_mut!((*string).pointer); let fresh368 = &mut (*string).pointer;
let fresh369 = *fresh368; let fresh369 = *fresh368;
*fresh368 = (*fresh368).wrapping_offset(1); *fresh368 = (*fresh368).wrapping_offset(1);
*fresh369 = octet; *fresh369 = octet;
@ -2358,8 +2350,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
(*token).type_ = YAML_SCALAR_TOKEN; (*token).type_ = YAML_SCALAR_TOKEN;
(*token).start_mark = start_mark; (*token).start_mark = start_mark;
(*token).end_mark = end_mark; (*token).end_mark = end_mark;
let fresh716 = addr_of_mut!((*token).data.scalar.value); (*token).data.scalar.value = string.start;
*fresh716 = string.start;
(*token).data.scalar.length = string.pointer.c_offset_from(string.start) as size_t; (*token).data.scalar.length = string.pointer.c_offset_from(string.start) as size_t;
(*token).data.scalar.style = if single { (*token).data.scalar.style = if single {
YAML_SINGLE_QUOTED_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE
@ -2535,8 +2526,7 @@ unsafe fn yaml_parser_scan_plain_scalar(
(*token).type_ = YAML_SCALAR_TOKEN; (*token).type_ = YAML_SCALAR_TOKEN;
(*token).start_mark = start_mark; (*token).start_mark = start_mark;
(*token).end_mark = end_mark; (*token).end_mark = end_mark;
let fresh842 = addr_of_mut!((*token).data.scalar.value); (*token).data.scalar.value = string.start;
*fresh842 = string.start;
(*token).data.scalar.length = string.pointer.c_offset_from(string.start) as size_t; (*token).data.scalar.length = string.pointer.c_offset_from(string.start) as size_t;
(*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE; (*token).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
if leading_blanks { if leading_blanks {

View file

@ -11,8 +11,7 @@ unsafe fn yaml_emitter_set_writer_error(
problem: *const libc::c_char, problem: *const libc::c_char,
) -> Result<(), ()> { ) -> Result<(), ()> {
emitter.error = YAML_WRITER_ERROR; emitter.error = YAML_WRITER_ERROR;
let fresh0 = addr_of_mut!(emitter.problem); emitter.problem = problem;
*fresh0 = problem;
Err(()) Err(())
} }
@ -20,10 +19,8 @@ unsafe fn yaml_emitter_set_writer_error(
pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()> { pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()> {
__assert!((emitter.write_handler).is_some()); __assert!((emitter.write_handler).is_some());
__assert!(emitter.encoding != YAML_ANY_ENCODING); __assert!(emitter.encoding != YAML_ANY_ENCODING);
let fresh1 = addr_of_mut!(emitter.buffer.last); emitter.buffer.last = emitter.buffer.pointer;
*fresh1 = emitter.buffer.pointer; emitter.buffer.pointer = emitter.buffer.start;
let fresh2 = addr_of_mut!(emitter.buffer.pointer);
*fresh2 = emitter.buffer.start;
if emitter.buffer.start == emitter.buffer.last { if emitter.buffer.start == emitter.buffer.last {
return Ok(()); return Ok(());
} }
@ -34,10 +31,8 @@ pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()>
emitter.buffer.last.c_offset_from(emitter.buffer.start) as size_t, emitter.buffer.last.c_offset_from(emitter.buffer.start) as size_t,
) != 0 ) != 0
{ {
let fresh3 = addr_of_mut!(emitter.buffer.last); emitter.buffer.last = emitter.buffer.start;
*fresh3 = emitter.buffer.start; emitter.buffer.pointer = emitter.buffer.start;
let fresh4 = addr_of_mut!(emitter.buffer.pointer);
*fresh4 = emitter.buffer.start;
return Ok(()); return Ok(());
} else { } else {
return yaml_emitter_set_writer_error( return yaml_emitter_set_writer_error(
@ -89,13 +84,13 @@ pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()>
value = (value << 6).force_add((octet & 0x3F) as libc::c_uint); value = (value << 6).force_add((octet & 0x3F) as libc::c_uint);
k = k.force_add(1); k = k.force_add(1);
} }
let fresh5 = addr_of_mut!(emitter.buffer.pointer); let fresh5 = &mut emitter.buffer.pointer;
*fresh5 = (*fresh5).wrapping_offset(width as isize); *fresh5 = (*fresh5).wrapping_offset(width as isize);
if value < 0x10000 { if value < 0x10000 {
*emitter.raw_buffer.last.wrapping_offset(high as isize) = (value >> 8) as libc::c_uchar; *emitter.raw_buffer.last.wrapping_offset(high as isize) = (value >> 8) as libc::c_uchar;
*emitter.raw_buffer.last.wrapping_offset(low as isize) = *emitter.raw_buffer.last.wrapping_offset(low as isize) =
(value & 0xFF) as libc::c_uchar; (value & 0xFF) as libc::c_uchar;
let fresh6 = addr_of_mut!(emitter.raw_buffer.last); let fresh6 = &mut emitter.raw_buffer.last;
*fresh6 = (*fresh6).wrapping_offset(2_isize); *fresh6 = (*fresh6).wrapping_offset(2_isize);
} else { } else {
value = value.wrapping_sub(0x10000); value = value.wrapping_sub(0x10000);
@ -112,7 +107,7 @@ pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()>
.raw_buffer .raw_buffer
.last .last
.wrapping_offset((low + 2) as isize) = (value & 0xFF) as libc::c_uchar; .wrapping_offset((low + 2) as isize) = (value & 0xFF) as libc::c_uchar;
let fresh7 = addr_of_mut!(emitter.raw_buffer.last); let fresh7 = &mut emitter.raw_buffer.last;
*fresh7 = (*fresh7).wrapping_offset(4_isize); *fresh7 = (*fresh7).wrapping_offset(4_isize);
} }
} }
@ -125,14 +120,10 @@ pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()>
.c_offset_from(emitter.raw_buffer.start) as size_t, .c_offset_from(emitter.raw_buffer.start) as size_t,
) != 0 ) != 0
{ {
let fresh8 = addr_of_mut!(emitter.buffer.last); emitter.buffer.last = emitter.buffer.start;
*fresh8 = emitter.buffer.start; emitter.buffer.pointer = emitter.buffer.start;
let fresh9 = addr_of_mut!(emitter.buffer.pointer); emitter.raw_buffer.last = emitter.raw_buffer.start;
*fresh9 = emitter.buffer.start; emitter.raw_buffer.pointer = emitter.raw_buffer.start;
let fresh10 = addr_of_mut!(emitter.raw_buffer.last);
*fresh10 = emitter.raw_buffer.start;
let fresh11 = addr_of_mut!(emitter.raw_buffer.pointer);
*fresh11 = emitter.raw_buffer.start;
Ok(()) Ok(())
} else { } else {
yaml_emitter_set_writer_error( yaml_emitter_set_writer_error(

View file

@ -1140,6 +1140,7 @@ pub struct yaml_emitter_t {
/// The last assigned anchor id. /// The last assigned anchor id.
pub(crate) last_anchor_id: libc::c_int, pub(crate) last_anchor_id: libc::c_int,
/// The currently emitted document. /// The currently emitted document.
// NOTE: This is owned by the emitter.
pub(crate) document: *mut yaml_document_t, pub(crate) document: *mut yaml_document_t,
} }