Re: [pcre-dev] memmove() vs. bcopy()

Top Page
Delete this message
Author: ph10
Date:  
To: Daniel Richard G.
CC: pcre-dev
Subject: Re: [pcre-dev] memmove() vs. bcopy()
On Wed, 8 Aug 2018, Daniel Richard G. wrote:

> The problem is that the code uses the return value from memmove(), but
> bcopy() does not return a value at all (void return type), so it cannot
> be used as a drop-in replacement for memmove().


Ha! I suspect that back in the day when bcopy/memmove was originally set
up, the return from memmove() was never used. In fact, I see that the
only place it *is* used is in pcre2test, not in the library itself
(which could do with some (void) casts to be pedantic).

> This appears to be a rare failure mode that has not been caught because
> very few systems lack memmove().


Indeed. It has, after all, been in the C Standard for decades.

> I would suggest something like moving bcopy() into the pcre2_memmove()
> function, along the lines of


<snip>

Yes, good idea. I'll do it. Thanks for the diagnosis and the solution.

Philip

--
Philip Hazel