GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

Commit b7637c46 authored by qinsoon's avatar qinsoon

use c string in mu_fastimpl_new_with_opts

parent f79120b2
......@@ -122,14 +122,26 @@ impl MuVM {
pub extern fn mu_fastimpl_new() -> *mut CMuVM {
pub extern fn mu_fastimpl_new_with_opts(opts: &str) -> *mut CMuVM {
pub extern fn mu_fastimpl_new_with_opts(opts: *const c_char) -> *mut CMuVM {
info!("Creating Mu micro VM fast implementation instance...");
let mvm = Box::new(MuVM::new(opts));
let str_opts = {
if opts == ptr::null() {
} else {
let cstr = unsafe {CStr::from_ptr(opts)};
match cstr.to_str() {
Ok(str) => str,
Err(_) => panic!("invalid utf8 string as options: {:?}", cstr)
let mvm = Box::new(MuVM::new(str_opts));
let mvm_ptr = Box::into_raw(mvm);
debug!("The MuVM instance address: {:?}", mvm_ptr);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment