Attention is currently required from: arehbein, laforge, neels, pespin.
daniel has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmocore/+/35079?usp=email )
Change subject: osmo_io: Remove union in struct osmo_io_ops
......................................................................
Patch Set 4:
(2 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/35079/comment/1bcca390_cafaad48
PS3, Line 546: if (iofd->io_ops.read_cb)
ah ok, read_cb happens to be in the same place as
recvfrom_cb, so only checking the one location wor […]
This fix is only necessary
after removing the union. I don't see how you could realize checking the exact member
with the union in place. I can basically stick an
```c
OSMO_ASSERT(&iofd->io_ops.read_cb == &iofd->io_ops.recvfrom_cb)
```
in here. Unless I'm missing something this is exactly the feature of the union,
afterwards you can't know whether this memory location was set as read_cb or
recvfrom_cb.
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/35079/comment/813d11cc_3e337a84
PS4, Line 391: || (iofd->mode == OSMO_IO_FD_MODE_RECVFROM_SENDTO &&
iofd->io_ops.recvfrom_cb));
this code should also work with the union present?
It "works" in the sense that it even returns true if mode == *_READ_WRITE
and .recvfrom_cb (or the other way around) is set since both function pointers are sharing
the same memory location.
--
To view, visit
https://gerrit.osmocom.org/c/libosmocore/+/35079?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I138d57843edc29000530bb7896bcb239002ecbec
Gerrit-Change-Number: 35079
Gerrit-PatchSet: 4
Gerrit-Owner: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: arehbein <arehbein(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: arehbein <arehbein(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 01 Dec 2023 10:05:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: daniel <dwillmann(a)sysmocom.de>
Gerrit-MessageType: comment