From 13d38f3983f078a34b3fad337dbbffe0468e472f Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 11 Dec 2020 11:00:21 +0100 Subject: [PATCH] fix(c-api) Remove the `wasmer_version` function. --- lib/c-api/src/lib.rs | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/lib/c-api/src/lib.rs b/lib/c-api/src/lib.rs index c44c3f96dc5..d30744b6da6 100644 --- a/lib/c-api/src/lib.rs +++ b/lib/c-api/src/lib.rs @@ -30,51 +30,9 @@ unreachable_patterns )] -use std::ffi::CString; -use std::mem; -use std::os::raw::c_char; - #[cfg(feature = "deprecated")] pub mod deprecated; pub mod error; mod ordered_resolver; +pub mod version; pub mod wasm_c_api; - -/// Gets the version of the Wasmer C API. -/// -/// The returned string is guaranteed to be a valid C string. The -/// caller owns the string, so it's up to the caller to free it. -/// -/// # Example -/// -/// ```rust -/// # use inline_c::assert_c; -/// # fn main() { -/// # (assert_c! { -/// # #include "tests/wasmer_wasm.h" -/// # -/// int main() { -/// // Read and print the version. -/// char* version = wasmer_version(); -/// printf("%s", version); -/// -/// // Free it, as we own it. -/// free(version); -/// -/// return 0; -/// } -/// # }) -/// # .success() -/// # .stdout(std::env::var("CARGO_PKG_VERSION").unwrap()); -/// # } -/// ``` -#[no_mangle] -pub extern "C" fn wasmer_version() -> *mut c_char { - let version = CString::new(env!("CARGO_PKG_VERSION")) - .expect("Failed to create a CString for the Wasmer C version"); - let ptr = version.as_ptr(); - - mem::forget(version); - - ptr as *mut _ -}