diff options
author | Ting-Yu Wang <anivia@google.com> | 2021-04-12 18:33:22 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-12 18:35:09 -0700 |
commit | e5f58e89bbd376469073c749592d0fb0e3b4c6cb (patch) | |
tree | 6015e2edf4229f85f8a8d247c791295837416b69 /test/syscalls/linux/dev.cc | |
parent | 90900e4f8f6760f1de34e660030a0155cfd6b40a (diff) |
Make AsSockAddr() to replace reinterpret_cast<sockaddr*>
It's a common pattern in test code to reinterpret_cast<sockaddr*> from
sockaddr_* structs. Make AsSockAddr() for them so code looks better.
Note: Why not a wrapper type for `sockaddr_storage` and etc?
It's also a common need to have a local in-out variable of socklen_t.
Creating a wrapper type may however lead to this wrong code:
Wrapper addr;
socklen_t addrlen = sizeof(addr);
where sizeof(Wrapper) may not equal to sizeof(sockaddr_storage).
PiperOrigin-RevId: 368126229
Diffstat (limited to 'test/syscalls/linux/dev.cc')
0 files changed, 0 insertions, 0 deletions