no need to handle null result in alloc_buf
parent
3d06157dbc
commit
0b4f7573d2
|
@ -95,9 +95,6 @@ std::string_view string_pool::get(char const *ptr) const {
|
||||||
|
|
||||||
char *string_pool::alloc_buf(std::size_t len) const {
|
char *string_pool::alloc_buf(std::size_t len) const {
|
||||||
auto mem = cstate->alloc(nullptr, 0, len + sizeof(string_ref_state) + 1);
|
auto mem = cstate->alloc(nullptr, 0, len + sizeof(string_ref_state) + 1);
|
||||||
if (!mem) {
|
|
||||||
throw internal_error{"allocation failed"};
|
|
||||||
}
|
|
||||||
/* write length and initial refcount */
|
/* write length and initial refcount */
|
||||||
auto *sst = static_cast<string_ref_state *>(mem);
|
auto *sst = static_cast<string_ref_state *>(mem);
|
||||||
sst->length = len;
|
sst->length = len;
|
||||||
|
|
Loading…
Reference in New Issue