mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Use memmove() not memcpy() to slide some pointers down.
The previous coding here was formally undefined, though it seems to accidentally work on most platforms in the buildfarm. Caught by some OpenBSD platforms in which libc contains an assertion check for overlapping areas passed to memcpy(). Thomas Munro
This commit is contained in:
@ -554,8 +554,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
|
||||
|
||||
/* Remove that step from the waiting[] array. */
|
||||
if (w + 1 < nwaiting)
|
||||
memcpy(&waiting[w], &waiting[w + 1],
|
||||
(nwaiting - (w + 1)) * sizeof(Step *));
|
||||
memmove(&waiting[w], &waiting[w + 1],
|
||||
(nwaiting - (w + 1)) * sizeof(Step *));
|
||||
nwaiting--;
|
||||
|
||||
break;
|
||||
@ -582,8 +582,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
|
||||
/* This one finished, too! */
|
||||
errorstep[nerrorstep++] = waiting[w];
|
||||
if (w + 1 < nwaiting)
|
||||
memcpy(&waiting[w], &waiting[w + 1],
|
||||
(nwaiting - (w + 1)) * sizeof(Step *));
|
||||
memmove(&waiting[w], &waiting[w + 1],
|
||||
(nwaiting - (w + 1)) * sizeof(Step *));
|
||||
nwaiting--;
|
||||
}
|
||||
}
|
||||
@ -614,8 +614,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
|
||||
{
|
||||
errorstep[nerrorstep++] = waiting[w];
|
||||
if (w + 1 < nwaiting)
|
||||
memcpy(&waiting[w], &waiting[w + 1],
|
||||
(nwaiting - (w + 1)) * sizeof(Step *));
|
||||
memmove(&waiting[w], &waiting[w + 1],
|
||||
(nwaiting - (w + 1)) * sizeof(Step *));
|
||||
nwaiting--;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user