Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad520ec

Browse files
committed
Use memmove() not memcpy() to slide some pointers down.
The previous coding here was formally undefined, though it seems toaccidentally work on most platforms in the buildfarm. Caught by someOpenBSD platforms in which libc contains an assertion check foroverlapping areas passed to memcpy().Thomas Munro
1 parent4c804fb commitad520ec

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/test/isolation/isolationtester.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
554554

555555
/* Remove that step from the waiting[] array. */
556556
if (w+1<nwaiting)
557-
memcpy(&waiting[w],&waiting[w+1],
558-
(nwaiting- (w+1))*sizeof(Step*));
557+
memmove(&waiting[w],&waiting[w+1],
558+
(nwaiting- (w+1))*sizeof(Step*));
559559
nwaiting--;
560560

561561
break;
@@ -582,8 +582,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
582582
/* This one finished, too! */
583583
errorstep[nerrorstep++]=waiting[w];
584584
if (w+1<nwaiting)
585-
memcpy(&waiting[w],&waiting[w+1],
586-
(nwaiting- (w+1))*sizeof(Step*));
585+
memmove(&waiting[w],&waiting[w+1],
586+
(nwaiting- (w+1))*sizeof(Step*));
587587
nwaiting--;
588588
}
589589
}
@@ -614,8 +614,8 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
614614
{
615615
errorstep[nerrorstep++]=waiting[w];
616616
if (w+1<nwaiting)
617-
memcpy(&waiting[w],&waiting[w+1],
618-
(nwaiting- (w+1))*sizeof(Step*));
617+
memmove(&waiting[w],&waiting[w+1],
618+
(nwaiting- (w+1))*sizeof(Step*));
619619
nwaiting--;
620620
}
621621
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp