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)
Mar 10 2024, 9:04 PM
Unknown Object (File)
Mar 10 2024, 9:04 PM
Unknown Object (File)
Mar 10 2024, 9:04 PM
Unknown Object (File)
Mar 10 2024, 9:04 PM
Unknown Object (File)
Mar 10 2024, 9:04 PM
Unknown Object (File)
Mar 7 2024, 9:53 PM
Unknown Object (File)
Mar 7 2024, 3:58 PM
Unknown Object (File)
Feb 2 2024, 1:05 PM
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