mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-13 23:27:16 +00:00
Remove vestigial input/output structs
This commit is contained in:
parent
666034cf5c
commit
ac00cee574
3 changed files with 1 additions and 59 deletions
|
@ -22,7 +22,6 @@ pub(crate) const OUTPUT_BUFFER_SIZE: usize = 16384;
|
|||
pub fn yaml_parser_new<'r>() -> yaml_parser_t<'r> {
|
||||
yaml_parser_t {
|
||||
read_handler: None,
|
||||
input: Default::default(),
|
||||
eof: false,
|
||||
buffer: VecDeque::with_capacity(INPUT_BUFFER_SIZE),
|
||||
unread: 0,
|
||||
|
@ -89,7 +88,6 @@ pub fn yaml_parser_set_encoding(parser: &mut yaml_parser_t, encoding: yaml_encod
|
|||
pub fn yaml_emitter_new<'w>() -> yaml_emitter_t<'w> {
|
||||
yaml_emitter_t {
|
||||
write_handler: None,
|
||||
output: Default::default(),
|
||||
buffer: String::with_capacity(OUTPUT_BUFFER_SIZE),
|
||||
raw_buffer: Vec::with_capacity(OUTPUT_BUFFER_SIZE),
|
||||
encoding: YAML_ANY_ENCODING,
|
||||
|
|
|
@ -39,7 +39,6 @@ extern crate alloc;
|
|||
use core::mem::size_of;
|
||||
|
||||
mod libc {
|
||||
pub use core::ffi::c_void;
|
||||
pub use core::primitive::{
|
||||
i32 as c_int, i64 as c_long, u32 as c_uint, u64 as c_ulong, u8 as c_uchar,
|
||||
};
|
||||
|
@ -126,7 +125,7 @@ pub use crate::yaml::{
|
|||
yaml_encoding_t, yaml_event_t, yaml_mapping_style_t, yaml_mark_t, yaml_node_item_t,
|
||||
yaml_node_pair_t, yaml_node_t, yaml_parser_state_t, yaml_parser_t, yaml_scalar_style_t,
|
||||
yaml_sequence_style_t, yaml_simple_key_t, yaml_tag_directive_t, yaml_token_t,
|
||||
yaml_token_type_t, yaml_version_directive_t, yaml_write_handler_t, YamlEventData,
|
||||
yaml_token_type_t, yaml_version_directive_t, YamlEventData,
|
||||
};
|
||||
#[doc(hidden)]
|
||||
pub use crate::yaml::{
|
||||
|
|
55
src/yaml.rs
55
src/yaml.rs
|
@ -3,7 +3,6 @@ use alloc::string::String;
|
|||
use alloc::vec::Vec;
|
||||
|
||||
use crate::{api::yaml_parser_new, libc, yaml_emitter_new};
|
||||
use core::ptr;
|
||||
|
||||
pub use self::yaml_encoding_t::*;
|
||||
pub use core::primitive::{i64 as ptrdiff_t, u64 as size_t};
|
||||
|
@ -631,8 +630,6 @@ pub struct yaml_alias_data_t {
|
|||
pub struct yaml_parser_t<'r> {
|
||||
/// Read handler.
|
||||
pub(crate) read_handler: Option<&'r mut dyn std::io::Read>,
|
||||
/// Standard (string or file) input data.
|
||||
pub(crate) input: unnamed_yaml_parser_t_input_string,
|
||||
/// EOF flag
|
||||
pub(crate) eof: bool,
|
||||
/// The working buffer.
|
||||
|
@ -691,36 +688,6 @@ impl<'r> Default for yaml_parser_t<'r> {
|
|||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub(crate) struct unnamed_yaml_parser_t_input_string {
|
||||
/// The string start pointer.
|
||||
pub start: *const libc::c_uchar,
|
||||
/// The string end pointer.
|
||||
pub end: *const libc::c_uchar,
|
||||
/// The string current position.
|
||||
pub current: *const libc::c_uchar,
|
||||
}
|
||||
|
||||
impl Default for unnamed_yaml_parser_t_input_string {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
start: ptr::null(),
|
||||
end: ptr::null(),
|
||||
current: ptr::null(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The prototype of a write handler.
|
||||
///
|
||||
/// The write handler is called when the emitter needs to flush the accumulated
|
||||
/// characters to the output. The handler should write `size` bytes of the
|
||||
/// `buffer` to the output.
|
||||
///
|
||||
/// On success, the handler should return 1. If the handler failed, the returned
|
||||
/// value should be 0.
|
||||
pub type yaml_write_handler_t = fn(data: *mut libc::c_void, buffer: &[u8]) -> libc::c_int;
|
||||
|
||||
/// The emitter states.
|
||||
#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||
#[repr(u32)]
|
||||
|
@ -785,8 +752,6 @@ pub(crate) struct yaml_anchors_t {
|
|||
pub struct yaml_emitter_t<'w> {
|
||||
/// Write handler.
|
||||
pub(crate) write_handler: Option<&'w mut dyn std::io::Write>,
|
||||
/// Standard (string or file) output data.
|
||||
pub(crate) output: unnamed_yaml_emitter_t_output_string,
|
||||
/// The working buffer.
|
||||
///
|
||||
/// This always contains valid UTF-8.
|
||||
|
@ -856,23 +821,3 @@ impl<'a> Default for yaml_emitter_t<'a> {
|
|||
yaml_emitter_new()
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub(crate) struct unnamed_yaml_emitter_t_output_string {
|
||||
/// The buffer pointer.
|
||||
pub buffer: *mut libc::c_uchar,
|
||||
/// The buffer size.
|
||||
pub size: size_t,
|
||||
/// The number of written bytes.
|
||||
pub size_written: *mut size_t,
|
||||
}
|
||||
|
||||
impl Default for unnamed_yaml_emitter_t_output_string {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
buffer: ptr::null_mut(),
|
||||
size: 0,
|
||||
size_written: ptr::null_mut(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue