resizable: Inline some function in apfl_resizable_append
Profiling revealed that this gets called quite a lot
This commit is contained in:
parent
367961e711
commit
415d555736
1 changed files with 18 additions and 5 deletions
|
|
@ -215,15 +215,28 @@ apfl_resizable_splice(
|
|||
bool
|
||||
apfl_resizable_append(struct apfl_allocator allocator, size_t elem_size, void **mem, size_t *len, size_t *cap, const void *other_mem, size_t other_len)
|
||||
{
|
||||
return apfl_resizable_splice(
|
||||
if (other_len == 0 || other_mem == NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!apfl_resizable_ensure_cap_for_more_elements(
|
||||
allocator,
|
||||
elem_size,
|
||||
mem,
|
||||
len,
|
||||
cap,
|
||||
*len,
|
||||
0,
|
||||
other_mem,
|
||||
cap,
|
||||
other_len
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(
|
||||
((char *)(*mem)) + *len * elem_size,
|
||||
other_mem,
|
||||
other_len * elem_size
|
||||
);
|
||||
|
||||
*len += other_len;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue