From fbdff989b58300f611d4047193420fad7d71a70f Mon Sep 17 00:00:00 2001 From: Simon Ask Ulsnes Date: Fri, 26 Jan 2024 10:56:28 +0100 Subject: [PATCH] Initial fork --- Cargo.toml | 21 ++++++++++++++------- src/bin/run-emitter-test-suite.rs | 20 ++++++++++---------- src/bin/run-parser-test-suite.rs | 18 +++++++++--------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5ec7f85..ff5b6e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,21 @@ [package] -name = "unsafe-libyaml" -version = "0.2.10" -authors = ["David Tolnay "] -categories = ["encoding", "parser-implementations", "no-std"] -description = "libyaml transpiled to rust by c2rust" -documentation = "https://docs.rs/unsafe-libyaml" +name = "libyaml-safer" +version = "0.1.0" +authors = [ + "Simon Ask Ulsnes ", +] +categories = [ + "encoding", + "parser-implementations", + "no-std", +] +description = "Safer libyaml port, based on unsafe-libyaml" +documentation = "https://docs.rs/libyaml-safer" edition = "2021" keywords = ["yaml"] license = "MIT" -repository = "https://github.com/dtolnay/unsafe-libyaml" +repository = "https://github.com/simonask/libyaml-safer" rust-version = "1.56" [workspace] diff --git a/src/bin/run-emitter-test-suite.rs b/src/bin/run-emitter-test-suite.rs index 0c51b9c..109ebcd 100644 --- a/src/bin/run-emitter-test-suite.rs +++ b/src/bin/run-emitter-test-suite.rs @@ -17,16 +17,7 @@ mod cstr; use self::cstr::CStr; -use std::env; -use std::error::Error; -use std::ffi::c_void; -use std::fs::File; -use std::io::{self, Read, Write}; -use std::mem::MaybeUninit; -use std::process::{self, ExitCode}; -use std::ptr::{self, addr_of_mut}; -use std::slice; -use unsafe_libyaml::{ +use libyaml_safer::{ yaml_alias_event_initialize, yaml_document_end_event_initialize, yaml_document_start_event_initialize, yaml_emitter_delete, yaml_emitter_emit, yaml_emitter_initialize, yaml_emitter_set_canonical, yaml_emitter_set_output, @@ -40,6 +31,15 @@ use unsafe_libyaml::{ YAML_PLAIN_SCALAR_STYLE, YAML_SINGLE_QUOTED_SCALAR_STYLE, YAML_UTF8_ENCODING, YAML_WRITER_ERROR, }; +use std::env; +use std::error::Error; +use std::ffi::c_void; +use std::fs::File; +use std::io::{self, Read, Write}; +use std::mem::MaybeUninit; +use std::process::{self, ExitCode}; +use std::ptr::{self, addr_of_mut}; +use std::slice; pub(crate) unsafe fn unsafe_main( stdin: &mut dyn Read, diff --git a/src/bin/run-parser-test-suite.rs b/src/bin/run-parser-test-suite.rs index 439ee03..0913d72 100644 --- a/src/bin/run-parser-test-suite.rs +++ b/src/bin/run-parser-test-suite.rs @@ -14,6 +14,15 @@ mod cstr; use self::cstr::CStr; +use libyaml_safer::{ + yaml_event_delete, yaml_event_t, yaml_event_type_t, yaml_parser_delete, yaml_parser_initialize, + yaml_parser_parse, yaml_parser_set_input, yaml_parser_t, YAML_ALIAS_EVENT, + YAML_DOCUMENT_END_EVENT, YAML_DOCUMENT_START_EVENT, YAML_DOUBLE_QUOTED_SCALAR_STYLE, + YAML_FOLDED_SCALAR_STYLE, YAML_LITERAL_SCALAR_STYLE, YAML_MAPPING_END_EVENT, + YAML_MAPPING_START_EVENT, YAML_NO_EVENT, YAML_PLAIN_SCALAR_STYLE, YAML_SCALAR_EVENT, + YAML_SEQUENCE_END_EVENT, YAML_SEQUENCE_START_EVENT, YAML_SINGLE_QUOTED_SCALAR_STYLE, + YAML_STREAM_END_EVENT, YAML_STREAM_START_EVENT, +}; use std::env; use std::error::Error; use std::ffi::c_void; @@ -24,15 +33,6 @@ use std::mem::MaybeUninit; use std::process::{self, ExitCode}; use std::ptr::addr_of_mut; use std::slice; -use unsafe_libyaml::{ - yaml_event_delete, yaml_event_t, yaml_event_type_t, yaml_parser_delete, yaml_parser_initialize, - yaml_parser_parse, yaml_parser_set_input, yaml_parser_t, YAML_ALIAS_EVENT, - YAML_DOCUMENT_END_EVENT, YAML_DOCUMENT_START_EVENT, YAML_DOUBLE_QUOTED_SCALAR_STYLE, - YAML_FOLDED_SCALAR_STYLE, YAML_LITERAL_SCALAR_STYLE, YAML_MAPPING_END_EVENT, - YAML_MAPPING_START_EVENT, YAML_NO_EVENT, YAML_PLAIN_SCALAR_STYLE, YAML_SCALAR_EVENT, - YAML_SEQUENCE_END_EVENT, YAML_SEQUENCE_START_EVENT, YAML_SINGLE_QUOTED_SCALAR_STYLE, - YAML_STREAM_END_EVENT, YAML_STREAM_START_EVENT, -}; pub(crate) unsafe fn unsafe_main( mut stdin: &mut dyn Read,