mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
stylo: Refactor nsTArray sugar and remove unused import
This commit is contained in:
parent
decf8c40f7
commit
33829b470a
2 changed files with 11 additions and 5 deletions
|
@ -32,19 +32,25 @@ impl<T> nsTArray<T> {
|
|||
self.header().mLength
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn slice_begin(&self) -> *mut T {
|
||||
debug_assert!(!self.mBuffer.is_null());
|
||||
(self.mBuffer as *const nsTArrayHeader).offset(1) as *mut _
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn ptr_at_mut(&mut self, index: u32) -> *mut T {
|
||||
debug_assert!(index <= self.len());
|
||||
unsafe {
|
||||
let slice_begin = (self.mBuffer as *const nsTArrayHeader).offset(1) as *mut T;
|
||||
slice_begin.offset(index as isize)
|
||||
self.slice_begin().offset(index as isize)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn ptr_at(&self, index: u32) -> *const T {
|
||||
debug_assert!(index <= self.len());
|
||||
unsafe {
|
||||
let slice_begin = (self.mBuffer as *const nsTArrayHeader).offset(1) as *const T;
|
||||
slice_begin.offset(index as isize)
|
||||
self.slice_begin().offset(index as isize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use gecko_bindings::bindings::{Gecko_CopyMozBindingFrom, Gecko_CopyListStyleType
|
|||
use gecko_bindings::bindings::{Gecko_SetMozBinding, Gecko_SetListStyleType};
|
||||
use gecko_bindings::bindings::{Gecko_SetNullImageValue, Gecko_SetGradientImageValue};
|
||||
use gecko_bindings::bindings::{Gecko_CreateGradient};
|
||||
use gecko_bindings::bindings::{Gecko_SetGradientStop, Gecko_CopyImageValueFrom};
|
||||
use gecko_bindings::bindings::{Gecko_CopyImageValueFrom};
|
||||
use gecko_bindings::structs;
|
||||
use glue::ArcHelpers;
|
||||
use std::fmt::{self, Debug};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue