This commit is contained in:
gwenn
2020-10-28 21:12:29 +01:00
parent 5ce81024c8
commit 76ad2bf19c
7 changed files with 28 additions and 20 deletions

View File

@@ -100,6 +100,7 @@ impl std::fmt::Debug for SmallCString {
impl std::ops::Deref for SmallCString {
type Target = CStr;
#[inline]
fn deref(&self) -> &CStr {
self.as_cstr()

View File

@@ -130,9 +130,10 @@ impl SqliteMallocString {
// This is safe:
// - `align` is never 0
// - `align` is always a power of 2.
// - `size` needs no realignment because it's guaranteed to be
// aligned (everything is aligned to 1)
// - `size` is also never zero, although this function doesn't actually require it now.
// - `size` needs no realignment because it's guaranteed to be aligned
// (everything is aligned to 1)
// - `size` is also never zero, although this function doesn't actually require
// it now.
let layout = Layout::from_size_align_unchecked(s.len().saturating_add(1), 1);
// Note: This call does not return.
handle_alloc_error(layout);