mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
Fixed use of const with "macros" in FreeBSD's if_dl.d. (#15742)
LLADDR, CLLADDR, and LLINDEX were macros to begin with, so they obviously weren't as worried about const as we have to be when they're functions, and I screwed up the constness, so this fixes it. LLADDR gives a mutable pointer back, so of course, it should take a mutable pointer, which it already did. CLLADDR gives a const pointer back, so it makes sense for it to take const. LLINDEX returns a ushort, so the constness of the pointer is irrelevant, so it makes more sense for it to accept const. I also templatized them all so that the attributes wouldn't matter. It also makes them more like macros in that there's no function compiled into druntime, though I don't know that that actually matters.
This commit is contained in:
parent
a8fa992a73
commit
d6b9c47a0a
1 changed files with 3 additions and 3 deletions
|
@ -29,9 +29,9 @@ struct sockaddr_dl
|
|||
ubyte[46] sdl_data;
|
||||
}
|
||||
|
||||
auto LLADDR(sockaddr_dl* s) { return cast(caddr_t)(s.sdl_data.ptr + s.sdl_nlen); }
|
||||
auto CLLADDR(sockaddr_dl* s) { return cast(c_caddr_t)(s.sdl_data.ptr + s.sdl_nlen); }
|
||||
auto LLINDEX(sockaddr_dl* s) { return s.sdl_index; }
|
||||
auto LLADDR()(sockaddr_dl* s) { return cast(caddr_t)(s.sdl_data.ptr + s.sdl_nlen); }
|
||||
auto CLLADDR()(const sockaddr_dl* s) { return cast(c_caddr_t)(s.sdl_data.ptr + s.sdl_nlen); }
|
||||
ushort LLINDEX()(const sockaddr_dl* s) { return s.sdl_index; }
|
||||
|
||||
struct ifnet;
|
||||
sockaddr_dl* link_alloc_sdl(size_t, int);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue