On Mon, Aug 07, 2023 at 23:58:50 +0200, Tobias Nygren wrote:

> Is this sort of fix acceptable for the above cases?
[...]
> +                     ptrdiff_t offset = pos - buf;
[...]
> -                     pos = new_buf + (pos - buf);
> +                     pos = new_buf + offset;

I think so.  But e.g. in this particular case I don't see why pos
pointer is needed at all.  If pos is made into a size_t pos; index
into the buf instead of a separate pointer, one avoids the whole thing
and "end" can be g/c'ed too, b/c you can just compare the index to the
"buf_size".  But the above kind of fix has the advantage of being more
or less mechanical.

-uwe

Reply via email to