mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-26 05:10:20 +00:00
Rustify error propagation (try operator "?")
This commit is contained in:
parent
dc639b92b5
commit
8e7adf6206
7 changed files with 264 additions and 709 deletions
14
src/api.rs
14
src/api.rs
|
@ -748,9 +748,7 @@ pub unsafe fn yaml_alias_event_initialize(
|
|||
};
|
||||
__assert!(!event.is_null());
|
||||
__assert!(!anchor.is_null());
|
||||
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char))?;
|
||||
let anchor_copy: *mut yaml_char_t = yaml_strdup(anchor);
|
||||
if anchor_copy.is_null() {
|
||||
return FAIL;
|
||||
|
@ -829,7 +827,7 @@ pub unsafe fn yaml_scalar_event_initialize(
|
|||
if length < 0 {
|
||||
length = strlen(value as *mut libc::c_char) as libc::c_int;
|
||||
}
|
||||
if yaml_check_utf8(value, length as size_t).is_ok() {
|
||||
if let Ok(()) = yaml_check_utf8(value, length as size_t) {
|
||||
value_copy = yaml_malloc(length.force_add(1) as size_t) as *mut yaml_char_t;
|
||||
memcpy(
|
||||
value_copy as *mut libc::c_void,
|
||||
|
@ -1330,13 +1328,13 @@ pub unsafe fn yaml_document_add_scalar(
|
|||
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;
|
||||
}
|
||||
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).is_ok() {
|
||||
if let Ok(()) = yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) {
|
||||
tag_copy = yaml_strdup(tag);
|
||||
if !tag_copy.is_null() {
|
||||
if length < 0 {
|
||||
length = strlen(value as *mut libc::c_char) as libc::c_int;
|
||||
}
|
||||
if yaml_check_utf8(value, length as size_t).is_ok() {
|
||||
if let Ok(()) = yaml_check_utf8(value, length as size_t) {
|
||||
value_copy = yaml_malloc(length.force_add(1) as size_t) as *mut yaml_char_t;
|
||||
memcpy(
|
||||
value_copy as *mut libc::c_void,
|
||||
|
@ -1399,7 +1397,7 @@ pub unsafe fn yaml_document_add_sequence(
|
|||
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;
|
||||
}
|
||||
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).is_ok() {
|
||||
if let Ok(()) = yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) {
|
||||
tag_copy = yaml_strdup(tag);
|
||||
if !tag_copy.is_null() {
|
||||
STACK_INIT!(items, yaml_node_item_t);
|
||||
|
@ -1458,7 +1456,7 @@ pub unsafe fn yaml_document_add_mapping(
|
|||
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;
|
||||
}
|
||||
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)).is_ok() {
|
||||
if let Ok(()) = yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) {
|
||||
tag_copy = yaml_strdup(tag);
|
||||
if !tag_copy.is_null() {
|
||||
STACK_INIT!(pairs, yaml_node_pair_t);
|
||||
|
|
|
@ -36,9 +36,7 @@ pub unsafe fn yaml_emitter_open(emitter: *mut yaml_emitter_t) -> Result<(), ()>
|
|||
(*event).start_mark = mark;
|
||||
(*event).end_mark = mark;
|
||||
(*event).data.stream_start.encoding = YAML_ANY_ENCODING;
|
||||
if yaml_emitter_emit(emitter, event).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_emitter_emit(emitter, event)?;
|
||||
(*emitter).opened = true;
|
||||
OK
|
||||
}
|
||||
|
@ -67,9 +65,7 @@ pub unsafe fn yaml_emitter_close(emitter: *mut yaml_emitter_t) -> Result<(), ()>
|
|||
(*event).type_ = YAML_STREAM_END_EVENT;
|
||||
(*event).start_mark = mark;
|
||||
(*event).end_mark = mark;
|
||||
if yaml_emitter_emit(emitter, event).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_emitter_emit(emitter, event)?;
|
||||
(*emitter).closed = true;
|
||||
OK
|
||||
}
|
||||
|
@ -108,7 +104,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
match current_block {
|
||||
15619007995458559411 => {
|
||||
if STACK_EMPTY!((*document).nodes) {
|
||||
if yaml_emitter_close(emitter).is_ok() {
|
||||
if let Ok(()) = yaml_emitter_close(emitter) {
|
||||
yaml_emitter_delete_document_and_anchors(emitter);
|
||||
return OK;
|
||||
}
|
||||
|
@ -140,9 +136,9 @@ pub unsafe fn yaml_emitter_dump(
|
|||
(*document).tag_directives.start;
|
||||
(*event).data.document_start.tag_directives.end = (*document).tag_directives.end;
|
||||
(*event).data.document_start.implicit = (*document).start_implicit;
|
||||
if yaml_emitter_emit(emitter, event).is_ok() {
|
||||
if let Ok(()) = yaml_emitter_emit(emitter, event) {
|
||||
yaml_emitter_anchor_node(emitter, 1);
|
||||
if yaml_emitter_dump_node(emitter, 1).is_ok() {
|
||||
if let Ok(()) = yaml_emitter_dump_node(emitter, 1) {
|
||||
memset(
|
||||
event as *mut libc::c_void,
|
||||
0,
|
||||
|
@ -152,7 +148,7 @@ pub unsafe fn yaml_emitter_dump(
|
|||
(*event).start_mark = mark;
|
||||
(*event).end_mark = mark;
|
||||
(*event).data.document_end.implicit = (*document).end_implicit;
|
||||
if yaml_emitter_emit(emitter, event).is_ok() {
|
||||
if let Ok(()) = yaml_emitter_emit(emitter, event) {
|
||||
yaml_emitter_delete_document_and_anchors(emitter);
|
||||
return OK;
|
||||
}
|
||||
|
@ -378,14 +374,10 @@ unsafe fn yaml_emitter_dump_sequence(
|
|||
(*event).data.sequence_start.tag = (*node).tag;
|
||||
(*event).data.sequence_start.implicit = implicit;
|
||||
(*event).data.sequence_start.style = (*node).data.sequence.style;
|
||||
if yaml_emitter_emit(emitter, event).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_emitter_emit(emitter, event)?;
|
||||
item = (*node).data.sequence.items.start;
|
||||
while item < (*node).data.sequence.items.top {
|
||||
if yaml_emitter_dump_node(emitter, *item).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_emitter_dump_node(emitter, *item)?;
|
||||
item = item.wrapping_offset(1);
|
||||
}
|
||||
memset(
|
||||
|
@ -428,17 +420,11 @@ unsafe fn yaml_emitter_dump_mapping(
|
|||
(*event).data.mapping_start.tag = (*node).tag;
|
||||
(*event).data.mapping_start.implicit = implicit;
|
||||
(*event).data.mapping_start.style = (*node).data.mapping.style;
|
||||
if yaml_emitter_emit(emitter, event).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_emitter_emit(emitter, event)?;
|
||||
pair = (*node).data.mapping.pairs.start;
|
||||
while pair < (*node).data.mapping.pairs.top {
|
||||
if yaml_emitter_dump_node(emitter, (*pair).key).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
if yaml_emitter_dump_node(emitter, (*pair).value).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_emitter_dump_node(emitter, (*pair).key)?;
|
||||
yaml_emitter_dump_node(emitter, (*pair).value)?;
|
||||
pair = pair.wrapping_offset(1);
|
||||
}
|
||||
memset(
|
||||
|
|
775
src/emitter.rs
775
src/emitter.rs
File diff suppressed because it is too large
Load diff
|
@ -50,7 +50,7 @@ pub unsafe fn yaml_parser_load(
|
|||
);
|
||||
STACK_INIT!((*document).nodes, yaml_node_t);
|
||||
if !(*parser).stream_start_produced {
|
||||
if yaml_parser_parse(parser, event).is_err() {
|
||||
if let Err(()) = yaml_parser_parse(parser, event) {
|
||||
current_block = 6234624449317607669;
|
||||
} else {
|
||||
__assert!((*event).type_ == YAML_STREAM_START_EVENT);
|
||||
|
@ -63,14 +63,14 @@ pub unsafe fn yaml_parser_load(
|
|||
if (*parser).stream_end_produced {
|
||||
return OK;
|
||||
}
|
||||
if yaml_parser_parse(parser, event).is_ok() {
|
||||
if let Ok(()) = yaml_parser_parse(parser, event) {
|
||||
if (*event).type_ == YAML_STREAM_END_EVENT {
|
||||
return OK;
|
||||
}
|
||||
STACK_INIT!((*parser).aliases, yaml_alias_data_t);
|
||||
let fresh6 = addr_of_mut!((*parser).document);
|
||||
*fresh6 = document;
|
||||
if yaml_parser_load_document(parser, event).is_ok() {
|
||||
if let Ok(()) = yaml_parser_load_document(parser, event) {
|
||||
yaml_parser_delete_aliases(parser);
|
||||
let fresh7 = addr_of_mut!((*parser).document);
|
||||
*fresh7 = ptr::null_mut::<yaml_document_t>();
|
||||
|
@ -140,7 +140,7 @@ unsafe fn yaml_parser_load_document(
|
|||
(*(*parser).document).start_implicit = (*event).data.document_start.implicit;
|
||||
(*(*parser).document).start_mark = (*event).start_mark;
|
||||
STACK_INIT!(ctx, libc::c_int);
|
||||
if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)).is_err() {
|
||||
if let Err(()) = yaml_parser_load_nodes(parser, addr_of_mut!(ctx)) {
|
||||
STACK_DEL!(ctx);
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -155,39 +155,25 @@ unsafe fn yaml_parser_load_nodes(
|
|||
let mut event = MaybeUninit::<yaml_event_t>::uninit();
|
||||
let event = event.as_mut_ptr();
|
||||
loop {
|
||||
if yaml_parser_parse(parser, event).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_parse(parser, event)?;
|
||||
match (*event).type_ {
|
||||
YAML_ALIAS_EVENT => {
|
||||
if yaml_parser_load_alias(parser, event, ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_load_alias(parser, event, ctx)?;
|
||||
}
|
||||
YAML_SCALAR_EVENT => {
|
||||
if yaml_parser_load_scalar(parser, event, ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_load_scalar(parser, event, ctx)?;
|
||||
}
|
||||
YAML_SEQUENCE_START_EVENT => {
|
||||
if yaml_parser_load_sequence(parser, event, ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_load_sequence(parser, event, ctx)?;
|
||||
}
|
||||
YAML_SEQUENCE_END_EVENT => {
|
||||
if yaml_parser_load_sequence_end(parser, event, ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_load_sequence_end(parser, event, ctx)?;
|
||||
}
|
||||
YAML_MAPPING_START_EVENT => {
|
||||
if yaml_parser_load_mapping(parser, event, ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_load_mapping(parser, event, ctx)?;
|
||||
}
|
||||
YAML_MAPPING_END_EVENT => {
|
||||
if yaml_parser_load_mapping_end(parser, event, ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_load_mapping_end(parser, event, ctx)?;
|
||||
}
|
||||
YAML_DOCUMENT_END_EVENT => {}
|
||||
_ => {
|
||||
|
@ -258,9 +244,7 @@ unsafe fn yaml_parser_load_node_add(
|
|||
let current_block_17: u64;
|
||||
match (*parent).type_ {
|
||||
YAML_SEQUENCE_NODE => {
|
||||
if STACK_LIMIT!(parser, (*parent).data.sequence.items).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
STACK_LIMIT!(parser, (*parent).data.sequence.items)?;
|
||||
PUSH!((*parent).data.sequence.items, index);
|
||||
}
|
||||
YAML_MAPPING_NODE => {
|
||||
|
@ -283,9 +267,7 @@ unsafe fn yaml_parser_load_node_add(
|
|||
_ => {
|
||||
(*pair).key = index;
|
||||
(*pair).value = 0;
|
||||
if STACK_LIMIT!(parser, (*parent).data.mapping.pairs).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
STACK_LIMIT!(parser, (*parent).data.mapping.pairs)?;
|
||||
PUSH!((*parent).data.mapping.pairs, *pair);
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +316,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
let node = node.as_mut_ptr();
|
||||
let index: libc::c_int;
|
||||
let mut tag: *mut yaml_char_t = (*event).data.scalar.tag;
|
||||
if STACK_LIMIT!(parser, (*(*parser).document).nodes).is_ok() {
|
||||
if let Ok(()) = STACK_LIMIT!(parser, (*(*parser).document).nodes) {
|
||||
if tag.is_null()
|
||||
|| strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
|
@ -372,9 +354,7 @@ unsafe fn yaml_parser_load_scalar(
|
|||
.top
|
||||
.c_offset_from((*(*parser).document).nodes.start)
|
||||
as libc::c_int;
|
||||
if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor)?;
|
||||
return yaml_parser_load_node_add(parser, ctx, index);
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +384,7 @@ unsafe fn yaml_parser_load_sequence(
|
|||
};
|
||||
let index: libc::c_int;
|
||||
let mut tag: *mut yaml_char_t = (*event).data.sequence_start.tag;
|
||||
if STACK_LIMIT!(parser, (*(*parser).document).nodes).is_ok() {
|
||||
if let Ok(()) = STACK_LIMIT!(parser, (*(*parser).document).nodes) {
|
||||
if tag.is_null()
|
||||
|| strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
|
@ -444,17 +424,9 @@ unsafe fn yaml_parser_load_sequence(
|
|||
.top
|
||||
.c_offset_from((*(*parser).document).nodes.start)
|
||||
as libc::c_int;
|
||||
if yaml_parser_register_anchor(parser, index, (*event).data.sequence_start.anchor)
|
||||
.is_err()
|
||||
{
|
||||
return FAIL;
|
||||
}
|
||||
if yaml_parser_load_node_add(parser, ctx, index).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
if STACK_LIMIT!(parser, *ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_register_anchor(parser, index, (*event).data.sequence_start.anchor)?;
|
||||
yaml_parser_load_node_add(parser, ctx, index)?;
|
||||
STACK_LIMIT!(parser, *ctx)?;
|
||||
PUSH!(*ctx, index);
|
||||
return OK;
|
||||
}
|
||||
|
@ -504,7 +476,7 @@ unsafe fn yaml_parser_load_mapping(
|
|||
};
|
||||
let index: libc::c_int;
|
||||
let mut tag: *mut yaml_char_t = (*event).data.mapping_start.tag;
|
||||
if STACK_LIMIT!(parser, (*(*parser).document).nodes).is_ok() {
|
||||
if let Ok(()) = STACK_LIMIT!(parser, (*(*parser).document).nodes) {
|
||||
if tag.is_null()
|
||||
|| strcmp(
|
||||
tag as *mut libc::c_char,
|
||||
|
@ -544,17 +516,9 @@ unsafe fn yaml_parser_load_mapping(
|
|||
.top
|
||||
.c_offset_from((*(*parser).document).nodes.start)
|
||||
as libc::c_int;
|
||||
if yaml_parser_register_anchor(parser, index, (*event).data.mapping_start.anchor)
|
||||
.is_err()
|
||||
{
|
||||
return FAIL;
|
||||
}
|
||||
if yaml_parser_load_node_add(parser, ctx, index).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
if STACK_LIMIT!(parser, *ctx).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_register_anchor(parser, index, (*event).data.mapping_start.anchor)?;
|
||||
yaml_parser_load_node_add(parser, ctx, index)?;
|
||||
STACK_LIMIT!(parser, *ctx)?;
|
||||
PUSH!(*ctx, index);
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -241,16 +241,12 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
&& (*token).type_ != YAML_DOCUMENT_START_TOKEN
|
||||
&& (*token).type_ != YAML_STREAM_END_TOKEN
|
||||
{
|
||||
if yaml_parser_process_directives(
|
||||
yaml_parser_process_directives(
|
||||
parser,
|
||||
ptr::null_mut::<*mut yaml_version_directive_t>(),
|
||||
ptr::null_mut::<*mut yaml_tag_directive_t>(),
|
||||
ptr::null_mut::<*mut yaml_tag_directive_t>(),
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
return FAIL;
|
||||
}
|
||||
)?;
|
||||
PUSH!((*parser).states, YAML_PARSE_DOCUMENT_END_STATE);
|
||||
(*parser).state = YAML_PARSE_BLOCK_NODE_STATE;
|
||||
memset(
|
||||
|
@ -272,16 +268,12 @@ unsafe fn yaml_parser_parse_document_start(
|
|||
} else if (*token).type_ != YAML_STREAM_END_TOKEN {
|
||||
let end_mark: yaml_mark_t;
|
||||
let start_mark: yaml_mark_t = (*token).start_mark;
|
||||
if yaml_parser_process_directives(
|
||||
yaml_parser_process_directives(
|
||||
parser,
|
||||
addr_of_mut!(version_directive),
|
||||
addr_of_mut!(tag_directives.start),
|
||||
addr_of_mut!(tag_directives.end),
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
return FAIL;
|
||||
}
|
||||
)?;
|
||||
token = PEEK_TOKEN(parser);
|
||||
if !token.is_null() {
|
||||
if (*token).type_ != YAML_DOCUMENT_START_TOKEN {
|
||||
|
@ -1254,8 +1246,8 @@ unsafe fn yaml_parser_process_directives(
|
|||
handle: (*token).data.tag_directive.handle,
|
||||
prefix: (*token).data.tag_directive.prefix,
|
||||
};
|
||||
if yaml_parser_append_tag_directive(parser, value, false, (*token).start_mark)
|
||||
.is_err()
|
||||
if let Err(()) =
|
||||
yaml_parser_append_tag_directive(parser, value, false, (*token).start_mark)
|
||||
{
|
||||
current_block = 17143798186130252483;
|
||||
break;
|
||||
|
@ -1276,14 +1268,12 @@ unsafe fn yaml_parser_process_directives(
|
|||
current_block = 18377268871191777778;
|
||||
break;
|
||||
}
|
||||
if yaml_parser_append_tag_directive(
|
||||
if let Err(()) = yaml_parser_append_tag_directive(
|
||||
parser,
|
||||
*default_tag_directive,
|
||||
true,
|
||||
(*token).start_mark,
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
) {
|
||||
current_block = 17143798186130252483;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -34,9 +34,7 @@ unsafe fn yaml_parser_determine_encoding(parser: *mut yaml_parser_t) -> Result<(
|
|||
.c_offset_from((*parser).raw_buffer.pointer) as libc::c_long)
|
||||
< 3_i64
|
||||
{
|
||||
if yaml_parser_update_raw_buffer(parser).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_update_raw_buffer(parser)?;
|
||||
}
|
||||
if (*parser)
|
||||
.raw_buffer
|
||||
|
@ -162,9 +160,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
return OK;
|
||||
}
|
||||
if (*parser).encoding == YAML_ANY_ENCODING {
|
||||
if yaml_parser_determine_encoding(parser).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_determine_encoding(parser)?;
|
||||
}
|
||||
if (*parser).buffer.start < (*parser).buffer.pointer
|
||||
&& (*parser).buffer.pointer < (*parser).buffer.last
|
||||
|
@ -190,9 +186,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
|
|||
}
|
||||
while (*parser).unread < length {
|
||||
if !first || (*parser).raw_buffer.pointer == (*parser).raw_buffer.last {
|
||||
if yaml_parser_update_raw_buffer(parser).is_err() {
|
||||
return FAIL;
|
||||
}
|
||||
yaml_parser_update_raw_buffer(parser)?;
|
||||
}
|
||||
first = false;
|
||||
while (*parser).raw_buffer.pointer != (*parser).raw_buffer.last {
|
||||
|
|
|
@ -954,7 +954,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
let mut prefix: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
if yaml_parser_scan_directive_name(parser, start_mark, addr_of_mut!(name)).is_ok() {
|
||||
if let Ok(()) = yaml_parser_scan_directive_name(parser, start_mark, addr_of_mut!(name)) {
|
||||
if strcmp(
|
||||
name as *mut libc::c_char,
|
||||
b"YAML\0" as *const u8 as *const libc::c_char,
|
||||
|
@ -1023,7 +1023,7 @@ unsafe fn yaml_parser_scan_directive(
|
|||
current_block = 11397968426844348457;
|
||||
}
|
||||
if current_block != 11397968426844348457 {
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
loop {
|
||||
if !IS_BLANK!((*parser).buffer) {
|
||||
current_block = 11584701595673473500;
|
||||
|
@ -1095,7 +1095,7 @@ unsafe fn yaml_parser_scan_directive_name(
|
|||
let current_block: u64;
|
||||
let mut string = NULL_STRING;
|
||||
STRING_INIT!(string);
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
loop {
|
||||
if !IS_ALPHA!((*parser).buffer) {
|
||||
current_block = 10879442775620481940;
|
||||
|
@ -1320,7 +1320,7 @@ unsafe fn yaml_parser_scan_anchor(
|
|||
STRING_INIT!(string);
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
loop {
|
||||
if !IS_ALPHA!((*parser).buffer) {
|
||||
current_block = 2868539653012386629;
|
||||
|
@ -1398,7 +1398,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
let mut suffix: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
|
||||
let end_mark: yaml_mark_t;
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
if CACHE(parser, 2_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 2_u64) {
|
||||
if CHECK_AT!((*parser).buffer, b'<', 1) {
|
||||
handle = yaml_malloc(1_u64) as *mut yaml_char_t;
|
||||
*handle = b'\0';
|
||||
|
@ -1475,7 +1475,7 @@ unsafe fn yaml_parser_scan_tag(
|
|||
current_block = 4488286894823169796;
|
||||
}
|
||||
if current_block != 17708497480799081542 {
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
if !IS_BLANKZ!((*parser).buffer) {
|
||||
if (*parser).flow_level == 0 || !CHECK!((*parser).buffer, b',') {
|
||||
yaml_parser_set_scanner_error(
|
||||
|
@ -1525,7 +1525,7 @@ unsafe fn yaml_parser_scan_tag_handle(
|
|||
let mut current_block: u64;
|
||||
let mut string = NULL_STRING;
|
||||
STRING_INIT!(string);
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
if !CHECK!((*parser).buffer, b'!') {
|
||||
yaml_parser_set_scanner_error(
|
||||
parser,
|
||||
|
@ -1539,7 +1539,7 @@ unsafe fn yaml_parser_scan_tag_handle(
|
|||
);
|
||||
} else {
|
||||
READ!(parser, string);
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
loop {
|
||||
if !IS_ALPHA!((*parser).buffer) {
|
||||
current_block = 7651349459974463963;
|
||||
|
@ -1799,7 +1799,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
STRING_INIT!(trailing_breaks);
|
||||
let start_mark: yaml_mark_t = (*parser).mark;
|
||||
SKIP(parser);
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
if CHECK!((*parser).buffer, b'+') || CHECK!((*parser).buffer, b'-') {
|
||||
chomping = if CHECK!((*parser).buffer, b'+') {
|
||||
1
|
||||
|
@ -1858,7 +1858,7 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
current_block = 11913429853522160501;
|
||||
}
|
||||
if current_block != 14984465786483313892 {
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
loop {
|
||||
if !IS_BLANK!((*parser).buffer) {
|
||||
current_block = 4090602189656566074;
|
||||
|
@ -1916,16 +1916,14 @@ unsafe fn yaml_parser_scan_block_scalar(
|
|||
increment
|
||||
};
|
||||
}
|
||||
if yaml_parser_scan_block_scalar_breaks(
|
||||
if let Ok(()) = yaml_parser_scan_block_scalar_breaks(
|
||||
parser,
|
||||
addr_of_mut!(indent),
|
||||
addr_of_mut!(trailing_breaks),
|
||||
start_mark,
|
||||
addr_of_mut!(end_mark),
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
if CACHE(parser, 1_u64).is_ok() {
|
||||
) {
|
||||
if let Ok(()) = CACHE(parser, 1_u64) {
|
||||
's_281: loop {
|
||||
if !((*parser).mark.column as libc::c_int == indent
|
||||
&& !IS_Z!((*parser).buffer))
|
||||
|
|
Loading…
Reference in a new issue