Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Removed custom allocator.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Sep 6, 2021
1 parent 3af5ffe commit e3f3155
Show file tree
Hide file tree
Showing 16 changed files with 139 additions and 592 deletions.
119 changes: 0 additions & 119 deletions src/alloc/alignment.rs

This file was deleted.

133 changes: 0 additions & 133 deletions src/alloc/mod.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/bitmap/bitmap_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ where

let iterator = iter.map(|left| op(left)).chain(std::iter::once(rem));

let buffer = MutableBuffer::from_trusted_len_iter(iterator);
let buffer = MutableBuffer::from_chunk_iter(iterator);

Bitmap::from_u8_buffer(buffer.into(), length)
Bitmap::from_u8_buffer(buffer, length)
}

/// Apply a bitwise operation `op` to one input and return the result as a [`Bitmap`].
Expand Down
14 changes: 4 additions & 10 deletions src/buffer/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::slice;
use std::{fmt::Debug, fmt::Formatter};
use std::{ptr::NonNull, sync::Arc};

use crate::alloc;
use crate::ffi;
use crate::types::NativeType;

Expand Down Expand Up @@ -79,11 +78,6 @@ impl<T: NativeType> Bytes<T> {
self.len
}

#[inline]
pub fn is_empty(&self) -> bool {
self.len == 0
}

#[inline]
pub fn ptr(&self) -> NonNull<T> {
self.ptr
Expand All @@ -94,9 +88,9 @@ impl<T: NativeType> Drop for Bytes<T> {
#[inline]
fn drop(&mut self) {
match &self.deallocation {
Deallocation::Native(capacity) => {
unsafe { alloc::free_aligned(self.ptr, *capacity) };
}
Deallocation::Native(capacity) => unsafe {
Vec::from_raw_parts(self.ptr.as_ptr(), self.len, *capacity);
},
// foreign interface knows how to deallocate itself.
Deallocation::Foreign(_) => (),
}
Expand Down Expand Up @@ -127,6 +121,6 @@ impl<T: NativeType> Debug for Bytes<T> {
}
}

// This is sound because `Bytes` is an imutable container
// This is sound because `Bytes` is an immutable container
unsafe impl<T: NativeType> Send for Bytes<T> {}
unsafe impl<T: NativeType> Sync for Bytes<T> {}
3 changes: 1 addition & 2 deletions src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ impl<T: NativeType> Buffer<T> {
}

/// Auxiliary method to create a new Buffer
#[inline]
pub fn from_bytes(bytes: Bytes<T>) -> Self {
pub(crate) fn from_bytes(bytes: Bytes<T>) -> Self {
let length = bytes.len();
Buffer {
data: Arc::new(bytes),
Expand Down
1 change: 0 additions & 1 deletion src/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod immutable;
mod mutable;

pub(crate) mod bytes;
pub(crate) mod util;

pub use immutable::Buffer;
pub use mutable::MutableBuffer;
Loading

0 comments on commit e3f3155

Please sign in to comment.