Refactor istr_ensure_size to optimize malloc calls
Refactor istr_ensure_size to optimize malloc calls

realloc is now only called when istring->len is within 87.5% of istring->size
in an effort to reduce memory defragmentation. If the lengths are not close,
then the contents of the string are manually copied to prevent copying useless
bytes during the reallocation.

Signed-off-by: Todd Gaunt <73a39f9c029f21aae9d16ccf69cc2fd2198113f7@protonmail.ch>

toddgaunt/libstx,toddgaunt/libstx