Remove $context arg from macros where unused

This commit is contained in:
David Tolnay 2022-07-30 02:07:45 -07:00
parent 44b9e9795a
commit c5981734ce
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
6 changed files with 137 additions and 209 deletions

View file

@ -167,14 +167,14 @@ pub unsafe fn yaml_parser_initialize(parser: *mut yaml_parser_t) -> Success {
0,
size_of::<yaml_parser_t>() as libc::c_ulong,
);
BUFFER_INIT!(parser, (*parser).raw_buffer, INPUT_RAW_BUFFER_SIZE);
BUFFER_INIT!(parser, (*parser).buffer, INPUT_BUFFER_SIZE);
QUEUE_INIT!(parser, (*parser).tokens, yaml_token_t);
STACK_INIT!(parser, (*parser).indents, libc::c_int);
STACK_INIT!(parser, (*parser).simple_keys, yaml_simple_key_t);
STACK_INIT!(parser, (*parser).states, yaml_parser_state_t);
STACK_INIT!(parser, (*parser).marks, yaml_mark_t);
STACK_INIT!(parser, (*parser).tag_directives, yaml_tag_directive_t);
BUFFER_INIT!((*parser).raw_buffer, INPUT_RAW_BUFFER_SIZE);
BUFFER_INIT!((*parser).buffer, INPUT_BUFFER_SIZE);
QUEUE_INIT!((*parser).tokens, yaml_token_t);
STACK_INIT!((*parser).indents, libc::c_int);
STACK_INIT!((*parser).simple_keys, yaml_simple_key_t);
STACK_INIT!((*parser).states, yaml_parser_state_t);
STACK_INIT!((*parser).marks, yaml_mark_t);
STACK_INIT!((*parser).tag_directives, yaml_tag_directive_t);
OK
}
@ -299,12 +299,12 @@ pub unsafe fn yaml_emitter_initialize(mut emitter: *mut yaml_emitter_t) -> Succe
0,
size_of::<yaml_emitter_t>() as libc::c_ulong,
);
BUFFER_INIT!(emitter, (*emitter).buffer, OUTPUT_BUFFER_SIZE);
BUFFER_INIT!(emitter, (*emitter).raw_buffer, OUTPUT_RAW_BUFFER_SIZE);
STACK_INIT!(emitter, (*emitter).states, yaml_emitter_state_t);
QUEUE_INIT!(emitter, (*emitter).events, yaml_event_t);
STACK_INIT!(emitter, (*emitter).indents, libc::c_int);
STACK_INIT!(emitter, (*emitter).tag_directives, yaml_tag_directive_t);
BUFFER_INIT!((*emitter).buffer, OUTPUT_BUFFER_SIZE);
BUFFER_INIT!((*emitter).raw_buffer, OUTPUT_RAW_BUFFER_SIZE);
STACK_INIT!((*emitter).states, yaml_emitter_state_t);
QUEUE_INIT!((*emitter).events, yaml_event_t);
STACK_INIT!((*emitter).indents, libc::c_int);
STACK_INIT!((*emitter).tag_directives, yaml_tag_directive_t);
OK
}
@ -643,11 +643,7 @@ pub unsafe fn yaml_document_start_event_initialize(
1394248824506584008 => {
if tag_directives_start != tag_directives_end {
let mut tag_directive: *mut yaml_tag_directive_t;
STACK_INIT!(
addr_of_mut!(context),
tag_directives_copy,
yaml_tag_directive_t
);
STACK_INIT!(tag_directives_copy, yaml_tag_directive_t);
tag_directive = tag_directives_start;
loop {
if !(tag_directive != tag_directives_end) {
@ -680,7 +676,7 @@ pub unsafe fn yaml_document_start_event_initialize(
current_block = 14964981520188694172;
break;
}
PUSH!(addr_of_mut!(context), tag_directives_copy, value);
PUSH!(tag_directives_copy, value);
value.handle = ptr::null_mut::<yaml_char_t>();
value.prefix = ptr::null_mut::<yaml_char_t>();
tag_directive = tag_directive.wrapping_offset(1);
@ -1167,7 +1163,7 @@ pub unsafe fn yaml_document_initialize(
!tag_directives_start.is_null() && !tag_directives_end.is_null()
|| tag_directives_start == tag_directives_end
);
STACK_INIT!(addr_of_mut!(context), nodes, yaml_node_t);
STACK_INIT!(nodes, yaml_node_t);
if !version_directive.is_null() {
version_directive_copy = yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong)
as *mut yaml_version_directive_t;
@ -1182,11 +1178,7 @@ pub unsafe fn yaml_document_initialize(
_ => {
if tag_directives_start != tag_directives_end {
let mut tag_directive: *mut yaml_tag_directive_t;
STACK_INIT!(
addr_of_mut!(context),
tag_directives_copy,
yaml_tag_directive_t
);
STACK_INIT!(tag_directives_copy, yaml_tag_directive_t);
tag_directive = tag_directives_start;
loop {
if !(tag_directive != tag_directives_end) {
@ -1219,7 +1211,7 @@ pub unsafe fn yaml_document_initialize(
current_block = 8142820162064489797;
break;
}
PUSH!(addr_of_mut!(context), tag_directives_copy, value);
PUSH!(tag_directives_copy, value);
value.handle = ptr::null_mut::<yaml_char_t>();
value.prefix = ptr::null_mut::<yaml_char_t>();
tag_directive = tag_directive.wrapping_offset(1);
@ -1400,7 +1392,7 @@ 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!(addr_of_mut!(context), (*document).nodes, *node);
PUSH!((*document).nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
}
}
@ -1446,7 +1438,7 @@ pub unsafe fn yaml_document_add_sequence(
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).ok {
tag_copy = yaml_strdup(tag);
if !tag_copy.is_null() {
STACK_INIT!(addr_of_mut!(context), items, yaml_node_item_t);
STACK_INIT!(items, yaml_node_item_t);
memset(
node as *mut libc::c_void,
0,
@ -1460,7 +1452,7 @@ 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!(addr_of_mut!(context), (*document).nodes, *node);
PUSH!((*document).nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
}
}
@ -1505,7 +1497,7 @@ pub unsafe fn yaml_document_add_mapping(
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).ok {
tag_copy = yaml_strdup(tag);
if !tag_copy.is_null() {
STACK_INIT!(addr_of_mut!(context), pairs, yaml_node_pair_t);
STACK_INIT!(pairs, yaml_node_pair_t);
memset(
node as *mut libc::c_void,
0,
@ -1519,7 +1511,7 @@ 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!(addr_of_mut!(context), (*document).nodes, *node);
PUSH!((*document).nodes, *node);
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
}
}
@ -1549,7 +1541,6 @@ pub unsafe fn yaml_document_append_sequence_item(
&& ((*document).nodes.start).wrapping_offset(item as isize) <= (*document).nodes.top
);
PUSH!(
addr_of_mut!(context),
(*((*document).nodes.start).wrapping_offset((sequence - 1) as isize))
.data
.sequence
@ -1584,7 +1575,6 @@ pub unsafe fn yaml_document_append_mapping_pair(
);
let pair = yaml_node_pair_t { key, value };
PUSH!(
addr_of_mut!(context),
(*((*document).nodes.start).wrapping_offset((mapping - 1) as isize))
.data
.mapping

View file

@ -132,7 +132,7 @@ pub unsafe fn yaml_emitter_emit(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
ENQUEUE!(emitter, (*emitter).events, *event);
ENQUEUE!((*emitter).events, *event);
while yaml_emitter_need_more_events(emitter).fail {
if yaml_emitter_analyze_event(emitter, (*emitter).events.head).fail {
return FAIL;
@ -219,7 +219,7 @@ unsafe fn yaml_emitter_append_tag_directive(
if copy.handle.is_null() || copy.prefix.is_null() {
(*emitter).error = YAML_MEMORY_ERROR;
} else {
PUSH!(emitter, (*emitter).tag_directives, copy);
PUSH!((*emitter).tag_directives, copy);
return OK;
}
yaml_free(copy.handle as *mut libc::c_void);
@ -232,7 +232,7 @@ unsafe fn yaml_emitter_increase_indent(
flow: bool,
indentless: bool,
) -> Success {
PUSH!(emitter, (*emitter).indents, (*emitter).indent);
PUSH!((*emitter).indents, (*emitter).indent);
if (*emitter).indent < 0 {
(*emitter).indent = if flow { (*emitter).best_indent } else { 0 };
} else if !indentless {
@ -557,7 +557,7 @@ unsafe fn yaml_emitter_emit_document_content(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
PUSH!(emitter, (*emitter).states, YAML_EMIT_DOCUMENT_END_STATE);
PUSH!((*emitter).states, YAML_EMIT_DOCUMENT_END_STATE);
yaml_emitter_emit_node(emitter, event, true, false, false, false)
}
@ -680,11 +680,7 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
return FAIL;
}
}
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE
);
PUSH!((*emitter).states, YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE);
yaml_emitter_emit_node(emitter, event, false, true, false, false)
}
@ -767,11 +763,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
}
}
if !(*emitter).canonical && yaml_emitter_check_simple_key(emitter) {
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE
);
PUSH!((*emitter).states, YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE);
yaml_emitter_emit_node(emitter, event, false, false, true, true)
} else {
if yaml_emitter_write_indicator(
@ -785,11 +777,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
{
return FAIL;
}
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_FLOW_MAPPING_VALUE_STATE
);
PUSH!((*emitter).states, YAML_EMIT_FLOW_MAPPING_VALUE_STATE);
yaml_emitter_emit_node(emitter, event, false, false, true, false)
}
}
@ -829,7 +817,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_value(
return FAIL;
}
}
PUSH!(emitter, (*emitter).states, YAML_EMIT_FLOW_MAPPING_KEY_STATE);
PUSH!((*emitter).states, YAML_EMIT_FLOW_MAPPING_KEY_STATE);
yaml_emitter_emit_node(emitter, event, false, false, true, false)
}
@ -868,11 +856,7 @@ unsafe fn yaml_emitter_emit_block_sequence_item(
{
return FAIL;
}
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE
);
PUSH!((*emitter).states, YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE);
yaml_emitter_emit_node(emitter, event, false, true, false, false)
}
@ -896,7 +880,6 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
}
if yaml_emitter_check_simple_key(emitter) {
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE
);
@ -913,11 +896,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
{
return FAIL;
}
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_MAPPING_VALUE_STATE
);
PUSH!((*emitter).states, YAML_EMIT_BLOCK_MAPPING_VALUE_STATE);
yaml_emitter_emit_node(emitter, event, false, false, true, false)
}
}
@ -955,11 +934,7 @@ unsafe fn yaml_emitter_emit_block_mapping_value(
return FAIL;
}
}
PUSH!(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_MAPPING_KEY_STATE
);
PUSH!((*emitter).states, YAML_EMIT_BLOCK_MAPPING_KEY_STATE);
yaml_emitter_emit_node(emitter, event, false, false, true, false)
}

View file

@ -48,7 +48,7 @@ pub unsafe fn yaml_parser_load(
0,
size_of::<yaml_document_t>() as libc::c_ulong,
);
STACK_INIT!(parser, (*document).nodes, yaml_node_t);
STACK_INIT!((*document).nodes, yaml_node_t);
if !(*parser).stream_start_produced {
if yaml_parser_parse(parser, event).fail {
current_block = 6234624449317607669;
@ -69,7 +69,7 @@ pub unsafe fn yaml_parser_load(
if (*event).type_ == YAML_STREAM_END_EVENT {
return OK;
}
STACK_INIT!(parser, (*parser).aliases, yaml_alias_data_t);
STACK_INIT!((*parser).aliases, yaml_alias_data_t);
let fresh6 = addr_of_mut!((*parser).document);
*fresh6 = document;
if yaml_parser_load_document(parser, event).ok {
@ -142,7 +142,7 @@ unsafe fn yaml_parser_load_document(
*fresh18 = (*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!(parser, ctx, libc::c_int);
STACK_INIT!(ctx, libc::c_int);
if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)).fail {
STACK_DEL!(ctx);
return FAIL;
@ -239,7 +239,7 @@ unsafe fn yaml_parser_register_anchor(
}
alias_data = alias_data.wrapping_offset(1);
}
PUSH!(parser, (*parser).aliases, *data);
PUSH!((*parser).aliases, *data);
OK
}
@ -261,7 +261,7 @@ unsafe fn yaml_parser_load_node_add(
if STACK_LIMIT!(parser, (*parent).data.sequence.items).fail {
return FAIL;
}
PUSH!(parser, (*parent).data.sequence.items, index);
PUSH!((*parent).data.sequence.items, index);
}
YAML_MAPPING_NODE => {
let mut pair = MaybeUninit::<yaml_node_pair_t>::uninit();
@ -286,7 +286,7 @@ unsafe fn yaml_parser_load_node_add(
if STACK_LIMIT!(parser, (*parent).data.mapping.pairs).fail {
return FAIL;
}
PUSH!(parser, (*parent).data.mapping.pairs, *pair);
PUSH!((*parent).data.mapping.pairs, *pair);
}
}
}
@ -368,7 +368,7 @@ unsafe fn yaml_parser_load_scalar(
(*node).data.scalar.value = (*event).data.scalar.value;
(*node).data.scalar.length = (*event).data.scalar.length;
(*node).data.scalar.style = (*event).data.scalar.style;
PUSH!(parser, (*(*parser).document).nodes, *node);
PUSH!((*(*parser).document).nodes, *node);
index = (*(*parser).document)
.nodes
.top
@ -429,7 +429,7 @@ unsafe fn yaml_parser_load_sequence(
match current_block {
13474536459355229096 => {}
_ => {
STACK_INIT!(parser, items, yaml_node_item_t);
STACK_INIT!(items, yaml_node_item_t);
memset(
node as *mut libc::c_void,
0,
@ -443,7 +443,7 @@ unsafe fn yaml_parser_load_sequence(
(*node).data.sequence.items.end = items.end;
(*node).data.sequence.items.top = items.start;
(*node).data.sequence.style = (*event).data.sequence_start.style;
PUSH!(parser, (*(*parser).document).nodes, *node);
PUSH!((*(*parser).document).nodes, *node);
index = (*(*parser).document)
.nodes
.top
@ -460,7 +460,7 @@ unsafe fn yaml_parser_load_sequence(
if STACK_LIMIT!(parser, *ctx).fail {
return FAIL;
}
PUSH!(parser, *ctx, index);
PUSH!(*ctx, index);
return OK;
}
}
@ -532,7 +532,7 @@ unsafe fn yaml_parser_load_mapping(
match current_block {
13635467803606088781 => {}
_ => {
STACK_INIT!(parser, pairs, yaml_node_pair_t);
STACK_INIT!(pairs, yaml_node_pair_t);
memset(
node as *mut libc::c_void,
0,
@ -546,7 +546,7 @@ unsafe fn yaml_parser_load_mapping(
(*node).data.mapping.pairs.end = pairs.end;
(*node).data.mapping.pairs.top = pairs.start;
(*node).data.mapping.style = (*event).data.mapping_start.style;
PUSH!(parser, (*(*parser).document).nodes, *node);
PUSH!((*(*parser).document).nodes, *node);
index = (*(*parser).document)
.nodes
.top
@ -563,7 +563,7 @@ unsafe fn yaml_parser_load_mapping(
if STACK_LIMIT!(parser, *ctx).fail {
return FAIL;
}
PUSH!(parser, *ctx, index);
PUSH!(*ctx, index);
return OK;
}
}

View file

@ -1,5 +1,5 @@
macro_rules! BUFFER_INIT {
($context:expr, $buffer:expr, $size:expr) => {{
($buffer:expr, $size:expr) => {{
let start = addr_of_mut!($buffer.start);
*start = yaml_malloc($size as size_t) as *mut yaml_char_t;
let pointer = addr_of_mut!($buffer.pointer);
@ -34,7 +34,7 @@ macro_rules! STRING_ASSIGN {
}
macro_rules! STRING_INIT {
($context:expr, $string:expr) => {{
($string:expr) => {{
$string.start = yaml_malloc(16) as *mut yaml_char_t;
$string.pointer = $string.start;
$string.end = $string.start.wrapping_add(16);
@ -52,7 +52,7 @@ macro_rules! STRING_DEL {
}
macro_rules! STRING_EXTEND {
($context:expr, $string:expr) => {
($string:expr) => {
if $string.pointer.wrapping_add(5) >= $string.end {
yaml_string_extend(
addr_of_mut!($string.start),
@ -75,7 +75,7 @@ macro_rules! CLEAR {
}
macro_rules! JOIN {
($context:expr, $string_a:expr, $string_b:expr) => {{
($string_a:expr, $string_b:expr) => {{
yaml_string_join(
addr_of_mut!($string_a.start),
addr_of_mut!($string_a.pointer),
@ -347,7 +347,7 @@ macro_rules! COPY {
}
macro_rules! STACK_INIT {
($context:expr, $stack:expr, $type:ty) => {{
($stack:expr, $type:ty) => {{
$stack.start = yaml_malloc(16 * size_of::<$type>() as libc::c_ulong) as *mut $type;
$stack.top = $stack.start;
$stack.end = $stack.start.offset(16_isize);
@ -381,7 +381,7 @@ macro_rules! STACK_LIMIT {
}
macro_rules! PUSH {
(do $context:expr, $stack:expr, $push:expr) => {{
(do $stack:expr, $push:expr) => {{
if $stack.top == $stack.end {
yaml_stack_extend(
addr_of_mut!($stack.start) as *mut *mut libc::c_void,
@ -392,11 +392,11 @@ macro_rules! PUSH {
$push;
$stack.top = $stack.top.wrapping_offset(1);
}};
($context:expr, $stack:expr, *$value:expr) => {
PUSH!(do $context, $stack, ptr::copy_nonoverlapping($value, $stack.top, 1))
($stack:expr, *$value:expr) => {
PUSH!(do $stack, ptr::copy_nonoverlapping($value, $stack.top, 1))
};
($context:expr, $stack:expr, $value:expr) => {
PUSH!(do $context, $stack, ptr::write($stack.top, $value))
($stack:expr, $value:expr) => {
PUSH!(do $stack, ptr::write($stack.top, $value))
};
}
@ -410,7 +410,7 @@ macro_rules! POP {
}
macro_rules! QUEUE_INIT {
($context:expr, $queue:expr, $type:ty) => {{
($queue:expr, $type:ty) => {{
$queue.start = yaml_malloc(16 * size_of::<$type>() as libc::c_ulong) as *mut $type;
$queue.tail = $queue.start;
$queue.head = $queue.tail;
@ -435,7 +435,7 @@ macro_rules! QUEUE_EMPTY {
}
macro_rules! ENQUEUE {
(do $context:expr, $queue:expr, $enqueue:expr) => {{
(do $queue:expr, $enqueue:expr) => {{
if $queue.tail == $queue.end {
yaml_queue_extend(
addr_of_mut!($queue.start) as *mut *mut libc::c_void,
@ -447,11 +447,11 @@ macro_rules! ENQUEUE {
$enqueue;
$queue.tail = $queue.tail.wrapping_offset(1);
}};
($context:expr, $queue:expr, *$value:expr) => {
ENQUEUE!(do $context, $queue, ptr::copy_nonoverlapping($value, $queue.tail, 1))
($queue:expr, *$value:expr) => {
ENQUEUE!(do $queue, ptr::copy_nonoverlapping($value, $queue.tail, 1))
};
($context:expr, $queue:expr, $value:expr) => {
ENQUEUE!(do $context, $queue, ptr::write($queue.tail, $value))
($queue:expr, $value:expr) => {
ENQUEUE!(do $queue, ptr::write($queue.tail, $value))
};
}
@ -466,7 +466,7 @@ macro_rules! DEQUEUE {
}
macro_rules! QUEUE_INSERT {
($context:expr, $queue:expr, $index:expr, $value:expr) => {{
($queue:expr, $index:expr, $value:expr) => {{
if $queue.tail == $queue.end {
yaml_queue_extend(
addr_of_mut!($queue.start) as *mut *mut libc::c_void,

View file

@ -257,7 +257,7 @@ unsafe fn yaml_parser_parse_document_start(
{
return FAIL;
}
PUSH!(parser, (*parser).states, YAML_PARSE_DOCUMENT_END_STATE);
PUSH!((*parser).states, YAML_PARSE_DOCUMENT_END_STATE);
(*parser).state = YAML_PARSE_BLOCK_NODE_STATE;
memset(
event as *mut libc::c_void,
@ -297,7 +297,7 @@ unsafe fn yaml_parser_parse_document_start(
(*token).start_mark,
);
} else {
PUSH!(parser, (*parser).states, YAML_PARSE_DOCUMENT_END_STATE);
PUSH!((*parser).states, YAML_PARSE_DOCUMENT_END_STATE);
(*parser).state = YAML_PARSE_DOCUMENT_CONTENT_STATE;
end_mark = (*token).end_mark;
memset(
@ -755,7 +755,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
let mut token: *mut yaml_token_t;
if first {
token = PEEK_TOKEN(parser);
PUSH!(parser, (*parser).marks, (*token).start_mark);
PUSH!((*parser).marks, (*token).start_mark);
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
@ -770,11 +770,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
return FAIL;
}
if (*token).type_ != YAML_BLOCK_ENTRY_TOKEN && (*token).type_ != YAML_BLOCK_END_TOKEN {
PUSH!(
parser,
(*parser).states,
YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE
);
PUSH!((*parser).states, YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE);
yaml_parser_parse_node(parser, event, true, false)
} else {
(*parser).state = YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE;
@ -826,11 +822,7 @@ unsafe fn yaml_parser_parse_indentless_sequence_entry(
&& (*token).type_ != YAML_VALUE_TOKEN
&& (*token).type_ != YAML_BLOCK_END_TOKEN
{
PUSH!(
parser,
(*parser).states,
YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
);
PUSH!((*parser).states, YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE);
yaml_parser_parse_node(parser, event, true, false)
} else {
(*parser).state = YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE;
@ -858,7 +850,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
let mut token: *mut yaml_token_t;
if first {
token = PEEK_TOKEN(parser);
PUSH!(parser, (*parser).marks, (*token).start_mark);
PUSH!((*parser).marks, (*token).start_mark);
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
@ -876,11 +868,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
&& (*token).type_ != YAML_VALUE_TOKEN
&& (*token).type_ != YAML_BLOCK_END_TOKEN
{
PUSH!(
parser,
(*parser).states,
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE
);
PUSH!((*parser).states, YAML_PARSE_BLOCK_MAPPING_VALUE_STATE);
yaml_parser_parse_node(parser, event, true, true)
} else {
(*parser).state = YAML_PARSE_BLOCK_MAPPING_VALUE_STATE;
@ -931,7 +919,7 @@ unsafe fn yaml_parser_parse_block_mapping_value(
&& (*token).type_ != YAML_VALUE_TOKEN
&& (*token).type_ != YAML_BLOCK_END_TOKEN
{
PUSH!(parser, (*parser).states, YAML_PARSE_BLOCK_MAPPING_KEY_STATE);
PUSH!((*parser).states, YAML_PARSE_BLOCK_MAPPING_KEY_STATE);
yaml_parser_parse_node(parser, event, true, true)
} else {
(*parser).state = YAML_PARSE_BLOCK_MAPPING_KEY_STATE;
@ -951,7 +939,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
let mut token: *mut yaml_token_t;
if first {
token = PEEK_TOKEN(parser);
PUSH!(parser, (*parser).marks, (*token).start_mark);
PUSH!((*parser).marks, (*token).start_mark);
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
@ -996,11 +984,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
SKIP_TOKEN(parser);
return OK;
} else if (*token).type_ != YAML_FLOW_SEQUENCE_END_TOKEN {
PUSH!(
parser,
(*parser).states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE
);
PUSH!((*parser).states, YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE);
return yaml_parser_parse_node(parser, event, false, false);
}
}
@ -1031,7 +1015,6 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_key(
&& (*token).type_ != YAML_FLOW_SEQUENCE_END_TOKEN
{
PUSH!(
parser,
(*parser).states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE
);
@ -1062,7 +1045,6 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_value(
if (*token).type_ != YAML_FLOW_ENTRY_TOKEN && (*token).type_ != YAML_FLOW_SEQUENCE_END_TOKEN
{
PUSH!(
parser,
(*parser).states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE
);
@ -1101,7 +1083,7 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
let mut token: *mut yaml_token_t;
if first {
token = PEEK_TOKEN(parser);
PUSH!(parser, (*parser).marks, (*token).start_mark);
PUSH!((*parser).marks, (*token).start_mark);
SKIP_TOKEN(parser);
}
token = PEEK_TOKEN(parser);
@ -1137,22 +1119,14 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
&& (*token).type_ != YAML_FLOW_ENTRY_TOKEN
&& (*token).type_ != YAML_FLOW_MAPPING_END_TOKEN
{
PUSH!(
parser,
(*parser).states,
YAML_PARSE_FLOW_MAPPING_VALUE_STATE
);
PUSH!((*parser).states, YAML_PARSE_FLOW_MAPPING_VALUE_STATE);
return yaml_parser_parse_node(parser, event, false, false);
} else {
(*parser).state = YAML_PARSE_FLOW_MAPPING_VALUE_STATE;
return yaml_parser_process_empty_scalar(event, (*token).start_mark);
}
} else if (*token).type_ != YAML_FLOW_MAPPING_END_TOKEN {
PUSH!(
parser,
(*parser).states,
YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE
);
PUSH!((*parser).states, YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE);
return yaml_parser_parse_node(parser, event, false, false);
}
}
@ -1192,7 +1166,7 @@ unsafe fn yaml_parser_parse_flow_mapping_value(
}
if (*token).type_ != YAML_FLOW_ENTRY_TOKEN && (*token).type_ != YAML_FLOW_MAPPING_END_TOKEN
{
PUSH!(parser, (*parser).states, YAML_PARSE_FLOW_MAPPING_KEY_STATE);
PUSH!((*parser).states, YAML_PARSE_FLOW_MAPPING_KEY_STATE);
return yaml_parser_parse_node(parser, event, false, false);
}
}
@ -1262,7 +1236,7 @@ unsafe fn yaml_parser_process_directives(
top: ptr::null_mut::<yaml_tag_directive_t>(),
};
let mut token: *mut yaml_token_t;
STACK_INIT!(parser, tag_directives, yaml_tag_directive_t);
STACK_INIT!(tag_directives, yaml_tag_directive_t);
token = PEEK_TOKEN(parser);
if !token.is_null() {
loop {
@ -1309,7 +1283,7 @@ unsafe fn yaml_parser_process_directives(
current_block = 17143798186130252483;
break;
}
PUSH!(parser, tag_directives, value);
PUSH!(tag_directives, value);
}
SKIP_TOKEN(parser);
token = PEEK_TOKEN(parser);
@ -1412,7 +1386,7 @@ unsafe fn yaml_parser_append_tag_directive(
if copy.handle.is_null() || copy.prefix.is_null() {
(*parser).error = YAML_MEMORY_ERROR;
} else {
PUSH!(parser, (*parser).tag_directives, copy);
PUSH!((*parser).tag_directives, copy);
return OK;
}
yaml_free(copy.handle as *mut libc::c_void);

View file

@ -55,7 +55,7 @@ unsafe fn SKIP_LINE(parser: *mut yaml_parser_t) {
}
unsafe fn READ(parser: *mut yaml_parser_t, string: *mut yaml_string_t) {
STRING_EXTEND!(parser, *string);
STRING_EXTEND!(*string);
let width = WIDTH!((*parser).buffer);
COPY!(*string, (*parser).buffer);
(*parser).mark.index = (*parser).mark.index.wrapping_add(width as u64);
@ -64,7 +64,7 @@ unsafe fn READ(parser: *mut yaml_parser_t, string: *mut yaml_string_t) {
}
unsafe fn READ_LINE(parser: *mut yaml_parser_t, string: *mut yaml_string_t) {
STRING_EXTEND!(parser, *string);
STRING_EXTEND!(*string);
if CHECK_AT!((*parser).buffer, b'\r', 0) && CHECK_AT!((*parser).buffer, b'\n', 1) {
*(*string).pointer = b'\n';
(*string).pointer = (*string).pointer.wrapping_offset(1);
@ -409,7 +409,7 @@ unsafe fn yaml_parser_increase_flow_level(mut parser: *mut yaml_parser_t) -> Suc
column: 0_u64,
},
};
PUSH!(parser, (*parser).simple_keys, empty_simple_key);
PUSH!((*parser).simple_keys, empty_simple_key);
if (*parser).flow_level == 2147483647 {
(*parser).error = YAML_MEMORY_ERROR;
return FAIL;
@ -441,7 +441,7 @@ unsafe fn yaml_parser_roll_indent(
return OK;
}
if ((*parser).indent as libc::c_long) < column {
PUSH!(parser, (*parser).indents, (*parser).indent);
PUSH!((*parser).indents, (*parser).indent);
if column > 2147483647_i64 {
(*parser).error = YAML_MEMORY_ERROR;
return FAIL;
@ -456,10 +456,9 @@ unsafe fn yaml_parser_roll_indent(
(*token).start_mark = mark;
(*token).end_mark = mark;
if number == -1_i64 {
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
} else {
QUEUE_INSERT!(
parser,
(*parser).tokens,
(number as libc::c_ulong).wrapping_sub((*parser).tokens_parsed),
*token
@ -484,7 +483,7 @@ unsafe fn yaml_parser_unroll_indent(mut parser: *mut yaml_parser_t, column: ptrd
(*token).type_ = YAML_BLOCK_END_TOKEN;
(*token).start_mark = (*parser).mark;
(*token).end_mark = (*parser).mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
(*parser).indent = POP!((*parser).indents);
}
OK
@ -504,7 +503,7 @@ unsafe fn yaml_parser_fetch_stream_start(mut parser: *mut yaml_parser_t) -> Succ
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
(*parser).indent = -1;
PUSH!(parser, (*parser).simple_keys, simple_key);
PUSH!((*parser).simple_keys, simple_key);
(*parser).simple_key_allowed = true;
(*parser).stream_start_produced = true;
memset(
@ -516,7 +515,7 @@ unsafe fn yaml_parser_fetch_stream_start(mut parser: *mut yaml_parser_t) -> Succ
(*token).start_mark = (*parser).mark;
(*token).end_mark = (*parser).mark;
(*token).data.stream_start.encoding = (*parser).encoding;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -543,7 +542,7 @@ unsafe fn yaml_parser_fetch_stream_end(mut parser: *mut yaml_parser_t) -> Succes
(*token).type_ = YAML_STREAM_END_TOKEN;
(*token).start_mark = (*parser).mark;
(*token).end_mark = (*parser).mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -560,7 +559,7 @@ unsafe fn yaml_parser_fetch_directive(mut parser: *mut yaml_parser_t) -> Success
if yaml_parser_scan_directive(parser, token).fail {
return FAIL;
}
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -590,7 +589,7 @@ unsafe fn yaml_parser_fetch_document_indicator(
(*token).type_ = type_;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -618,7 +617,7 @@ unsafe fn yaml_parser_fetch_flow_collection_start(
(*token).type_ = type_;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -646,7 +645,7 @@ unsafe fn yaml_parser_fetch_flow_collection_end(
(*token).type_ = type_;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -668,7 +667,7 @@ unsafe fn yaml_parser_fetch_flow_entry(mut parser: *mut yaml_parser_t) -> Succes
(*token).type_ = YAML_FLOW_ENTRY_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -713,7 +712,7 @@ unsafe fn yaml_parser_fetch_block_entry(mut parser: *mut yaml_parser_t) -> Succe
(*token).type_ = YAML_BLOCK_ENTRY_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -758,7 +757,7 @@ unsafe fn yaml_parser_fetch_key(mut parser: *mut yaml_parser_t) -> Success {
(*token).type_ = YAML_KEY_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -777,7 +776,6 @@ unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> Success {
(*token).start_mark = (*simple_key).mark;
(*token).end_mark = (*simple_key).mark;
QUEUE_INSERT!(
parser,
(*parser).tokens,
((*simple_key).token_number).wrapping_sub((*parser).tokens_parsed),
*token
@ -832,7 +830,7 @@ unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> Success {
(*token).type_ = YAML_VALUE_TOKEN;
(*token).start_mark = start_mark;
(*token).end_mark = end_mark;
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -849,7 +847,7 @@ unsafe fn yaml_parser_fetch_anchor(
if yaml_parser_scan_anchor(parser, token, type_).fail {
return FAIL;
}
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -863,7 +861,7 @@ unsafe fn yaml_parser_fetch_tag(mut parser: *mut yaml_parser_t) -> Success {
if yaml_parser_scan_tag(parser, token).fail {
return FAIL;
}
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -877,7 +875,7 @@ unsafe fn yaml_parser_fetch_block_scalar(mut parser: *mut yaml_parser_t, literal
if yaml_parser_scan_block_scalar(parser, token, literal).fail {
return FAIL;
}
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -891,7 +889,7 @@ unsafe fn yaml_parser_fetch_flow_scalar(mut parser: *mut yaml_parser_t, single:
if yaml_parser_scan_flow_scalar(parser, token, single).fail {
return FAIL;
}
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -905,7 +903,7 @@ unsafe fn yaml_parser_fetch_plain_scalar(mut parser: *mut yaml_parser_t) -> Succ
if yaml_parser_scan_plain_scalar(parser, token).fail {
return FAIL;
}
ENQUEUE!(parser, (*parser).tokens, *token);
ENQUEUE!((*parser).tokens, *token);
OK
}
@ -1118,7 +1116,7 @@ unsafe fn yaml_parser_scan_directive_name(
) -> Success {
let current_block: u64;
let mut string = NULL_STRING;
STRING_INIT!(parser, string);
STRING_INIT!(string);
if CACHE(parser, 1_u64).ok {
loop {
if !IS_ALPHA!((*parser).buffer) {
@ -1348,7 +1346,7 @@ unsafe fn yaml_parser_scan_anchor(
let mut length: libc::c_int = 0;
let end_mark: yaml_mark_t;
let mut string = NULL_STRING;
STRING_INIT!(parser, string);
STRING_INIT!(string);
let start_mark: yaml_mark_t = (*parser).mark;
SKIP(parser);
if CACHE(parser, 1_u64).ok {
@ -1563,7 +1561,7 @@ unsafe fn yaml_parser_scan_tag_handle(
) -> Success {
let mut current_block: u64;
let mut string = NULL_STRING;
STRING_INIT!(parser, string);
STRING_INIT!(string);
if CACHE(parser, 1_u64).ok {
if !CHECK!((*parser).buffer, b'!') {
yaml_parser_set_scanner_error(
@ -1642,7 +1640,7 @@ unsafe fn yaml_parser_scan_tag_uri(
0_u64
};
let mut string = NULL_STRING;
STRING_INIT!(parser, string);
STRING_INIT!(string);
current_block = 14916268686031723178;
'c_21953: loop {
match current_block {
@ -1698,7 +1696,7 @@ unsafe fn yaml_parser_scan_tag_uri(
|| CHECK!((*parser).buffer, b']'))
{
if CHECK!((*parser).buffer, b'%') {
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
if yaml_parser_scan_uri_escapes(
parser,
directive,
@ -1720,7 +1718,7 @@ unsafe fn yaml_parser_scan_tag_uri(
}
}
if length == 0 {
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
yaml_parser_set_scanner_error(
parser,
if directive {
@ -1840,9 +1838,9 @@ unsafe fn yaml_parser_scan_block_scalar(
let mut indent: libc::c_int = 0;
let mut leading_blank: libc::c_int = 0;
let mut trailing_blank: libc::c_int;
STRING_INIT!(parser, string);
STRING_INIT!(parser, leading_break);
STRING_INIT!(parser, trailing_breaks);
STRING_INIT!(string);
STRING_INIT!(leading_break);
STRING_INIT!(trailing_breaks);
let start_mark: yaml_mark_t = (*parser).mark;
SKIP(parser);
if CACHE(parser, 1_u64).ok {
@ -1999,7 +1997,7 @@ unsafe fn yaml_parser_scan_block_scalar(
&& trailing_blank == 0
{
if *trailing_breaks.start == b'\0' {
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
let fresh418 = string.pointer;
string.pointer = string
.pointer
@ -2008,14 +2006,10 @@ unsafe fn yaml_parser_scan_block_scalar(
}
CLEAR!(leading_break);
} else {
JOIN!(
parser,
string,
leading_break
);
JOIN!(string, leading_break);
CLEAR!(leading_break);
}
JOIN!(parser, string, trailing_breaks);
JOIN!(string, trailing_breaks);
CLEAR!(trailing_breaks);
leading_blank =
IS_BLANK!((*parser).buffer)
@ -2052,11 +2046,7 @@ unsafe fn yaml_parser_scan_block_scalar(
14984465786483313892 => {}
_ => {
if chomping != -1 {
JOIN!(
parser,
string,
leading_break
);
JOIN!(string, leading_break);
current_block =
17787701279558130514;
} else {
@ -2068,7 +2058,6 @@ unsafe fn yaml_parser_scan_block_scalar(
_ => {
if chomping == 1 {
JOIN!(
parser,
string,
trailing_breaks
);
@ -2199,10 +2188,10 @@ unsafe fn yaml_parser_scan_flow_scalar(
let mut trailing_breaks = NULL_STRING;
let mut whitespaces = NULL_STRING;
let mut leading_blanks: libc::c_int;
STRING_INIT!(parser, string);
STRING_INIT!(parser, leading_break);
STRING_INIT!(parser, trailing_breaks);
STRING_INIT!(parser, whitespaces);
STRING_INIT!(string);
STRING_INIT!(leading_break);
STRING_INIT!(trailing_breaks);
STRING_INIT!(whitespaces);
let start_mark: yaml_mark_t = (*parser).mark;
SKIP(parser);
's_58: loop {
@ -2247,7 +2236,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
&& CHECK_AT!((*parser).buffer, b'\'', 0)
&& CHECK_AT!((*parser).buffer, b'\'', 1)
{
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
let fresh521 = string.pointer;
string.pointer = string.pointer.wrapping_offset(1);
*fresh521 = b'\'';
@ -2271,7 +2260,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
break;
} else if !single && CHECK!((*parser).buffer, b'\\') {
let mut code_length: size_t = 0_u64;
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
match *(*parser).buffer.pointer.wrapping_offset(1_isize) {
48 => {
let fresh542 = string.pointer;
@ -2535,23 +2524,23 @@ unsafe fn yaml_parser_scan_flow_scalar(
if leading_blanks != 0 {
if *leading_break.start == b'\n' {
if *trailing_breaks.start == b'\0' {
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
let fresh711 = string.pointer;
string.pointer = string.pointer.wrapping_offset(1);
*fresh711 = b' ';
} else {
JOIN!(parser, string, trailing_breaks);
JOIN!(string, trailing_breaks);
CLEAR!(trailing_breaks);
}
CLEAR!(leading_break);
} else {
JOIN!(parser, string, leading_break);
JOIN!(parser, string, trailing_breaks);
JOIN!(string, leading_break);
JOIN!(string, trailing_breaks);
CLEAR!(leading_break);
CLEAR!(trailing_breaks);
}
} else {
JOIN!(parser, string, whitespaces);
JOIN!(string, whitespaces);
CLEAR!(whitespaces);
}
}
@ -2603,10 +2592,10 @@ unsafe fn yaml_parser_scan_plain_scalar(
let mut whitespaces = NULL_STRING;
let mut leading_blanks: libc::c_int = 0;
let indent: libc::c_int = (*parser).indent + 1;
STRING_INIT!(parser, string);
STRING_INIT!(parser, leading_break);
STRING_INIT!(parser, trailing_breaks);
STRING_INIT!(parser, whitespaces);
STRING_INIT!(string);
STRING_INIT!(leading_break);
STRING_INIT!(trailing_breaks);
STRING_INIT!(whitespaces);
end_mark = (*parser).mark;
let start_mark: yaml_mark_t = end_mark;
's_57: loop {
@ -2663,24 +2652,24 @@ unsafe fn yaml_parser_scan_plain_scalar(
if leading_blanks != 0 {
if *leading_break.start == b'\n' {
if *trailing_breaks.start == b'\0' {
STRING_EXTEND!(parser, string);
STRING_EXTEND!(string);
let fresh717 = string.pointer;
string.pointer = string.pointer.wrapping_offset(1);
*fresh717 = b' ';
} else {
JOIN!(parser, string, trailing_breaks);
JOIN!(string, trailing_breaks);
CLEAR!(trailing_breaks);
}
CLEAR!(leading_break);
} else {
JOIN!(parser, string, leading_break);
JOIN!(parser, string, trailing_breaks);
JOIN!(string, leading_break);
JOIN!(string, trailing_breaks);
CLEAR!(leading_break);
CLEAR!(trailing_breaks);
}
leading_blanks = 0;
} else {
JOIN!(parser, string, whitespaces);
JOIN!(string, whitespaces);
CLEAR!(whitespaces);
}
}