Page MenuHomeFreeBSD

Implement mempcpy(3) and wmempcpy(3)
ClosedPublic

Authored by kib on Jul 14 2021, 4:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 16, 1:16 PM
Unknown Object (File)
Mon, Oct 14, 6:26 AM
Unknown Object (File)
Sep 30 2024, 5:46 PM
Unknown Object (File)
Sep 30 2024, 3:32 PM
Unknown Object (File)
Sep 24 2024, 3:37 AM
Unknown Object (File)
Sep 23 2024, 1:18 PM
Unknown Object (File)
Sep 23 2024, 12:37 PM
Unknown Object (File)
Sep 23 2024, 11:23 AM
Subscribers
None

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jul 14 2021, 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.Jul 14 2021, 4:27 PM
kib marked an inline comment as done.Jul 14 2021, 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.Jul 14 2021, 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.Jul 15 2021, 2:02 PM