summaryrefslogtreecommitdiff
path: root/src/snapshot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/snapshot.rs')
-rw-r--r--src/snapshot.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/snapshot.rs b/src/snapshot.rs
index 4774ba43f..fa7837ede 100644
--- a/src/snapshot.rs
+++ b/src/snapshot.rs
@@ -1,19 +1,9 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
use libdeno::deno_buf;
-use std;
pub fn deno_snapshot() -> deno_buf {
let data =
include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_deno.bin"));
- let ptr = data.as_ptr();
- // TODO The cast is not necessary here. deno_buf specifies mutable
- // pointers when it doesn't necessarally need mutable. So maybe the deno_buf
- // type should be broken into a mutable and non-mutable version?
- let ptr_mut = ptr as *mut u8;
- deno_buf {
- alloc_ptr: std::ptr::null_mut(),
- alloc_len: 0,
- data_ptr: ptr_mut,
- data_len: data.len(),
- }
+
+ unsafe { deno_buf::from_raw_parts(data.as_ptr(), data.len()) }
}