|
|
@ -1615,7 +1615,8 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
|
|
|
|
size_t space = (*pool_head)->size - (*pool_head)->used;
|
|
|
|
size_t space = (*pool_head)->size - (*pool_head)->used;
|
|
|
|
size_t to_alloc = needed + sizeof(ast_string_field_allocation);
|
|
|
|
size_t to_alloc = needed + sizeof(ast_string_field_allocation);
|
|
|
|
|
|
|
|
|
|
|
|
if (__builtin_expect(to_alloc > space, 0)) {
|
|
|
|
/* This +1 accounts for alignment on SPARC */
|
|
|
|
|
|
|
|
if (__builtin_expect(to_alloc + 1 > space, 0)) {
|
|
|
|
size_t new_size = (*pool_head)->size;
|
|
|
|
size_t new_size = (*pool_head)->size;
|
|
|
|
|
|
|
|
|
|
|
|
while (new_size < to_alloc) {
|
|
|
|
while (new_size < to_alloc) {
|
|
|
@ -1632,6 +1633,13 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result = (*pool_head)->base + (*pool_head)->used;
|
|
|
|
result = (*pool_head)->base + (*pool_head)->used;
|
|
|
|
|
|
|
|
#ifdef __sparc__
|
|
|
|
|
|
|
|
/* SPARC requires that the allocation field be aligned. */
|
|
|
|
|
|
|
|
if ((long) result % sizeof(ast_string_field_allocation)) {
|
|
|
|
|
|
|
|
result++;
|
|
|
|
|
|
|
|
(*pool_head)->used++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
(*pool_head)->used += to_alloc;
|
|
|
|
(*pool_head)->used += to_alloc;
|
|
|
|
(*pool_head)->active += needed;
|
|
|
|
(*pool_head)->active += needed;
|
|
|
|
result += sizeof(ast_string_field_allocation);
|
|
|
|
result += sizeof(ast_string_field_allocation);
|
|
|
@ -1706,6 +1714,12 @@ void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
target = (*pool_head)->base + (*pool_head)->used + sizeof(ast_string_field_allocation);
|
|
|
|
target = (*pool_head)->base + (*pool_head)->used + sizeof(ast_string_field_allocation);
|
|
|
|
|
|
|
|
#ifdef __sparc__
|
|
|
|
|
|
|
|
if ((long) target % sizeof(ast_string_field_allocation)) {
|
|
|
|
|
|
|
|
target++;
|
|
|
|
|
|
|
|
space--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
available = space - sizeof(ast_string_field_allocation);
|
|
|
|
available = space - sizeof(ast_string_field_allocation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|