Am 07.08.2023 um 23:58 schrieb Tobias Nygren: > Is this sort of fix acceptable for the above cases? > > + ptrdiff_t offset = pos - buf; > new_buf = realloc(buf, buf_size); > - pos = new_buf + (pos - buf); > + pos = new_buf + offset;
Yes. Instead of ptrdiff_t, I prefer to use size_t to avoid having to include <stddef.h>, even if that means an additional type cast at WARNS=6 level: > + size_t offset = (size_t)(pos - buf); Roland