Commit d5a9a239 authored by Steven Fackler's avatar Steven Fackler
Browse files

More minor cleanup

parent c776534a
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -142,31 +142,28 @@ impl<T: Stackable> Ref<Stack<T>> {
    /// Returns a reference to the element at the given index in the
    /// stack or `None` if the index is out of bounds
    pub fn get(&self, idx: usize) -> Option<&Ref<T>> {
        unsafe {
            if idx >= self.len() {
                return None;
            }

        unsafe {
            let r = Ref::from_ptr(self._get(idx));

            Some(r)
            Some(Ref::from_ptr(self._get(idx)))
        }
    }

    /// Returns a mutable reference to the element at the given index in the
    /// stack or `None` if the index is out of bounds
    pub fn get_mut(&mut self, idx: usize) -> Option<&mut Ref<T>> {
        unsafe {
            if idx >= self.len() {
                return None;
            }

        unsafe {
            Some(Ref::from_ptr_mut(self._get(idx)))
        }
    }

    unsafe fn _get(&self, idx: usize) -> *mut T::CType {
        assert!(idx <= c_int::max_value() as usize);
        OPENSSL_sk_value(self.as_stack(), idx as c_int) as *mut _
    }
}