Project

General

Profile

Feature #14 ยป 0013-astr_reserve-Drop-assert-of-parameter-with-nonnull-a.patch

Marko Lindqvist, 12/02/2023 01:00 AM

View differences:

utility/astring.c
functions etc.
Note one potential hazard: when the size is increased (astr_reserve()),
realloc (really fc_realloc) is used, which retains any data which
realloc (really fc_realloc()) is used, which retains any data which
was there previously, _but_: any external pointers into the allocated
memory may then become wild. So you cannot safely use such external
pointers into the astring data, except strictly between times when
......
unsigned int n1;
bool was_null = (astr->n == 0);
fc_assert_ret(NULL != astr);
astr->n = n;
if (n <= astr->n_alloc) {
return;
    (1-1/1)