Page MenuHomeFreeBSD

Implement mempcpy(3) and wmempcpy(3)
ClosedPublic

Authored by kib on Wed, Jul 14, 4:02 PM.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Wed, Jul 14, 4:02 PM
kib created this revision.
markj added inline comments.
lib/libc/string/mempcpy.c
38 ↗(On Diff #92190)

Shouldn't the restrict qualifier be used in the definition as well?

This revision is now accepted and ready to land.Wed, Jul 14, 4:27 PM
kib marked an inline comment as done.Wed, Jul 14, 6:03 PM
kib added inline comments.
lib/libc/string/mempcpy.c
38 ↗(On Diff #92190)

I always thought that not.

I was not able to find an answer in the standard from the cursory look, and think that it is not worth the time.

kib marked an inline comment as done.

Apply restrict to the args in declaration of wmempcpy as well.

This revision now requires review to proceed.Wed, Jul 14, 6:04 PM
lib/libc/string/mempcpy.c
38 ↗(On Diff #92190)

I am not sure either. The diff now uses __restrict in the wmempcpy() definition but not in the mempcpy() definition.

lib/libc/string/mempcpy.c
38 ↗(On Diff #92190)

Oh, I think that adding __restrict to mempcpy is a mistake. Look at the man page text for memcpy(3) about overlapping. On the other hand, memcpy() does has restrict on args.

Add __restrict to mempcpy(3) definition as well.

markj added inline comments.
lib/libc/string/mempcpy.c
38 ↗(On Diff #92190)

Indeed, though the memcpy() definition in bcopy.c does not use restrict.

This revision is now accepted and ready to land.Thu, Jul 15, 2:02 PM