提交 526df238 编写于 作者: A Alexander Monakov 提交者: Rich Felker

remove redundant condition in memccpy

Commit d9bdfd16 ("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.
上级 72658c65
......@@ -29,6 +29,6 @@ void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
#endif
for (; n && (*d=*s)!=c; n--, s++, d++);
tail:
if (n && *s==c) return d+1;
if (n) return d+1;
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册