From da96d42456338882b0ee8a39095fd9e1fc012144 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 30 Jul 2022 01:20:14 -0700 Subject: [PATCH] Eliminate return value of queue init --- src/api.rs | 24 +++++++++++------------- src/macros.rs | 1 - 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/api.rs b/src/api.rs index 969b326..1082b03 100644 --- a/src/api.rs +++ b/src/api.rs @@ -184,14 +184,13 @@ pub unsafe fn yaml_parser_initialize(parser: *mut yaml_parser_t) -> Success { ); BUFFER_INIT!(parser, (*parser).raw_buffer, INPUT_RAW_BUFFER_SIZE); BUFFER_INIT!(parser, (*parser).buffer, INPUT_BUFFER_SIZE); - if QUEUE_INIT!(parser, (*parser).tokens, yaml_token_t).ok { - 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); - return OK; - } + 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); + return OK; BUFFER_DEL!((*parser).raw_buffer); BUFFER_DEL!((*parser).buffer); QUEUE_DEL!((*parser).tokens); @@ -327,11 +326,10 @@ pub unsafe fn yaml_emitter_initialize(mut emitter: *mut yaml_emitter_t) -> Succe 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); - if QUEUE_INIT!(emitter, (*emitter).events, yaml_event_t).ok { - STACK_INIT!(emitter, (*emitter).indents, libc::c_int); - STACK_INIT!(emitter, (*emitter).tag_directives, yaml_tag_directive_t); - return OK; - } + 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); + return OK; BUFFER_DEL!((*emitter).buffer); BUFFER_DEL!((*emitter).raw_buffer); STACK_DEL!((*emitter).states); diff --git a/src/macros.rs b/src/macros.rs index b5541c6..4309784 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -433,7 +433,6 @@ macro_rules! QUEUE_INIT { $queue.tail = $queue.start; $queue.head = $queue.tail; $queue.end = $queue.start.offset(16_isize); - OK }}; }