diff --git a/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs b/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs index 795b045136f..6ea27d01a8d 100644 --- a/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs +++ b/ports/geckolib/gecko_bindings/sugar/ns_t_array.rs @@ -32,19 +32,25 @@ impl nsTArray { 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) } } } diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 9282750d074..1a7fdb67c16 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -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};