Remove ParialEq<i32> from Success

Generated with the assistance of:

    sed -i 's/) == 0\b/) == Zero/' src/*.rs
    sed -i 's/) != 0\b/) != Zero/' src/*.rs
This commit is contained in:
David Tolnay 2022-07-23 12:41:09 -07:00
parent a69723b2d8
commit c47432e38b
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
9 changed files with 436 additions and 430 deletions

View file

@ -1,5 +1,5 @@
use crate::externs::{free, malloc, memcpy, memmove, memset, realloc, strdup, strlen};
use crate::success::{Success, FAIL, OK};
use crate::success::{Success, Zero, FAIL, OK};
use crate::yaml::{size_t, yaml_char_t};
use crate::{
libc, yaml_break_t, yaml_document_t, yaml_emitter_state_t, yaml_emitter_t, yaml_encoding_t,
@ -108,7 +108,7 @@ pub(crate) unsafe fn yaml_string_join(
while (*a_end).c_offset_from(*a_pointer) as libc::c_long
<= (*b_pointer).c_offset_from(*b_start) as libc::c_long
{
if yaml_string_extend(a_start, a_pointer, a_end) == 0 {
if yaml_string_extend(a_start, a_pointer, a_end) == Zero {
return FAIL;
}
}
@ -210,18 +210,18 @@ pub unsafe fn yaml_parser_initialize(parser: *mut yaml_parser_t) -> Success {
0_i32,
size_of::<yaml_parser_t>() as libc::c_ulong,
);
if !(BUFFER_INIT!(parser, (*parser).raw_buffer, INPUT_RAW_BUFFER_SIZE) == 0) {
if !(BUFFER_INIT!(parser, (*parser).buffer, INPUT_BUFFER_SIZE) == 0) {
if !(QUEUE_INIT!(parser, (*parser).tokens, yaml_token_t) == 0) {
if !(STACK_INIT!(parser, (*parser).indents, libc::c_int) == 0) {
if !(STACK_INIT!(parser, (*parser).simple_keys, yaml_simple_key_t) == 0) {
if !(STACK_INIT!(parser, (*parser).states, yaml_parser_state_t) == 0) {
if !(STACK_INIT!(parser, (*parser).marks, yaml_mark_t) == 0) {
if !(BUFFER_INIT!(parser, (*parser).raw_buffer, INPUT_RAW_BUFFER_SIZE) == Zero) {
if !(BUFFER_INIT!(parser, (*parser).buffer, INPUT_BUFFER_SIZE) == Zero) {
if !(QUEUE_INIT!(parser, (*parser).tokens, yaml_token_t) == Zero) {
if !(STACK_INIT!(parser, (*parser).indents, libc::c_int) == Zero) {
if !(STACK_INIT!(parser, (*parser).simple_keys, yaml_simple_key_t) == Zero) {
if !(STACK_INIT!(parser, (*parser).states, yaml_parser_state_t) == Zero) {
if !(STACK_INIT!(parser, (*parser).marks, yaml_mark_t) == Zero) {
if !(STACK_INIT!(
parser,
(*parser).tag_directives,
yaml_tag_directive_t
) == 0)
) == Zero)
{
return OK;
}
@ -359,13 +359,13 @@ pub unsafe fn yaml_emitter_initialize(mut emitter: *mut yaml_emitter_t) -> Succe
0_i32,
size_of::<yaml_emitter_t>() as libc::c_ulong,
);
if !(BUFFER_INIT!(emitter, (*emitter).buffer, OUTPUT_BUFFER_SIZE) == 0) {
if !(BUFFER_INIT!(emitter, (*emitter).raw_buffer, OUTPUT_RAW_BUFFER_SIZE) == 0) {
if !(STACK_INIT!(emitter, (*emitter).states, yaml_emitter_state_t) == 0) {
if !(QUEUE_INIT!(emitter, (*emitter).events, yaml_event_t) == 0) {
if !(STACK_INIT!(emitter, (*emitter).indents, libc::c_int) == 0) {
if !(BUFFER_INIT!(emitter, (*emitter).buffer, OUTPUT_BUFFER_SIZE) == Zero) {
if !(BUFFER_INIT!(emitter, (*emitter).raw_buffer, OUTPUT_RAW_BUFFER_SIZE) == Zero) {
if !(STACK_INIT!(emitter, (*emitter).states, yaml_emitter_state_t) == Zero) {
if !(QUEUE_INIT!(emitter, (*emitter).events, yaml_event_t) == Zero) {
if !(STACK_INIT!(emitter, (*emitter).indents, libc::c_int) == Zero) {
if !(STACK_INIT!(emitter, (*emitter).tag_directives, yaml_tag_directive_t)
== 0)
== Zero)
{
return OK;
}
@ -719,7 +719,7 @@ pub unsafe fn yaml_document_start_event_initialize(
addr_of_mut!(context),
tag_directives_copy,
yaml_tag_directive_t
) == 0
) == Zero
{
current_block = 14964981520188694172;
} else {
@ -734,7 +734,7 @@ pub unsafe fn yaml_document_start_event_initialize(
if yaml_check_utf8(
(*tag_directive).handle,
strlen((*tag_directive).handle as *mut libc::c_char),
) == 0
) == Zero
{
current_block = 14964981520188694172;
break;
@ -742,7 +742,7 @@ pub unsafe fn yaml_document_start_event_initialize(
if yaml_check_utf8(
(*tag_directive).prefix,
strlen((*tag_directive).prefix as *mut libc::c_char),
) == 0
) == Zero
{
current_block = 14964981520188694172;
break;
@ -753,7 +753,7 @@ pub unsafe fn yaml_document_start_event_initialize(
current_block = 14964981520188694172;
break;
}
if PUSH!(addr_of_mut!(context), tag_directives_copy, value) == 0 {
if PUSH!(addr_of_mut!(context), tag_directives_copy, value) == Zero {
current_block = 14964981520188694172;
break;
}
@ -839,7 +839,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)) == 0 {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == Zero {
return FAIL;
}
let anchor_copy: *mut yaml_char_t = yaml_strdup(anchor);
@ -888,7 +888,7 @@ pub unsafe fn yaml_scalar_event_initialize(
__assert!(!event.is_null());
__assert!(!value.is_null());
if !anchor.is_null() {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == 0 {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == Zero {
current_block = 16285396129609901221;
} else {
anchor_copy = yaml_strdup(anchor);
@ -904,7 +904,7 @@ pub unsafe fn yaml_scalar_event_initialize(
match current_block {
8515828400728868193 => {
if !tag.is_null() {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == 0 {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == Zero {
current_block = 16285396129609901221;
} else {
tag_copy = yaml_strdup(tag);
@ -923,7 +923,7 @@ pub unsafe fn yaml_scalar_event_initialize(
if length < 0_i32 {
length = strlen(value as *mut libc::c_char) as libc::c_int;
}
if !(yaml_check_utf8(value, length as size_t) == 0) {
if !(yaml_check_utf8(value, length as size_t) == Zero) {
value_copy = yaml_malloc((length + 1_i32) as size_t) as *mut yaml_char_t;
if !value_copy.is_null() {
memcpy(
@ -986,7 +986,7 @@ pub unsafe fn yaml_sequence_start_event_initialize(
let mut tag_copy: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
__assert!(!event.is_null());
if !anchor.is_null() {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == 0 {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == Zero {
current_block = 8817775685815971442;
} else {
anchor_copy = yaml_strdup(anchor);
@ -1002,7 +1002,7 @@ pub unsafe fn yaml_sequence_start_event_initialize(
match current_block {
11006700562992250127 => {
if !tag.is_null() {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == 0 {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == Zero {
current_block = 8817775685815971442;
} else {
tag_copy = yaml_strdup(tag);
@ -1084,7 +1084,7 @@ pub unsafe fn yaml_mapping_start_event_initialize(
let mut tag_copy: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
__assert!(!event.is_null());
if !anchor.is_null() {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == 0 {
if yaml_check_utf8(anchor, strlen(anchor as *mut libc::c_char)) == Zero {
current_block = 14748279734549812740;
} else {
anchor_copy = yaml_strdup(anchor);
@ -1100,7 +1100,7 @@ pub unsafe fn yaml_mapping_start_event_initialize(
match current_block {
11006700562992250127 => {
if !tag.is_null() {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == 0 {
if yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == Zero {
current_block = 14748279734549812740;
} else {
tag_copy = yaml_strdup(tag);
@ -1249,7 +1249,7 @@ pub unsafe fn yaml_document_initialize(
!tag_directives_start.is_null() && !tag_directives_end.is_null()
|| tag_directives_start == tag_directives_end
);
if !(STACK_INIT!(addr_of_mut!(context), nodes, yaml_node_t) == 0) {
if !(STACK_INIT!(addr_of_mut!(context), nodes, yaml_node_t) == Zero) {
if !version_directive.is_null() {
version_directive_copy =
yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong)
@ -1273,7 +1273,7 @@ pub unsafe fn yaml_document_initialize(
addr_of_mut!(context),
tag_directives_copy,
yaml_tag_directive_t
) == 0
) == Zero
{
current_block = 8142820162064489797;
} else {
@ -1288,7 +1288,7 @@ pub unsafe fn yaml_document_initialize(
if yaml_check_utf8(
(*tag_directive).handle,
strlen((*tag_directive).handle as *mut libc::c_char),
) == 0
) == Zero
{
current_block = 8142820162064489797;
break;
@ -1296,7 +1296,7 @@ pub unsafe fn yaml_document_initialize(
if yaml_check_utf8(
(*tag_directive).prefix,
strlen((*tag_directive).prefix as *mut libc::c_char),
) == 0
) == Zero
{
current_block = 8142820162064489797;
break;
@ -1307,7 +1307,7 @@ pub unsafe fn yaml_document_initialize(
current_block = 8142820162064489797;
break;
}
if PUSH!(addr_of_mut!(context), tag_directives_copy, value) == 0 {
if PUSH!(addr_of_mut!(context), tag_directives_copy, value) == Zero {
current_block = 8142820162064489797;
break;
}
@ -1469,13 +1469,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)) == 0) {
if !(yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == Zero) {
tag_copy = yaml_strdup(tag);
if !tag_copy.is_null() {
if length < 0_i32 {
length = strlen(value as *mut libc::c_char) as libc::c_int;
}
if !(yaml_check_utf8(value, length as size_t) == 0) {
if !(yaml_check_utf8(value, length as size_t) == Zero) {
value_copy = yaml_malloc((length + 1_i32) as size_t) as *mut yaml_char_t;
if !value_copy.is_null() {
memcpy(
@ -1496,7 +1496,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;
if !(PUSH!(addr_of_mut!(context), (*document).nodes, *node) == 0) {
if !(PUSH!(addr_of_mut!(context), (*document).nodes, *node) == Zero) {
return ((*document).nodes.top).c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_int;
}
@ -1545,10 +1545,10 @@ 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)) == 0) {
if !(yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == Zero) {
tag_copy = yaml_strdup(tag);
if !tag_copy.is_null() {
if !(STACK_INIT!(addr_of_mut!(context), items, yaml_node_item_t) == 0) {
if !(STACK_INIT!(addr_of_mut!(context), items, yaml_node_item_t) == Zero) {
memset(
node as *mut libc::c_void,
0_i32,
@ -1562,7 +1562,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;
if !(PUSH!(addr_of_mut!(context), (*document).nodes, *node) == 0) {
if !(PUSH!(addr_of_mut!(context), (*document).nodes, *node) == Zero) {
return ((*document).nodes.top).c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_int;
}
@ -1610,10 +1610,10 @@ 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)) == 0) {
if !(yaml_check_utf8(tag, strlen(tag as *mut libc::c_char)) == Zero) {
tag_copy = yaml_strdup(tag);
if !tag_copy.is_null() {
if !(STACK_INIT!(addr_of_mut!(context), pairs, yaml_node_pair_t) == 0) {
if !(STACK_INIT!(addr_of_mut!(context), pairs, yaml_node_pair_t) == Zero) {
memset(
node as *mut libc::c_void,
0_i32,
@ -1627,7 +1627,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;
if !(PUSH!(addr_of_mut!(context), (*document).nodes, *node) == 0) {
if !(PUSH!(addr_of_mut!(context), (*document).nodes, *node) == Zero) {
return ((*document).nodes.top).c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_int;
}
@ -1670,7 +1670,7 @@ pub unsafe fn yaml_document_append_sequence_item(
.sequence
.items,
item
) == 0
) == Zero
{
return FAIL;
}
@ -1713,7 +1713,7 @@ pub unsafe fn yaml_document_append_mapping_pair(
.mapping
.pairs,
pair
) == 0
) == Zero
{
return FAIL;
}

View file

@ -1,7 +1,7 @@
use crate::api::{yaml_free, yaml_malloc};
use crate::externs::{memset, strcmp};
use crate::fmt::WriteToPtr;
use crate::success::{Success, FAIL, OK};
use crate::success::{Success, Zero, FAIL, OK};
use crate::yaml::{
yaml_anchors_t, yaml_char_t, yaml_document_t, yaml_emitter_t, yaml_event_t, yaml_mark_t,
yaml_node_item_t, yaml_node_pair_t, yaml_node_t, YAML_ALIAS_EVENT, YAML_ANY_ENCODING,
@ -35,7 +35,7 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> Success {
(*event).start_mark = mark;
(*event).end_mark = mark;
(*event).data.stream_start.encoding = YAML_ANY_ENCODING;
if yaml_emitter_emit(emitter, event) == 0 {
if yaml_emitter_emit(emitter, event) == Zero {
return FAIL;
}
(*emitter).opened = 1_i32;
@ -66,7 +66,7 @@ pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> Success {
(*event).type_ = YAML_STREAM_END_EVENT;
(*event).start_mark = mark;
(*event).end_mark = mark;
if yaml_emitter_emit(emitter, event) == 0 {
if yaml_emitter_emit(emitter, event) == Zero {
return FAIL;
}
(*emitter).closed = 1_i32;
@ -96,7 +96,7 @@ pub unsafe fn yaml_emitter_dump(
let fresh0 = addr_of_mut!((*emitter).document);
*fresh0 = document;
if (*emitter).opened == 0 {
if yaml_emitter_open(emitter) == 0 {
if yaml_emitter_open(emitter) == Zero {
current_block = 5018439318894558507;
} else {
current_block = 15619007995458559411;
@ -107,7 +107,7 @@ pub unsafe fn yaml_emitter_dump(
match current_block {
15619007995458559411 => {
if STACK_EMPTY!((*document).nodes) {
if !(yaml_emitter_close(emitter) == 0) {
if !(yaml_emitter_close(emitter) == Zero) {
yaml_emitter_delete_document_and_anchors(emitter);
return OK;
}
@ -141,9 +141,9 @@ pub unsafe fn yaml_emitter_dump(
(*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) == 0) {
if !(yaml_emitter_emit(emitter, event) == Zero) {
yaml_emitter_anchor_node(emitter, 1_i32);
if !(yaml_emitter_dump_node(emitter, 1_i32) == 0) {
if !(yaml_emitter_dump_node(emitter, 1_i32) == Zero) {
memset(
event as *mut libc::c_void,
0_i32,
@ -153,7 +153,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) == 0) {
if !(yaml_emitter_emit(emitter, event) == Zero) {
yaml_emitter_delete_document_and_anchors(emitter);
return OK;
}
@ -368,12 +368,12 @@ 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) == 0 {
if yaml_emitter_emit(emitter, event) == Zero {
return FAIL;
}
item = (*node).data.sequence.items.start;
while item < (*node).data.sequence.items.top {
if yaml_emitter_dump_node(emitter, *item) == 0 {
if yaml_emitter_dump_node(emitter, *item) == Zero {
return FAIL;
}
item = item.wrapping_offset(1);
@ -386,7 +386,7 @@ unsafe fn yaml_emitter_dump_sequence(
(*event).type_ = YAML_SEQUENCE_END_EVENT;
(*event).start_mark = mark;
(*event).end_mark = mark;
if yaml_emitter_emit(emitter, event) == 0 {
if yaml_emitter_emit(emitter, event) == Zero {
return FAIL;
}
OK
@ -421,15 +421,15 @@ 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) == 0 {
if yaml_emitter_emit(emitter, event) == Zero {
return FAIL;
}
pair = (*node).data.mapping.pairs.start;
while pair < (*node).data.mapping.pairs.top {
if yaml_emitter_dump_node(emitter, (*pair).key) == 0 {
if yaml_emitter_dump_node(emitter, (*pair).key) == Zero {
return FAIL;
}
if yaml_emitter_dump_node(emitter, (*pair).value) == 0 {
if yaml_emitter_dump_node(emitter, (*pair).value) == Zero {
return FAIL;
}
pair = pair.wrapping_offset(1);
@ -442,7 +442,7 @@ unsafe fn yaml_emitter_dump_mapping(
(*event).type_ = YAML_MAPPING_END_EVENT;
(*event).start_mark = mark;
(*event).end_mark = mark;
if yaml_emitter_emit(emitter, event) == 0 {
if yaml_emitter_emit(emitter, event) == Zero {
return FAIL;
}
OK

View file

@ -1,6 +1,6 @@
use crate::api::{yaml_free, yaml_queue_extend, yaml_stack_extend, yaml_strdup};
use crate::externs::{strcmp, strlen, strncmp};
use crate::success::{Success, FAIL, OK};
use crate::success::{Success, Zero, FAIL, OK};
use crate::yaml::{size_t, yaml_char_t, yaml_string_t};
use crate::{
libc, yaml_emitter_flush, yaml_emitter_t, yaml_event_delete, yaml_event_t, yaml_scalar_style_t,
@ -24,7 +24,7 @@ use core::ptr::{self, addr_of_mut};
unsafe fn FLUSH(emitter: *mut yaml_emitter_t) -> Success {
if ((*emitter).buffer.pointer).wrapping_offset(5_isize) < (*emitter).buffer.end
|| yaml_emitter_flush(emitter) != 0
|| yaml_emitter_flush(emitter) != Zero
{
OK
} else {
@ -150,15 +150,15 @@ pub unsafe fn yaml_emitter_emit(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
if ENQUEUE!(emitter, (*emitter).events, *event) == 0 {
if ENQUEUE!(emitter, (*emitter).events, *event) == Zero {
yaml_event_delete(event);
return FAIL;
}
while yaml_emitter_need_more_events(emitter) == 0 {
if yaml_emitter_analyze_event(emitter, (*emitter).events.head) == 0 {
while yaml_emitter_need_more_events(emitter) == Zero {
if yaml_emitter_analyze_event(emitter, (*emitter).events.head) == Zero {
return FAIL;
}
if yaml_emitter_state_machine(emitter, (*emitter).events.head) == 0 {
if yaml_emitter_state_machine(emitter, (*emitter).events.head) == Zero {
return FAIL;
}
yaml_event_delete(addr_of_mut!(DEQUEUE!((*emitter).events)));
@ -233,7 +233,7 @@ unsafe fn yaml_emitter_append_tag_directive(
copy.prefix = yaml_strdup(value.prefix);
if copy.handle.is_null() || copy.prefix.is_null() {
(*emitter).error = YAML_MEMORY_ERROR;
} else if !(PUSH!(emitter, (*emitter).tag_directives, copy) == 0) {
} else if !(PUSH!(emitter, (*emitter).tag_directives, copy) == Zero) {
return OK;
}
yaml_free(copy.handle as *mut libc::c_void);
@ -246,7 +246,7 @@ unsafe fn yaml_emitter_increase_indent(
flow: libc::c_int,
indentless: libc::c_int,
) -> Success {
if PUSH!(emitter, (*emitter).indents, (*emitter).indent) == 0 {
if PUSH!(emitter, (*emitter).indents, (*emitter).indent) == Zero {
return FAIL;
}
if (*emitter).indent < 0_i32 {
@ -346,7 +346,7 @@ unsafe fn yaml_emitter_emit_stream_start(
(*emitter).indention = 1_i32;
if (*emitter).encoding as libc::c_uint != YAML_UTF8_ENCODING as libc::c_int as libc::c_uint
{
if yaml_emitter_write_bom(emitter) == 0 {
if yaml_emitter_write_bom(emitter) == Zero {
return FAIL;
}
}
@ -386,24 +386,24 @@ unsafe fn yaml_emitter_emit_document_start(
if yaml_emitter_analyze_version_directive(
emitter,
*(*event).data.document_start.version_directive,
) == 0
) == Zero
{
return FAIL;
}
}
tag_directive = (*event).data.document_start.tag_directives.start;
while tag_directive != (*event).data.document_start.tag_directives.end {
if yaml_emitter_analyze_tag_directive(emitter, *tag_directive) == 0 {
if yaml_emitter_analyze_tag_directive(emitter, *tag_directive) == Zero {
return FAIL;
}
if yaml_emitter_append_tag_directive(emitter, *tag_directive, 0_i32) == 0 {
if yaml_emitter_append_tag_directive(emitter, *tag_directive, 0_i32) == Zero {
return FAIL;
}
tag_directive = tag_directive.wrapping_offset(1);
}
tag_directive = default_tag_directives.as_mut_ptr();
while !((*tag_directive).handle).is_null() {
if yaml_emitter_append_tag_directive(emitter, *tag_directive, 1_i32) == 0 {
if yaml_emitter_append_tag_directive(emitter, *tag_directive, 1_i32) == Zero {
return FAIL;
}
tag_directive = tag_directive.wrapping_offset(1);
@ -423,11 +423,11 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -440,7 +440,7 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -451,7 +451,7 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -461,11 +461,11 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -481,7 +481,7 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -489,7 +489,7 @@ unsafe fn yaml_emitter_emit_document_start(
emitter,
(*tag_directive).handle,
strlen((*tag_directive).handle as *mut libc::c_char),
) == 0
) == Zero
{
return FAIL;
}
@ -498,11 +498,11 @@ unsafe fn yaml_emitter_emit_document_start(
(*tag_directive).prefix,
strlen((*tag_directive).prefix as *mut libc::c_char),
1_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
tag_directive = tag_directive.wrapping_offset(1);
@ -512,7 +512,7 @@ unsafe fn yaml_emitter_emit_document_start(
implicit = 0_i32;
}
if implicit == 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
if yaml_emitter_write_indicator(
@ -521,12 +521,12 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if (*emitter).canonical != 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -543,16 +543,16 @@ unsafe fn yaml_emitter_emit_document_start(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
(*emitter).open_ended = 0_i32;
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
if yaml_emitter_flush(emitter) == 0 {
if yaml_emitter_flush(emitter) == Zero {
return FAIL;
}
(*emitter).state = YAML_EMIT_END_STATE;
@ -568,7 +568,7 @@ unsafe fn yaml_emitter_emit_document_content(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
if PUSH!(emitter, (*emitter).states, YAML_EMIT_DOCUMENT_END_STATE) == 0 {
if PUSH!(emitter, (*emitter).states, YAML_EMIT_DOCUMENT_END_STATE) == Zero {
return FAIL;
}
yaml_emitter_emit_node(emitter, event, 1_i32, 0_i32, 0_i32, 0_i32)
@ -579,7 +579,7 @@ unsafe fn yaml_emitter_emit_document_end(
event: *mut yaml_event_t,
) -> Success {
if (*event).type_ as libc::c_uint == YAML_DOCUMENT_END_EVENT as libc::c_int as libc::c_uint {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
if (*event).data.document_end.implicit == 0 {
@ -589,18 +589,18 @@ unsafe fn yaml_emitter_emit_document_end(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
(*emitter).open_ended = 0_i32;
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
} else if (*emitter).open_ended == 0 {
(*emitter).open_ended = 1_i32;
}
if yaml_emitter_flush(emitter) == 0 {
if yaml_emitter_flush(emitter) == Zero {
return FAIL;
}
(*emitter).state = YAML_EMIT_DOCUMENT_START_STATE;
@ -629,11 +629,11 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
1_i32,
1_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_increase_indent(emitter, 1_i32, 0_i32) == 0 {
if yaml_emitter_increase_indent(emitter, 1_i32, 0_i32) == Zero {
return FAIL;
}
let fresh12 = addr_of_mut!((*emitter).flow_level);
@ -650,11 +650,11 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -664,7 +664,7 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -678,13 +678,13 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
}
if (*emitter).canonical != 0 || (*emitter).column > (*emitter).best_width {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -692,7 +692,7 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
emitter,
(*emitter).states,
YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -711,11 +711,11 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
1_i32,
1_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_increase_indent(emitter, 1_i32, 0_i32) == 0 {
if yaml_emitter_increase_indent(emitter, 1_i32, 0_i32) == Zero {
return FAIL;
}
let fresh18 = addr_of_mut!((*emitter).flow_level);
@ -732,11 +732,11 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -746,7 +746,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -760,13 +760,13 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
}
if (*emitter).canonical != 0 || (*emitter).column > (*emitter).best_width {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -775,7 +775,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
emitter,
(*emitter).states,
YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -787,7 +787,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -795,7 +795,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
emitter,
(*emitter).states,
YAML_EMIT_FLOW_MAPPING_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -815,13 +815,13 @@ unsafe fn yaml_emitter_emit_flow_mapping_value(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
} else {
if (*emitter).canonical != 0 || (*emitter).column > (*emitter).best_width {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -831,12 +831,12 @@ unsafe fn yaml_emitter_emit_flow_mapping_value(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
}
if PUSH!(emitter, (*emitter).states, YAML_EMIT_FLOW_MAPPING_KEY_STATE) == 0 {
if PUSH!(emitter, (*emitter).states, YAML_EMIT_FLOW_MAPPING_KEY_STATE) == Zero {
return FAIL;
}
yaml_emitter_emit_node(emitter, event, 0_i32, 0_i32, 1_i32, 0_i32)
@ -852,7 +852,7 @@ unsafe fn yaml_emitter_emit_block_sequence_item(
emitter,
0_i32,
((*emitter).mapping_context != 0 && (*emitter).indention == 0) as libc::c_int,
) == 0
) == Zero
{
return FAIL;
}
@ -862,7 +862,7 @@ unsafe fn yaml_emitter_emit_block_sequence_item(
(*emitter).state = POP!((*emitter).states);
return OK;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
if yaml_emitter_write_indicator(
@ -871,7 +871,7 @@ unsafe fn yaml_emitter_emit_block_sequence_item(
1_i32,
0_i32,
1_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -879,7 +879,7 @@ unsafe fn yaml_emitter_emit_block_sequence_item(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -892,7 +892,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
first: libc::c_int,
) -> Success {
if first != 0 {
if yaml_emitter_increase_indent(emitter, 0_i32, 0_i32) == 0 {
if yaml_emitter_increase_indent(emitter, 0_i32, 0_i32) == Zero {
return FAIL;
}
}
@ -901,7 +901,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
(*emitter).state = POP!((*emitter).states);
return OK;
}
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
if yaml_emitter_check_simple_key(emitter) {
@ -909,7 +909,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -921,7 +921,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
1_i32,
0_i32,
1_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -929,7 +929,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_MAPPING_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -949,12 +949,12 @@ unsafe fn yaml_emitter_emit_block_mapping_value(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
} else {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
if yaml_emitter_write_indicator(
@ -963,7 +963,7 @@ unsafe fn yaml_emitter_emit_block_mapping_value(
1_i32,
0_i32,
1_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -972,7 +972,7 @@ unsafe fn yaml_emitter_emit_block_mapping_value(
emitter,
(*emitter).states,
YAML_EMIT_BLOCK_MAPPING_KEY_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -1008,7 +1008,7 @@ unsafe fn yaml_emitter_emit_alias(
mut emitter: *mut yaml_emitter_t,
_event: *mut yaml_event_t,
) -> Success {
if yaml_emitter_process_anchor(emitter) == 0 {
if yaml_emitter_process_anchor(emitter) == Zero {
return FAIL;
}
if (*emitter).simple_key_context != 0 {
@ -1024,19 +1024,19 @@ unsafe fn yaml_emitter_emit_scalar(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
if yaml_emitter_select_scalar_style(emitter, event) == 0 {
if yaml_emitter_select_scalar_style(emitter, event) == Zero {
return FAIL;
}
if yaml_emitter_process_anchor(emitter) == 0 {
if yaml_emitter_process_anchor(emitter) == Zero {
return FAIL;
}
if yaml_emitter_process_tag(emitter) == 0 {
if yaml_emitter_process_tag(emitter) == Zero {
return FAIL;
}
if yaml_emitter_increase_indent(emitter, 1_i32, 0_i32) == 0 {
if yaml_emitter_increase_indent(emitter, 1_i32, 0_i32) == Zero {
return FAIL;
}
if yaml_emitter_process_scalar(emitter) == 0 {
if yaml_emitter_process_scalar(emitter) == Zero {
return FAIL;
}
(*emitter).indent = POP!((*emitter).indents);
@ -1048,10 +1048,10 @@ unsafe fn yaml_emitter_emit_sequence_start(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
if yaml_emitter_process_anchor(emitter) == 0 {
if yaml_emitter_process_anchor(emitter) == Zero {
return FAIL;
}
if yaml_emitter_process_tag(emitter) == 0 {
if yaml_emitter_process_tag(emitter) == Zero {
return FAIL;
}
if (*emitter).flow_level != 0
@ -1071,10 +1071,10 @@ unsafe fn yaml_emitter_emit_mapping_start(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
) -> Success {
if yaml_emitter_process_anchor(emitter) == 0 {
if yaml_emitter_process_anchor(emitter) == Zero {
return FAIL;
}
if yaml_emitter_process_tag(emitter) == 0 {
if yaml_emitter_process_tag(emitter) == Zero {
return FAIL;
}
if (*emitter).flow_level != 0
@ -1242,7 +1242,7 @@ unsafe fn yaml_emitter_process_anchor(emitter: *mut yaml_emitter_t) -> Success {
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -1262,7 +1262,7 @@ unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> Success {
emitter,
(*emitter).tag_data.handle,
(*emitter).tag_data.handle_length,
) == 0
) == Zero
{
return FAIL;
}
@ -1272,7 +1272,7 @@ unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> Success {
(*emitter).tag_data.suffix,
(*emitter).tag_data.suffix_length,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -1284,7 +1284,7 @@ unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> Success {
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -1293,7 +1293,7 @@ unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> Success {
(*emitter).tag_data.suffix,
(*emitter).tag_data.suffix_length,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -1303,7 +1303,7 @@ unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> Success {
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -1686,14 +1686,15 @@ unsafe fn yaml_emitter_analyze_event(
(*emitter).scalar_data.length = 0_u64;
match (*event).type_ as libc::c_uint {
5 => {
if yaml_emitter_analyze_anchor(emitter, (*event).data.alias.anchor, 1_i32) == 0 {
if yaml_emitter_analyze_anchor(emitter, (*event).data.alias.anchor, 1_i32) == Zero {
return FAIL;
}
OK
}
6 => {
if !((*event).data.scalar.anchor).is_null() {
if yaml_emitter_analyze_anchor(emitter, (*event).data.scalar.anchor, 0_i32) == 0 {
if yaml_emitter_analyze_anchor(emitter, (*event).data.scalar.anchor, 0_i32) == Zero
{
return FAIL;
}
}
@ -1702,7 +1703,7 @@ unsafe fn yaml_emitter_analyze_event(
|| (*event).data.scalar.plain_implicit == 0
&& (*event).data.scalar.quoted_implicit == 0)
{
if yaml_emitter_analyze_tag(emitter, (*event).data.scalar.tag) == 0 {
if yaml_emitter_analyze_tag(emitter, (*event).data.scalar.tag) == Zero {
return FAIL;
}
}
@ -1710,7 +1711,7 @@ unsafe fn yaml_emitter_analyze_event(
emitter,
(*event).data.scalar.value,
(*event).data.scalar.length,
) == 0
) == Zero
{
return FAIL;
}
@ -1719,7 +1720,7 @@ unsafe fn yaml_emitter_analyze_event(
7 => {
if !((*event).data.sequence_start.anchor).is_null() {
if yaml_emitter_analyze_anchor(emitter, (*event).data.sequence_start.anchor, 0_i32)
== 0
== Zero
{
return FAIL;
}
@ -1727,7 +1728,7 @@ unsafe fn yaml_emitter_analyze_event(
if !((*event).data.sequence_start.tag).is_null()
&& ((*emitter).canonical != 0 || (*event).data.sequence_start.implicit == 0)
{
if yaml_emitter_analyze_tag(emitter, (*event).data.sequence_start.tag) == 0 {
if yaml_emitter_analyze_tag(emitter, (*event).data.sequence_start.tag) == Zero {
return FAIL;
}
}
@ -1736,7 +1737,7 @@ unsafe fn yaml_emitter_analyze_event(
9 => {
if !((*event).data.mapping_start.anchor).is_null() {
if yaml_emitter_analyze_anchor(emitter, (*event).data.mapping_start.anchor, 0_i32)
== 0
== Zero
{
return FAIL;
}
@ -1744,7 +1745,7 @@ unsafe fn yaml_emitter_analyze_event(
if !((*event).data.mapping_start.tag).is_null()
&& ((*emitter).canonical != 0 || (*event).data.mapping_start.implicit == 0)
{
if yaml_emitter_analyze_tag(emitter, (*event).data.mapping_start.tag) == 0 {
if yaml_emitter_analyze_tag(emitter, (*event).data.mapping_start.tag) == Zero {
return FAIL;
}
}
@ -1954,7 +1955,7 @@ unsafe fn yaml_emitter_write_plain_scalar(
&& (*emitter).column > (*emitter).best_width
&& !IS_SPACE_AT!(string, 1)
{
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
MOVE!(string);
@ -1975,7 +1976,7 @@ unsafe fn yaml_emitter_write_plain_scalar(
breaks = 1_i32;
} else {
if breaks != 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -2007,7 +2008,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -2020,7 +2021,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
&& string.pointer != string.end.wrapping_offset(-(1_isize))
&& !IS_SPACE_AT!(string, 1)
{
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
MOVE!(string);
@ -2041,7 +2042,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
breaks = 1_i32;
} else {
if breaks != 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -2059,7 +2060,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
}
}
if breaks != 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -2069,7 +2070,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -2092,7 +2093,7 @@ unsafe fn yaml_emitter_write_double_quoted_scalar(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -2257,7 +2258,7 @@ unsafe fn yaml_emitter_write_double_quoted_scalar(
&& string.pointer != string.start
&& string.pointer != string.end.wrapping_offset(-(1_isize))
{
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
if IS_SPACE_AT!(string, 1) {
@ -2283,7 +2284,7 @@ unsafe fn yaml_emitter_write_double_quoted_scalar(
0_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
@ -2302,7 +2303,8 @@ unsafe fn yaml_emitter_write_block_scalar_hints(
indent_hint[0_usize] =
('0' as i32 + (*emitter).best_indent as libc::c_char as libc::c_int) as libc::c_char;
indent_hint[1_usize] = '\0' as libc::c_char;
if yaml_emitter_write_indicator(emitter, indent_hint.as_mut_ptr(), 0_i32, 0_i32, 0_i32) == 0
if yaml_emitter_write_indicator(emitter, indent_hint.as_mut_ptr(), 0_i32, 0_i32, 0_i32)
== Zero
{
return FAIL;
}
@ -2337,7 +2339,7 @@ unsafe fn yaml_emitter_write_block_scalar_hints(
}
}
if !chomp_hint.is_null() {
if yaml_emitter_write_indicator(emitter, chomp_hint, 0_i32, 0_i32, 0_i32) == 0 {
if yaml_emitter_write_indicator(emitter, chomp_hint, 0_i32, 0_i32, 0_i32) == Zero {
return FAIL;
}
}
@ -2357,11 +2359,11 @@ unsafe fn yaml_emitter_write_literal_scalar(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_block_scalar_hints(emitter, string) == 0 {
if yaml_emitter_write_block_scalar_hints(emitter, string) == Zero {
return FAIL;
}
if !PUT_BREAK(emitter).ok {
@ -2378,7 +2380,7 @@ unsafe fn yaml_emitter_write_literal_scalar(
breaks = 1_i32;
} else {
if breaks != 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
}
@ -2406,11 +2408,11 @@ unsafe fn yaml_emitter_write_folded_scalar(
1_i32,
0_i32,
0_i32,
) == 0
) == Zero
{
return FAIL;
}
if yaml_emitter_write_block_scalar_hints(emitter, string) == 0 {
if yaml_emitter_write_block_scalar_hints(emitter, string) == Zero {
return FAIL;
}
if !PUT_BREAK(emitter).ok {
@ -2438,7 +2440,7 @@ unsafe fn yaml_emitter_write_folded_scalar(
breaks = 1_i32;
} else {
if breaks != 0 {
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
leading_spaces = IS_BLANK!(string) as libc::c_int;
@ -2448,7 +2450,7 @@ unsafe fn yaml_emitter_write_folded_scalar(
&& !IS_SPACE_AT!(string, 1)
&& (*emitter).column > (*emitter).best_width
{
if yaml_emitter_write_indent(emitter) == 0 {
if yaml_emitter_write_indent(emitter) == Zero {
return FAIL;
}
MOVE!(string);

View file

@ -1,6 +1,6 @@
use crate::api::{yaml_free, yaml_malloc, yaml_stack_extend, yaml_strdup};
use crate::externs::{memset, strcmp};
use crate::success::{Success, FAIL, OK};
use crate::success::{Success, Zero, FAIL, OK};
use crate::yaml::yaml_char_t;
use crate::{
libc, yaml_alias_data_t, yaml_document_delete, yaml_document_t, yaml_event_t, yaml_mark_t,
@ -47,9 +47,9 @@ pub unsafe fn yaml_parser_load(
0_i32,
size_of::<yaml_document_t>() as libc::c_ulong,
);
if !(STACK_INIT!(parser, (*document).nodes, yaml_node_t) == 0) {
if !(STACK_INIT!(parser, (*document).nodes, yaml_node_t) == Zero) {
if (*parser).stream_start_produced == 0 {
if yaml_parser_parse(parser, event) == 0 {
if yaml_parser_parse(parser, event) == Zero {
current_block = 6234624449317607669;
} else {
__assert!(
@ -67,16 +67,16 @@ pub unsafe fn yaml_parser_load(
if (*parser).stream_end_produced != 0 {
return OK;
}
if !(yaml_parser_parse(parser, event) == 0) {
if !(yaml_parser_parse(parser, event) == Zero) {
if (*event).type_ as libc::c_uint
== YAML_STREAM_END_EVENT as libc::c_int as libc::c_uint
{
return OK;
}
if !(STACK_INIT!(parser, (*parser).aliases, yaml_alias_data_t) == 0) {
if !(STACK_INIT!(parser, (*parser).aliases, yaml_alias_data_t) == Zero) {
let fresh6 = addr_of_mut!((*parser).document);
*fresh6 = document;
if !(yaml_parser_load_document(parser, event) == 0) {
if !(yaml_parser_load_document(parser, event) == Zero) {
yaml_parser_delete_aliases(parser);
let fresh7 = addr_of_mut!((*parser).document);
*fresh7 = ptr::null_mut::<yaml_document_t>();
@ -150,10 +150,10 @@ 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;
if STACK_INIT!(parser, ctx, libc::c_int) == 0 {
if STACK_INIT!(parser, ctx, libc::c_int) == Zero {
return FAIL;
}
if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)) == 0 {
if yaml_parser_load_nodes(parser, addr_of_mut!(ctx)) == Zero {
STACK_DEL!(ctx);
return FAIL;
}
@ -165,37 +165,37 @@ unsafe fn yaml_parser_load_nodes(mut parser: *mut yaml_parser_t, ctx: *mut loade
let mut event = MaybeUninit::<yaml_event_t>::uninit();
let event = event.as_mut_ptr();
loop {
if yaml_parser_parse(parser, event) == 0 {
if yaml_parser_parse(parser, event) == Zero {
return FAIL;
}
match (*event).type_ as libc::c_uint {
5 => {
if yaml_parser_load_alias(parser, event, ctx) == 0 {
if yaml_parser_load_alias(parser, event, ctx) == Zero {
return FAIL;
}
}
6 => {
if yaml_parser_load_scalar(parser, event, ctx) == 0 {
if yaml_parser_load_scalar(parser, event, ctx) == Zero {
return FAIL;
}
}
7 => {
if yaml_parser_load_sequence(parser, event, ctx) == 0 {
if yaml_parser_load_sequence(parser, event, ctx) == Zero {
return FAIL;
}
}
8 => {
if yaml_parser_load_sequence_end(parser, event, ctx) == 0 {
if yaml_parser_load_sequence_end(parser, event, ctx) == Zero {
return FAIL;
}
}
9 => {
if yaml_parser_load_mapping(parser, event, ctx) == 0 {
if yaml_parser_load_mapping(parser, event, ctx) == Zero {
return FAIL;
}
}
10 => {
if yaml_parser_load_mapping_end(parser, event, ctx) == 0 {
if yaml_parser_load_mapping_end(parser, event, ctx) == Zero {
return FAIL;
}
}
@ -248,7 +248,7 @@ unsafe fn yaml_parser_register_anchor(
}
alias_data = alias_data.wrapping_offset(1);
}
if PUSH!(parser, (*parser).aliases, *data) == 0 {
if PUSH!(parser, (*parser).aliases, *data) == Zero {
yaml_free(anchor as *mut libc::c_void);
return FAIL;
}
@ -270,10 +270,10 @@ unsafe fn yaml_parser_load_node_add(
let current_block_17: u64;
match (*parent).type_ as libc::c_uint {
2 => {
if STACK_LIMIT!(parser, (*parent).data.sequence.items) == 0 {
if STACK_LIMIT!(parser, (*parent).data.sequence.items) == Zero {
return FAIL;
}
if PUSH!(parser, (*parent).data.sequence.items, index) == 0 {
if PUSH!(parser, (*parent).data.sequence.items, index) == Zero {
return FAIL;
}
}
@ -297,10 +297,10 @@ unsafe fn yaml_parser_load_node_add(
_ => {
(*pair).key = index;
(*pair).value = 0_i32;
if STACK_LIMIT!(parser, (*parent).data.mapping.pairs) == 0 {
if STACK_LIMIT!(parser, (*parent).data.mapping.pairs) == Zero {
return FAIL;
}
if PUSH!(parser, (*parent).data.mapping.pairs, *pair) == 0 {
if PUSH!(parser, (*parent).data.mapping.pairs, *pair) == Zero {
return FAIL;
}
}
@ -350,7 +350,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) == 0) {
if !(STACK_LIMIT!(parser, (*(*parser).document).nodes) == Zero) {
if tag.is_null()
|| strcmp(
tag as *mut libc::c_char,
@ -384,11 +384,12 @@ 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;
if !(PUSH!(parser, (*(*parser).document).nodes, *node) == 0) {
if !(PUSH!(parser, (*(*parser).document).nodes, *node) == Zero) {
index = ((*(*parser).document).nodes.top)
.c_offset_from((*(*parser).document).nodes.start)
as libc::c_long as libc::c_int;
if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor) == 0
if yaml_parser_register_anchor(parser, index, (*event).data.scalar.anchor)
== Zero
{
return FAIL;
}
@ -423,7 +424,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) == 0) {
if !(STACK_LIMIT!(parser, (*(*parser).document).nodes) == Zero) {
if tag.is_null()
|| strcmp(
tag as *mut libc::c_char,
@ -445,7 +446,7 @@ unsafe fn yaml_parser_load_sequence(
match current_block {
13474536459355229096 => {}
_ => {
if !(STACK_INIT!(parser, items, yaml_node_item_t) == 0) {
if !(STACK_INIT!(parser, items, yaml_node_item_t) == Zero) {
memset(
node as *mut libc::c_void,
0_i32,
@ -459,7 +460,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;
if !(PUSH!(parser, (*(*parser).document).nodes, *node) == 0) {
if !(PUSH!(parser, (*(*parser).document).nodes, *node) == Zero) {
index = ((*(*parser).document).nodes.top)
.c_offset_from((*(*parser).document).nodes.start)
as libc::c_long as libc::c_int;
@ -467,17 +468,17 @@ unsafe fn yaml_parser_load_sequence(
parser,
index,
(*event).data.sequence_start.anchor,
) == 0
) == Zero
{
return FAIL;
}
if yaml_parser_load_node_add(parser, ctx, index) == 0 {
if yaml_parser_load_node_add(parser, ctx, index) == Zero {
return FAIL;
}
if STACK_LIMIT!(parser, *ctx) == 0 {
if STACK_LIMIT!(parser, *ctx) == Zero {
return FAIL;
}
if PUSH!(parser, *ctx, index) == 0 {
if PUSH!(parser, *ctx, index) == Zero {
return FAIL;
}
return OK;
@ -529,7 +530,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) == 0) {
if !(STACK_LIMIT!(parser, (*(*parser).document).nodes) == Zero) {
if tag.is_null()
|| strcmp(
tag as *mut libc::c_char,
@ -551,7 +552,7 @@ unsafe fn yaml_parser_load_mapping(
match current_block {
13635467803606088781 => {}
_ => {
if !(STACK_INIT!(parser, pairs, yaml_node_pair_t) == 0) {
if !(STACK_INIT!(parser, pairs, yaml_node_pair_t) == Zero) {
memset(
node as *mut libc::c_void,
0_i32,
@ -565,7 +566,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;
if !(PUSH!(parser, (*(*parser).document).nodes, *node) == 0) {
if !(PUSH!(parser, (*(*parser).document).nodes, *node) == Zero) {
index = ((*(*parser).document).nodes.top)
.c_offset_from((*(*parser).document).nodes.start)
as libc::c_long as libc::c_int;
@ -573,17 +574,17 @@ unsafe fn yaml_parser_load_mapping(
parser,
index,
(*event).data.mapping_start.anchor,
) == 0
) == Zero
{
return FAIL;
}
if yaml_parser_load_node_add(parser, ctx, index) == 0 {
if yaml_parser_load_node_add(parser, ctx, index) == Zero {
return FAIL;
}
if STACK_LIMIT!(parser, *ctx) == 0 {
if STACK_LIMIT!(parser, *ctx) == Zero {
return FAIL;
}
if PUSH!(parser, *ctx, index) == 0 {
if PUSH!(parser, *ctx, index) == Zero {
return FAIL;
}
return OK;

View file

@ -70,7 +70,7 @@ macro_rules! STRING_EXTEND {
addr_of_mut!($string.start),
addr_of_mut!($string.pointer),
addr_of_mut!($string.end),
) != 0
) != Zero
{
OK
} else {
@ -100,7 +100,7 @@ macro_rules! JOIN {
addr_of_mut!($string_b.start),
addr_of_mut!($string_b.pointer),
addr_of_mut!($string_b.end),
) != 0
) != Zero
{
$string_b.pointer = $string_b.start;
OK
@ -416,7 +416,7 @@ macro_rules! PUSH {
addr_of_mut!($stack.start) as *mut *mut libc::c_void,
addr_of_mut!($stack.top) as *mut *mut libc::c_void,
addr_of_mut!($stack.end) as *mut *mut libc::c_void,
) != 0
) != Zero
{
$push;
$stack.top = $stack.top.wrapping_offset(1);
@ -482,7 +482,7 @@ macro_rules! ENQUEUE {
addr_of_mut!($queue.head) as *mut *mut libc::c_void,
addr_of_mut!($queue.tail) as *mut *mut libc::c_void,
addr_of_mut!($queue.end) as *mut *mut libc::c_void,
) != 0
) != Zero
{
$enqueue;
$queue.tail = $queue.tail.wrapping_offset(1);
@ -518,7 +518,7 @@ macro_rules! QUEUE_INSERT {
addr_of_mut!($queue.head) as *mut *mut libc::c_void,
addr_of_mut!($queue.tail) as *mut *mut libc::c_void,
addr_of_mut!($queue.end) as *mut *mut libc::c_void,
) != 0
) != Zero
{
memmove(
($queue.head)

View file

@ -1,7 +1,7 @@
use crate::api::{yaml_free, yaml_malloc, yaml_stack_extend, yaml_strdup};
use crate::externs::{memcpy, memset, strcmp, strlen};
use crate::scanner::yaml_parser_fetch_more_tokens;
use crate::success::{Success, FAIL, OK};
use crate::success::{Success, Zero, FAIL, OK};
use crate::yaml::{size_t, yaml_char_t};
use crate::{
libc, yaml_event_t, yaml_mark_t, yaml_parser_t, yaml_tag_directive_t, yaml_token_t,
@ -33,7 +33,7 @@ use core::mem::size_of;
use core::ptr::{self, addr_of_mut};
unsafe fn PEEK_TOKEN(parser: *mut yaml_parser_t) -> *mut yaml_token_t {
if (*parser).token_available != 0 || yaml_parser_fetch_more_tokens(parser) != 0 {
if (*parser).token_available != 0 || yaml_parser_fetch_more_tokens(parser) != Zero {
(*parser).tokens.head
} else {
ptr::null_mut::<yaml_token_t>()
@ -232,11 +232,11 @@ unsafe fn yaml_parser_parse_document_start(
ptr::null_mut::<*mut yaml_version_directive_t>(),
ptr::null_mut::<*mut yaml_tag_directive_t>(),
ptr::null_mut::<*mut yaml_tag_directive_t>(),
) == 0
) == Zero
{
return FAIL;
}
if PUSH!(parser, (*parser).states, YAML_PARSE_DOCUMENT_END_STATE) == 0 {
if PUSH!(parser, (*parser).states, YAML_PARSE_DOCUMENT_END_STATE) == Zero {
return FAIL;
}
(*parser).state = YAML_PARSE_BLOCK_NODE_STATE;
@ -265,7 +265,7 @@ unsafe fn yaml_parser_parse_document_start(
addr_of_mut!(version_directive),
addr_of_mut!(tag_directives.start),
addr_of_mut!(tag_directives.end),
) == 0
) == Zero
{
return FAIL;
}
@ -279,7 +279,7 @@ unsafe fn yaml_parser_parse_document_start(
b"did not find expected <document start>\0" as *const u8 as *const libc::c_char,
(*token).start_mark,
);
} else if !(PUSH!(parser, (*parser).states, YAML_PARSE_DOCUMENT_END_STATE) == 0) {
} else if !(PUSH!(parser, (*parser).states, YAML_PARSE_DOCUMENT_END_STATE) == Zero) {
(*parser).state = YAML_PARSE_DOCUMENT_CONTENT_STATE;
end_mark = (*token).end_mark;
memset(
@ -769,7 +769,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
let mut token: *mut yaml_token_t;
if first != 0 {
token = PEEK_TOKEN(parser);
if PUSH!(parser, (*parser).marks, (*token).start_mark) == 0 {
if PUSH!(parser, (*parser).marks, (*token).start_mark) == Zero {
return FAIL;
}
SKIP_TOKEN(parser);
@ -792,7 +792,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
parser,
(*parser).states,
YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -852,7 +852,7 @@ unsafe fn yaml_parser_parse_indentless_sequence_entry(
parser,
(*parser).states,
YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -883,7 +883,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
let mut token: *mut yaml_token_t;
if first != 0 {
token = PEEK_TOKEN(parser);
if PUSH!(parser, (*parser).marks, (*token).start_mark) == 0 {
if PUSH!(parser, (*parser).marks, (*token).start_mark) == Zero {
return FAIL;
}
SKIP_TOKEN(parser);
@ -907,7 +907,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
parser,
(*parser).states,
YAML_PARSE_BLOCK_MAPPING_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -962,7 +962,7 @@ unsafe fn yaml_parser_parse_block_mapping_value(
&& (*token).type_ as libc::c_uint != YAML_VALUE_TOKEN as libc::c_int as libc::c_uint
&& (*token).type_ as libc::c_uint != YAML_BLOCK_END_TOKEN as libc::c_int as libc::c_uint
{
if PUSH!(parser, (*parser).states, YAML_PARSE_BLOCK_MAPPING_KEY_STATE) == 0 {
if PUSH!(parser, (*parser).states, YAML_PARSE_BLOCK_MAPPING_KEY_STATE) == Zero {
return FAIL;
}
yaml_parser_parse_node(parser, event, 1_i32, 1_i32)
@ -984,7 +984,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
let mut token: *mut yaml_token_t;
if first != 0 {
token = PEEK_TOKEN(parser);
if PUSH!(parser, (*parser).marks, (*token).start_mark) == 0 {
if PUSH!(parser, (*parser).marks, (*token).start_mark) == Zero {
return FAIL;
}
SKIP_TOKEN(parser);
@ -1040,7 +1040,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
parser,
(*parser).states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -1078,7 +1078,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_key(
parser,
(*parser).states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -1114,7 +1114,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_value(
parser,
(*parser).states,
YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -1153,7 +1153,7 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
let mut token: *mut yaml_token_t;
if first != 0 {
token = PEEK_TOKEN(parser);
if PUSH!(parser, (*parser).marks, (*token).start_mark) == 0 {
if PUSH!(parser, (*parser).marks, (*token).start_mark) == Zero {
return FAIL;
}
SKIP_TOKEN(parser);
@ -1200,7 +1200,7 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
parser,
(*parser).states,
YAML_PARSE_FLOW_MAPPING_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -1216,7 +1216,7 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
parser,
(*parser).states,
YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE
) == 0
) == Zero
{
return FAIL;
}
@ -1261,7 +1261,7 @@ unsafe fn yaml_parser_parse_flow_mapping_value(
&& (*token).type_ as libc::c_uint
!= YAML_FLOW_MAPPING_END_TOKEN as libc::c_int as libc::c_uint
{
if PUSH!(parser, (*parser).states, YAML_PARSE_FLOW_MAPPING_KEY_STATE) == 0 {
if PUSH!(parser, (*parser).states, YAML_PARSE_FLOW_MAPPING_KEY_STATE) == Zero {
return FAIL;
}
return yaml_parser_parse_node(parser, event, 0_i32, 0_i32);
@ -1338,7 +1338,7 @@ unsafe fn yaml_parser_process_directives(
top: ptr::null_mut::<yaml_tag_directive_t>(),
};
let mut token: *mut yaml_token_t;
if !(STACK_INIT!(parser, tag_directives, yaml_tag_directive_t) == 0) {
if !(STACK_INIT!(parser, tag_directives, yaml_tag_directive_t) == Zero) {
token = PEEK_TOKEN(parser);
if !token.is_null() {
loop {
@ -1395,12 +1395,12 @@ unsafe fn yaml_parser_process_directives(
prefix: (*token).data.tag_directive.prefix,
};
if yaml_parser_append_tag_directive(parser, value, 0_i32, (*token).start_mark)
== 0
== Zero
{
current_block = 17143798186130252483;
break;
}
if PUSH!(parser, tag_directives, value) == 0 {
if PUSH!(parser, tag_directives, value) == Zero {
current_block = 17143798186130252483;
break;
}
@ -1426,7 +1426,7 @@ unsafe fn yaml_parser_process_directives(
*default_tag_directive,
1_i32,
(*token).start_mark,
) == 0
) == Zero
{
current_block = 17143798186130252483;
break;
@ -1506,7 +1506,7 @@ unsafe fn yaml_parser_append_tag_directive(
copy.prefix = yaml_strdup(value.prefix);
if copy.handle.is_null() || copy.prefix.is_null() {
(*parser).error = YAML_MEMORY_ERROR;
} else if !(PUSH!(parser, (*parser).tag_directives, copy) == 0) {
} else if !(PUSH!(parser, (*parser).tag_directives, copy) == Zero) {
return OK;
}
yaml_free(copy.handle as *mut libc::c_void);

View file

@ -1,5 +1,5 @@
use crate::externs::{memcmp, memmove};
use crate::success::{Success, FAIL, OK};
use crate::success::{Success, Zero, FAIL, OK};
use crate::yaml::{size_t, yaml_char_t};
use crate::{
libc, yaml_parser_t, PointerExt, YAML_READER_ERROR, YAML_UTF16BE_ENCODING,
@ -30,7 +30,7 @@ unsafe fn yaml_parser_determine_encoding(mut parser: *mut yaml_parser_t) -> Succ
&& (((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) as libc::c_long)
< 3_i64
{
if yaml_parser_update_raw_buffer(parser) == 0 {
if yaml_parser_update_raw_buffer(parser) == Zero {
return FAIL;
}
}
@ -144,7 +144,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
return OK;
}
if (*parser).encoding as u64 == 0 {
if yaml_parser_determine_encoding(parser) == 0 {
if yaml_parser_determine_encoding(parser) == Zero {
return FAIL;
}
}
@ -170,7 +170,7 @@ pub(crate) unsafe fn yaml_parser_update_buffer(
}
while (*parser).unread < length {
if first == 0 || (*parser).raw_buffer.pointer == (*parser).raw_buffer.last {
if yaml_parser_update_raw_buffer(parser) == 0 {
if yaml_parser_update_raw_buffer(parser) == Zero {
return FAIL;
}
}

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,10 @@ pub struct Success {
pub ok: bool,
}
impl PartialEq<i32> for Success {
fn eq(&self, int: &i32) -> bool {
self.ok == (*int == 1)
pub struct Zero;
impl PartialEq<Zero> for Success {
fn eq(&self, _zero: &Zero) -> bool {
!self.ok
}
}