mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-25 07:32:06 +03:00
remove redundant condition in memccpy
Commit d9bdfd164
("fix memccpy to not access buffer past given size")
correctly added a check for 'n' nonzero, but made the pre-existing test
'*s==c' redundant: n!=0 implies *s==c. Remove the unnecessary check.
Reported by Alexey Izbyshev.
This commit is contained in:
parent
72658c658b
commit
526df238d0
@ -29,6 +29,6 @@ void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
|
|||||||
#endif
|
#endif
|
||||||
for (; n && (*d=*s)!=c; n--, s++, d++);
|
for (; n && (*d=*s)!=c; n--, s++, d++);
|
||||||
tail:
|
tail:
|
||||||
if (n && *s==c) return d+1;
|
if (n) return d+1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user