Skip to content

Commit

Permalink
Rename reserve_raw to realloc
Browse files Browse the repository at this point in the history
  • Loading branch information
noib3 committed Jan 2, 2025
1 parent f7b29d3 commit cb67a1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/types/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl StringBuilder {
};
let new_capacity =
min_capacity.checked_next_power_of_two().unwrap_or(min_capacity);
self.reserve_raw(new_capacity);
self.realloc(new_capacity);
}

/// Reserve space for exactly `additional` more bytes.
Expand All @@ -217,12 +217,12 @@ impl StringBuilder {
if let Some(new_capacity) =
self.min_capacity_for_additional(additional)
{
self.reserve_raw(new_capacity);
self.realloc(new_capacity);
}
}

/// Allocate new_capacity bytes.
fn reserve_raw(&mut self, new_capacity: NonZeroUsize) {
/// Reallocate the string with the given capacity.
fn realloc(&mut self, new_capacity: NonZeroUsize) {
let ptr = unsafe {
libc::realloc(
self.inner.data as *mut ffi::c_void,
Expand Down

0 comments on commit cb67a1c

Please sign in to comment.