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,
size,
);
let fresh80 = addr_of_mut!(parser.input.string.current);
*fresh80 = (*fresh80).wrapping_offset(size as isize);
parser.input.string.current = parser.input.string.current.wrapping_offset(size as isize);
*size_read = size;
1
}
@ -246,19 +245,15 @@ pub unsafe fn yaml_parser_set_input_string(
) {
__assert!((parser.read_handler).is_none());
__assert!(!input.is_null());
let fresh81 = addr_of_mut!(parser.read_handler);
*fresh81 = Some(
parser.read_handler = Some(
yaml_string_read_handler
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);
*fresh82 = parser as *mut _ as *mut libc::c_void;
let fresh83 = addr_of_mut!(parser.input.string.start);
*fresh83 = input;
let fresh84 = addr_of_mut!(parser.input.string.current);
*fresh84 = input;
let fresh85 = addr_of_mut!(parser.input.string.end);
*fresh85 = input.wrapping_offset(size as isize);
let parser_ptr = parser as *mut _ as *mut libc::c_void;
parser.read_handler_data = parser_ptr;
*(&mut parser.input.string.start) = input;
*(&mut parser.input.string.current) = input;
*(&mut parser.input.string.end) = input.wrapping_offset(size as isize);
}
/// Set a generic input handler.
@ -268,10 +263,8 @@ pub unsafe fn yaml_parser_set_input(
data: *mut libc::c_void,
) {
__assert!((parser.read_handler).is_none());
let fresh89 = addr_of_mut!(parser.read_handler);
*fresh89 = Some(handler);
let fresh90 = addr_of_mut!(parser.read_handler_data);
*fresh90 = data;
parser.read_handler = Some(handler);
parser.read_handler_data = data;
}
/// Set the source encoding.
@ -358,7 +351,7 @@ unsafe fn yaml_string_write_handler(
buffer as *const libc::c_void,
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;
1
}
@ -377,18 +370,14 @@ pub unsafe fn yaml_emitter_set_output_string(
) {
__assert!((emitter.write_handler).is_none());
__assert!(!output.is_null());
let fresh154 = addr_of_mut!(emitter.write_handler);
*fresh154 = Some(
emitter.write_handler = Some(
yaml_string_write_handler
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);
*fresh155 = emitter as *mut _ as *mut libc::c_void;
let fresh156 = addr_of_mut!(emitter.output.string.buffer);
*fresh156 = output;
emitter.write_handler_data = emitter as *mut _ as *mut libc::c_void;
emitter.output.string.buffer = output;
emitter.output.string.size = size;
let fresh157 = addr_of_mut!(emitter.output.string.size_written);
*fresh157 = size_written;
emitter.output.string.size_written = size_written;
*size_written = 0_u64;
}
@ -399,10 +388,8 @@ pub unsafe fn yaml_emitter_set_output(
data: *mut libc::c_void,
) {
__assert!(emitter.write_handler.is_none());
let fresh161 = addr_of_mut!(emitter.write_handler);
*fresh161 = Some(handler);
let fresh162 = addr_of_mut!(emitter.write_handler_data);
*fresh162 = data;
emitter.write_handler = Some(handler);
emitter.write_handler_data = data;
}
/// Set the output encoding.
@ -643,12 +630,9 @@ pub unsafe fn yaml_document_start_event_initialize(
event.type_ = YAML_DOCUMENT_START_EVENT;
event.start_mark = mark;
event.end_mark = mark;
let fresh164 = addr_of_mut!(event.data.document_start.version_directive);
*fresh164 = version_directive_copy;
let fresh165 = addr_of_mut!(event.data.document_start.tag_directives.start);
*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.version_directive = version_directive_copy;
event.data.document_start.tag_directives.start = tag_directives_copy.start;
event.data.document_start.tag_directives.end = tag_directives_copy.top;
event.data.document_start.implicit = implicit;
return Ok(());
}
@ -705,8 +689,7 @@ pub unsafe fn yaml_alias_event_initialize(
event.type_ = YAML_ALIAS_EVENT;
event.start_mark = mark;
event.end_mark = mark;
let fresh167 = addr_of_mut!(event.data.alias.anchor);
*fresh167 = anchor_copy;
event.data.alias.anchor = anchor_copy;
Ok(())
}
@ -782,12 +765,9 @@ pub unsafe fn yaml_scalar_event_initialize(
event.type_ = YAML_SCALAR_EVENT;
event.start_mark = mark;
event.end_mark = mark;
let fresh168 = addr_of_mut!(event.data.scalar.anchor);
*fresh168 = anchor_copy;
let fresh169 = addr_of_mut!(event.data.scalar.tag);
*fresh169 = tag_copy;
let fresh170 = addr_of_mut!(event.data.scalar.value);
*fresh170 = value_copy;
event.data.scalar.anchor = anchor_copy;
event.data.scalar.tag = tag_copy;
event.data.scalar.value = value_copy;
event.data.scalar.length = length as size_t;
event.data.scalar.plain_implicit = plain_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.start_mark = mark;
event.end_mark = mark;
let fresh171 = addr_of_mut!(event.data.sequence_start.anchor);
*fresh171 = anchor_copy;
let fresh172 = addr_of_mut!(event.data.sequence_start.tag);
*fresh172 = tag_copy;
event.data.sequence_start.anchor = anchor_copy;
event.data.sequence_start.tag = tag_copy;
event.data.sequence_start.implicit = implicit;
event.data.sequence_start.style = style;
return Ok(());
@ -941,10 +919,8 @@ pub unsafe fn yaml_mapping_start_event_initialize(
event.type_ = YAML_MAPPING_START_EVENT;
event.start_mark = mark;
event.end_mark = mark;
let fresh173 = addr_of_mut!(event.data.mapping_start.anchor);
*fresh173 = anchor_copy;
let fresh174 = addr_of_mut!(event.data.mapping_start.tag);
*fresh174 = tag_copy;
event.data.mapping_start.anchor = anchor_copy;
event.data.mapping_start.tag = tag_copy;
event.data.mapping_start.implicit = implicit;
event.data.mapping_start.style = style;
return Ok(());
@ -1006,7 +982,7 @@ pub unsafe fn yaml_event_delete(event: &mut yaml_event_t) {
/// Create a YAML document.
pub unsafe fn yaml_document_initialize(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
version_directive: *mut yaml_version_directive_t,
tag_directives_start: *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,
column: 0_u64,
};
__assert!(!document.is_null());
__assert!(
!tag_directives_start.is_null() && !tag_directives_end.is_null()
|| tag_directives_start == tag_directives_end
@ -1101,27 +1076,17 @@ pub unsafe fn yaml_document_initialize(
current_block = 14818589718467733107;
}
if current_block != 8142820162064489797 {
memset(
document as *mut libc::c_void,
0,
size_of::<yaml_document_t>() as libc::c_ulong,
);
let fresh176 = addr_of_mut!((*document).nodes.start);
*fresh176 = nodes.start;
let fresh177 = addr_of_mut!((*document).nodes.end);
*fresh177 = nodes.end;
let fresh178 = addr_of_mut!((*document).nodes.top);
*fresh178 = nodes.start;
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;
*document = core::mem::MaybeUninit::zeroed().assume_init();
document.nodes.start = nodes.start;
document.nodes.end = nodes.end;
document.nodes.top = nodes.start;
document.version_directive = version_directive_copy;
document.tag_directives.start = tag_directives_copy.start;
document.tag_directives.end = tag_directives_copy.top;
document.start_implicit = start_implicit;
document.end_implicit = end_implicit;
document.start_mark = mark;
document.end_mark = mark;
return Ok(());
}
STACK_DEL!(nodes);
@ -1138,11 +1103,10 @@ pub unsafe fn yaml_document_initialize(
}
/// 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;
__assert!(!document.is_null());
while !STACK_EMPTY!((*document).nodes) {
let mut node = POP!((*document).nodes);
while !STACK_EMPTY!(document.nodes) {
let mut node = POP!(document.nodes);
yaml_free(node.tag as *mut libc::c_void);
match node.type_ {
YAML_SCALAR_NODE => {
@ -1159,20 +1123,16 @@ pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) {
}
}
}
STACK_DEL!((*document).nodes);
yaml_free((*document).version_directive as *mut libc::c_void);
tag_directive = (*document).tag_directives.start;
while tag_directive != (*document).tag_directives.end {
STACK_DEL!(document.nodes);
yaml_free(document.version_directive as *mut libc::c_void);
tag_directive = document.tag_directives.start;
while tag_directive != document.tag_directives.end {
yaml_free((*tag_directive).handle as *mut libc::c_void);
yaml_free((*tag_directive).prefix as *mut libc::c_void);
tag_directive = tag_directive.wrapping_offset(1);
}
yaml_free((*document).tag_directives.start as *mut libc::c_void);
memset(
document as *mut libc::c_void,
0,
size_of::<yaml_document_t>() as libc::c_ulong,
);
yaml_free(document.tag_directives.start as *mut libc::c_void);
*document = MaybeUninit::zeroed().assume_init();
}
/// 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.
pub unsafe fn yaml_document_get_node(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
index: libc::c_int,
) -> *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)
.nodes
.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.
///
/// 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 {
__assert!(!document.is_null());
if (*document).nodes.top != (*document).nodes.start {
return (*document).nodes.start;
pub unsafe fn yaml_document_get_root_node(document: &mut yaml_document_t) -> *mut yaml_node_t {
if document.nodes.top != document.nodes.start {
return document.nodes.start;
}
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.
#[must_use]
pub unsafe fn yaml_document_add_scalar(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
mut tag: *const yaml_char_t,
value: *const yaml_char_t,
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 node = MaybeUninit::<yaml_node_t>::uninit();
let node = node.as_mut_ptr();
__assert!(!document.is_null());
__assert!(!value.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;
@ -1268,8 +1224,8 @@ pub unsafe fn yaml_document_add_scalar(
(*node).data.scalar.value = value_copy;
(*node).data.scalar.length = length as size_t;
(*node).data.scalar.style = style;
PUSH!((*document).nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
PUSH!(document.nodes, *node);
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.
#[must_use]
pub unsafe fn yaml_document_add_sequence(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
mut tag: *const yaml_char_t,
style: yaml_sequence_style_t,
) -> libc::c_int {
@ -1307,7 +1263,6 @@ pub unsafe fn yaml_document_add_sequence(
};
let mut node = MaybeUninit::<yaml_node_t>::uninit();
let node = node.as_mut_ptr();
__assert!(!document.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;
}
@ -1328,8 +1283,8 @@ pub unsafe fn yaml_document_add_sequence(
(*node).data.sequence.items.end = items.end;
(*node).data.sequence.items.top = items.start;
(*node).data.sequence.style = style;
PUSH!((*document).nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
PUSH!(document.nodes, *node);
return document.nodes.top.c_offset_from(document.nodes.start) as libc::c_int;
}
}
STACK_DEL!(items);
@ -1344,7 +1299,7 @@ pub unsafe fn yaml_document_add_sequence(
/// Returns the node id or 0 on error.
#[must_use]
pub unsafe fn yaml_document_add_mapping(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
mut tag: *const yaml_char_t,
style: yaml_mapping_style_t,
) -> libc::c_int {
@ -1366,7 +1321,6 @@ pub unsafe fn yaml_document_add_mapping(
};
let mut node = MaybeUninit::<yaml_node_t>::uninit();
let node = node.as_mut_ptr();
__assert!(!document.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;
}
@ -1387,8 +1341,8 @@ pub unsafe fn yaml_document_add_mapping(
(*node).data.mapping.pairs.end = pairs.end;
(*node).data.mapping.pairs.top = pairs.start;
(*node).data.mapping.style = style;
PUSH!((*document).nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
PUSH!(document.nodes, *node);
return document.nodes.top.c_offset_from(document.nodes.start) as libc::c_int;
}
}
STACK_DEL!(pairs);
@ -1398,26 +1352,23 @@ pub unsafe fn yaml_document_add_mapping(
/// Add an item to a SEQUENCE node.
pub unsafe fn yaml_document_append_sequence_item(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
sequence: libc::c_int,
item: libc::c_int,
) -> Result<(), ()> {
__assert!(!document.is_null());
__assert!(
sequence > 0
&& ((*document).nodes.start).wrapping_offset(sequence as isize)
<= (*document).nodes.top
&& (document.nodes.start).wrapping_offset(sequence as isize) <= document.nodes.top
);
__assert!(
(*((*document).nodes.start).wrapping_offset((sequence - 1) as isize)).type_
(*(document.nodes.start).wrapping_offset((sequence - 1) as isize)).type_
== YAML_SEQUENCE_NODE
);
__assert!(
item > 0
&& ((*document).nodes.start).wrapping_offset(item as isize) <= (*document).nodes.top
item > 0 && (document.nodes.start).wrapping_offset(item as isize) <= document.nodes.top
);
PUSH!(
(*((*document).nodes.start).wrapping_offset((sequence - 1) as isize))
(*(document.nodes.start).wrapping_offset((sequence - 1) as isize))
.data
.sequence
.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.
pub unsafe fn yaml_document_append_mapping_pair(
document: *mut yaml_document_t,
document: &mut yaml_document_t,
mapping: libc::c_int,
key: libc::c_int,
value: libc::c_int,
) -> Result<(), ()> {
__assert!(!document.is_null());
__assert!(
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!(
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize)).type_
(*(document.nodes.start).wrapping_offset((mapping - 1) as isize)).type_
== YAML_MAPPING_NODE
);
__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!(
value > 0
&& ((*document).nodes.start).wrapping_offset(value as isize) <= (*document).nodes.top
value > 0 && (document.nodes.start).wrapping_offset(value as isize) <= document.nodes.top
);
let pair = yaml_node_pair_t { key, value };
PUSH!(
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize))
(*(document.nodes.start).wrapping_offset((mapping - 1) as isize))
.data
.mapping
.pairs,

View file

@ -72,8 +72,7 @@ pub unsafe fn yaml_emitter_dump(
column: 0_u64,
};
__assert!(!document.is_null());
let fresh0 = addr_of_mut!(emitter.document);
*fresh0 = document;
emitter.document = document;
if !emitter.opened {
if yaml_emitter_open(emitter).is_err() {
current_block = 5018439318894558507;
@ -92,8 +91,7 @@ pub unsafe fn yaml_emitter_dump(
}
} else {
__assert!(emitter.opened);
let fresh1 = addr_of_mut!(emitter.anchors);
*fresh1 = yaml_malloc(
emitter.anchors = yaml_malloc(
(size_of::<yaml_anchors_t>() as libc::c_ulong)
.force_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
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) {
let mut index: libc::c_int;
if emitter.anchors.is_null() {
yaml_document_delete(emitter.document);
let fresh2 = addr_of_mut!(emitter.document);
*fresh2 = ptr::null_mut::<yaml_document_t>();
yaml_document_delete(&mut *emitter.document);
emitter.document = ptr::null_mut::<yaml_document_t>();
return;
}
index = 0;
@ -170,11 +167,9 @@ unsafe fn yaml_emitter_delete_document_and_anchors(emitter: &mut yaml_emitter_t)
}
STACK_DEL!((*emitter.document).nodes);
yaml_free(emitter.anchors as *mut libc::c_void);
let fresh6 = addr_of_mut!(emitter.anchors);
*fresh6 = ptr::null_mut::<yaml_anchors_t>();
emitter.anchors = ptr::null_mut::<yaml_anchors_t>();
emitter.last_anchor_id = 0;
let fresh7 = addr_of_mut!(emitter.document);
*fresh7 = ptr::null_mut::<yaml_document_t>();
emitter.document = ptr::null_mut::<yaml_document_t>();
}
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 {
let fresh9 = addr_of_mut!(emitter.last_anchor_id);
let fresh9 = &mut emitter.last_anchor_id;
*fresh9 += 1;
(*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<(), ()> {
FLUSH(emitter)?;
let fresh40 = addr_of_mut!(emitter.buffer.pointer);
let fresh40 = &mut emitter.buffer.pointer;
let fresh41 = *fresh40;
*fresh40 = (*fresh40).wrapping_offset(1);
*fresh41 = value;
let fresh42 = addr_of_mut!(emitter.column);
let fresh42 = &mut emitter.column;
*fresh42 += 1;
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<(), ()> {
FLUSH(emitter)?;
if emitter.line_break == YAML_CR_BREAK {
let fresh62 = addr_of_mut!(emitter.buffer.pointer);
let fresh62 = &mut emitter.buffer.pointer;
let fresh63 = *fresh62;
*fresh62 = (*fresh62).wrapping_offset(1);
*fresh63 = b'\r';
} 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;
*fresh64 = (*fresh64).wrapping_offset(1);
*fresh65 = b'\n';
} 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;
*fresh66 = (*fresh66).wrapping_offset(1);
*fresh67 = b'\r';
let fresh68 = addr_of_mut!(emitter.buffer.pointer);
let fresh68 = &mut emitter.buffer.pointer;
let fresh69 = *fresh68;
*fresh68 = (*fresh68).wrapping_offset(1);
*fresh69 = b'\n';
};
emitter.column = 0;
let fresh70 = addr_of_mut!(emitter.line);
let fresh70 = &mut emitter.line;
*fresh70 += 1;
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<(), ()> {
FLUSH(emitter)?;
COPY!(emitter.buffer, *string);
let fresh107 = addr_of_mut!(emitter.column);
let fresh107 = &mut emitter.column;
*fresh107 += 1;
Ok(())
}
@ -86,7 +86,7 @@ unsafe fn WRITE_BREAK(emitter: &mut yaml_emitter_t, string: &mut yaml_string_t)
} else {
COPY!(emitter.buffer, *string);
emitter.column = 0;
let fresh300 = addr_of_mut!(emitter.line);
let fresh300 = &mut emitter.line;
*fresh300 += 1;
}
Ok(())
@ -97,8 +97,7 @@ unsafe fn yaml_emitter_set_emitter_error(
problem: *const libc::c_char,
) -> Result<(), ()> {
emitter.error = YAML_EMITTER_ERROR;
let fresh0 = addr_of_mut!(emitter.problem);
*fresh0 = problem;
emitter.problem = problem;
Err(())
}
@ -513,11 +512,11 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
false,
)?;
yaml_emitter_increase_indent(emitter, true, false);
let fresh12 = addr_of_mut!(emitter.flow_level);
let fresh12 = &mut emitter.flow_level;
*fresh12 += 1;
}
if (*event).type_ == YAML_SEQUENCE_END_EVENT {
let fresh13 = addr_of_mut!(emitter.flow_level);
let fresh13 = &mut emitter.flow_level;
*fresh13 -= 1;
emitter.indent = POP!(emitter.indents);
if emitter.canonical && !first {
@ -570,14 +569,14 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
false,
)?;
yaml_emitter_increase_indent(emitter, true, false);
let fresh18 = addr_of_mut!(emitter.flow_level);
let fresh18 = &mut emitter.flow_level;
*fresh18 += 1;
}
if (*event).type_ == YAML_MAPPING_END_EVENT {
if STACK_EMPTY!(emitter.indents) {
return Err(());
}
let fresh19 = addr_of_mut!(emitter.flow_level);
let fresh19 = &mut emitter.flow_level;
*fresh19 -= 1;
emitter.indent = POP!(emitter.indents);
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 {
let fresh46 = addr_of_mut!(emitter.tag_data.handle);
*fresh46 = b"!\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
emitter.tag_data.handle = b"!\0" as *const u8 as *const libc::c_char as *mut yaml_char_t;
emitter.tag_data.handle_length = 1_u64;
}
emitter.scalar_data.style = style;
@ -1154,8 +1152,7 @@ unsafe fn yaml_emitter_analyze_anchor(
}
MOVE!(string);
}
let fresh47 = addr_of_mut!(emitter.anchor_data.anchor);
*fresh47 = string.start;
emitter.anchor_data.anchor = string.start;
emitter.anchor_data.anchor_length = string.end.c_offset_from(string.start) as size_t;
emitter.anchor_data.alias = alias;
Ok(())
@ -1184,11 +1181,9 @@ unsafe fn yaml_emitter_analyze_tag(
prefix_length,
) == 0
{
let fresh48 = addr_of_mut!(emitter.tag_data.handle);
*fresh48 = (*tag_directive).handle;
emitter.tag_data.handle = (*tag_directive).handle;
emitter.tag_data.handle_length = strlen((*tag_directive).handle as *mut libc::c_char);
let fresh49 = addr_of_mut!(emitter.tag_data.suffix);
*fresh49 = string.start.wrapping_offset(prefix_length as isize);
emitter.tag_data.suffix = string.start.wrapping_offset(prefix_length as isize);
emitter.tag_data.suffix_length = (string.end.c_offset_from(string.start)
as libc::c_ulong)
.wrapping_sub(prefix_length);
@ -1196,8 +1191,7 @@ unsafe fn yaml_emitter_analyze_tag(
}
tag_directive = tag_directive.wrapping_offset(1);
}
let fresh50 = addr_of_mut!(emitter.tag_data.suffix);
*fresh50 = string.start;
emitter.tag_data.suffix = string.start;
emitter.tag_data.suffix_length = string.end.c_offset_from(string.start) as size_t;
Ok(())
}
@ -1222,8 +1216,7 @@ unsafe fn yaml_emitter_analyze_scalar(
let mut previous_space = false;
let mut previous_break = false;
let mut string = STRING_ASSIGN!(value, length);
let fresh51 = addr_of_mut!(emitter.scalar_data.value);
*fresh51 = value;
emitter.scalar_data.value = value;
emitter.scalar_data.length = length;
if string.start == string.end {
emitter.scalar_data.multiline = false;
@ -1374,17 +1367,13 @@ unsafe fn yaml_emitter_analyze_event(
emitter: &mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Result<(), ()> {
let fresh52 = addr_of_mut!(emitter.anchor_data.anchor);
*fresh52 = ptr::null_mut::<yaml_char_t>();
emitter.anchor_data.anchor = ptr::null_mut::<yaml_char_t>();
emitter.anchor_data.anchor_length = 0_u64;
let fresh53 = addr_of_mut!(emitter.tag_data.handle);
*fresh53 = ptr::null_mut::<yaml_char_t>();
emitter.tag_data.handle = ptr::null_mut::<yaml_char_t>();
emitter.tag_data.handle_length = 0_u64;
let fresh54 = addr_of_mut!(emitter.tag_data.suffix);
*fresh54 = ptr::null_mut::<yaml_char_t>();
emitter.tag_data.suffix = ptr::null_mut::<yaml_char_t>();
emitter.tag_data.suffix_length = 0_u64;
let fresh55 = addr_of_mut!(emitter.scalar_data.value);
*fresh55 = ptr::null_mut::<yaml_char_t>();
emitter.scalar_data.value = ptr::null_mut::<yaml_char_t>();
emitter.scalar_data.length = 0_u64;
match (*event).type_ {
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<(), ()> {
FLUSH(emitter)?;
let fresh56 = addr_of_mut!(emitter.buffer.pointer);
let fresh56 = &mut emitter.buffer.pointer;
let fresh57 = *fresh56;
*fresh56 = (*fresh56).wrapping_offset(1);
*fresh57 = b'\xEF';
let fresh58 = addr_of_mut!(emitter.buffer.pointer);
let fresh58 = &mut emitter.buffer.pointer;
let fresh59 = *fresh58;
*fresh58 = (*fresh58).wrapping_offset(1);
*fresh59 = b'\xBB';
let fresh60 = addr_of_mut!(emitter.buffer.pointer);
let fresh60 = &mut emitter.buffer.pointer;
let fresh61 = *fresh60;
*fresh60 = (*fresh60).wrapping_offset(1);
*fresh61 = b'\xBF';

View file

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

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

View file

@ -14,8 +14,7 @@ unsafe fn yaml_parser_set_reader_error(
value: libc::c_int,
) -> Result<(), ()> {
parser.error = YAML_READER_ERROR;
let fresh0 = addr_of_mut!(parser.problem);
*fresh0 = problem;
parser.problem = problem;
parser.problem_offset = offset;
parser.problem_value = value;
Err(())
@ -47,9 +46,9 @@ unsafe fn yaml_parser_determine_encoding(parser: &mut yaml_parser_t) -> Result<(
) == 0
{
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);
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;
} else if parser
.raw_buffer
@ -63,9 +62,9 @@ unsafe fn yaml_parser_determine_encoding(parser: &mut yaml_parser_t) -> Result<(
) == 0
{
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);
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;
} else if parser
.raw_buffer
@ -79,9 +78,9 @@ unsafe fn yaml_parser_determine_encoding(parser: &mut yaml_parser_t) -> Result<(
) == 0
{
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);
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;
} else {
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,
);
}
let fresh7 = addr_of_mut!(parser.raw_buffer.last);
*fresh7 = (*fresh7).wrapping_offset(
parser.raw_buffer.last = parser.raw_buffer.last.wrapping_offset(
-(parser
.raw_buffer
.pointer
.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;
if parser.read_handler.expect("non-null function pointer")(
parser.read_handler_data,
@ -135,7 +133,7 @@ unsafe fn yaml_parser_update_raw_buffer(parser: &mut yaml_parser_t) -> Result<()
-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);
if size_read == 0 {
parser.eof = true;
@ -165,15 +163,11 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
parser.buffer.pointer as *const libc::c_void,
size,
);
let fresh10 = addr_of_mut!(parser.buffer.pointer);
*fresh10 = parser.buffer.start;
let fresh11 = addr_of_mut!(parser.buffer.last);
*fresh11 = parser.buffer.start.wrapping_offset(size as isize);
parser.buffer.pointer = parser.buffer.start;
parser.buffer.last = parser.buffer.start.wrapping_offset(size as isize);
} else if parser.buffer.pointer == parser.buffer.last {
let fresh12 = addr_of_mut!(parser.buffer.pointer);
*fresh12 = parser.buffer.start;
let fresh13 = addr_of_mut!(parser.buffer.last);
*fresh13 = parser.buffer.start;
parser.buffer.pointer = parser.buffer.start;
parser.buffer.last = parser.buffer.start;
}
while parser.unread < length {
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,
);
}
let fresh14 = addr_of_mut!(parser.raw_buffer.pointer);
let fresh14 = &mut parser.raw_buffer.pointer;
*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;
if value <= 0x7F {
let fresh16 = addr_of_mut!(parser.buffer.last);
let fresh16 = &mut parser.buffer.last;
let fresh17 = *fresh16;
*fresh16 = (*fresh16).wrapping_offset(1);
*fresh17 = value as yaml_char_t;
} else if value <= 0x7FF {
let fresh18 = addr_of_mut!(parser.buffer.last);
let fresh18 = &mut parser.buffer.last;
let fresh19 = *fresh18;
*fresh18 = (*fresh18).wrapping_offset(1);
*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;
*fresh20 = (*fresh20).wrapping_offset(1);
*fresh21 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t;
} else if value <= 0xFFFF {
let fresh22 = addr_of_mut!(parser.buffer.last);
let fresh22 = &mut parser.buffer.last;
let fresh23 = *fresh22;
*fresh22 = (*fresh22).wrapping_offset(1);
*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;
*fresh24 = (*fresh24).wrapping_offset(1);
*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;
*fresh26 = (*fresh26).wrapping_offset(1);
*fresh27 = 0x80_u32.force_add(value & 0x3F) as yaml_char_t;
} else {
let fresh28 = addr_of_mut!(parser.buffer.last);
let fresh28 = &mut parser.buffer.last;
let fresh29 = *fresh28;
*fresh28 = (*fresh28).wrapping_offset(1);
*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;
*fresh30 = (*fresh30).wrapping_offset(1);
*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;
*fresh32 = (*fresh32).wrapping_offset(1);
*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;
*fresh34 = (*fresh34).wrapping_offset(1);
*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);
}
if parser.eof {
let fresh37 = addr_of_mut!(parser.buffer.last);
let fresh37 = &mut parser.buffer.last;
let fresh38 = *fresh37;
*fresh37 = (*fresh37).wrapping_offset(1);
*fresh38 = b'\0';
let fresh39 = addr_of_mut!(parser.unread);
let fresh39 = &mut parser.unread;
*fresh39 = (*fresh39).force_add(1);
return Ok(());
}

View file

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

View file

@ -11,8 +11,7 @@ unsafe fn yaml_emitter_set_writer_error(
problem: *const libc::c_char,
) -> Result<(), ()> {
emitter.error = YAML_WRITER_ERROR;
let fresh0 = addr_of_mut!(emitter.problem);
*fresh0 = problem;
emitter.problem = problem;
Err(())
}
@ -20,10 +19,8 @@ unsafe fn yaml_emitter_set_writer_error(
pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()> {
__assert!((emitter.write_handler).is_some());
__assert!(emitter.encoding != YAML_ANY_ENCODING);
let fresh1 = addr_of_mut!(emitter.buffer.last);
*fresh1 = emitter.buffer.pointer;
let fresh2 = addr_of_mut!(emitter.buffer.pointer);
*fresh2 = emitter.buffer.start;
emitter.buffer.last = emitter.buffer.pointer;
emitter.buffer.pointer = emitter.buffer.start;
if emitter.buffer.start == emitter.buffer.last {
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,
) != 0
{
let fresh3 = addr_of_mut!(emitter.buffer.last);
*fresh3 = emitter.buffer.start;
let fresh4 = addr_of_mut!(emitter.buffer.pointer);
*fresh4 = emitter.buffer.start;
emitter.buffer.last = emitter.buffer.start;
emitter.buffer.pointer = emitter.buffer.start;
return Ok(());
} else {
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);
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);
if value < 0x10000 {
*emitter.raw_buffer.last.wrapping_offset(high as isize) = (value >> 8) as libc::c_uchar;
*emitter.raw_buffer.last.wrapping_offset(low as isize) =
(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);
} else {
value = value.wrapping_sub(0x10000);
@ -112,7 +107,7 @@ pub unsafe fn yaml_emitter_flush(emitter: &mut yaml_emitter_t) -> Result<(), ()>
.raw_buffer
.last
.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);
}
}
@ -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,
) != 0
{
let fresh8 = addr_of_mut!(emitter.buffer.last);
*fresh8 = emitter.buffer.start;
let fresh9 = addr_of_mut!(emitter.buffer.pointer);
*fresh9 = emitter.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;
emitter.buffer.last = emitter.buffer.start;
emitter.buffer.pointer = emitter.buffer.start;
emitter.raw_buffer.last = emitter.raw_buffer.start;
emitter.raw_buffer.pointer = emitter.raw_buffer.start;
Ok(())
} else {
yaml_emitter_set_writer_error(

View file

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