mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Replace squirrel_away_unique by boxed::into_raw.
This commit is contained in:
parent
b655b54f80
commit
b5440a6257
2 changed files with 6 additions and 11 deletions
|
@ -15,9 +15,9 @@ use dom::window;
|
|||
|
||||
use libc;
|
||||
use libc::c_uint;
|
||||
use std::boxed;
|
||||
use std::cell::Cell;
|
||||
use std::ffi::CString;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use js::glue::UnwrapObject;
|
||||
use js::glue::{IsWrapper, RUST_JSID_IS_INT, RUST_JSID_TO_INT};
|
||||
|
@ -64,11 +64,6 @@ impl GlobalStaticData {
|
|||
}
|
||||
}
|
||||
|
||||
/// Leak the given pointer.
|
||||
pub unsafe fn squirrel_away_unique<T>(x: Box<T>) -> *const T {
|
||||
mem::transmute(x)
|
||||
}
|
||||
|
||||
// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and
|
||||
// LSetDOMProperty. Those constants need to be changed accordingly if this value
|
||||
// changes.
|
||||
|
@ -343,7 +338,7 @@ pub fn initialize_global(global: *mut JSObject) {
|
|||
([0 as *mut JSObject; PrototypeList::ID::Count as uint]);
|
||||
unsafe {
|
||||
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
||||
let box_ = squirrel_away_unique(proto_array);
|
||||
let box_ = boxed::into_raw(proto_array);
|
||||
JS_SetReservedSlot(global,
|
||||
DOM_PROTOTYPE_SLOT,
|
||||
PrivateValue(box_ as *const libc::c_void));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue