Change in libosmocore[master]: follow-up to osmo_sockaddr_from/to_octets()
Attention is currently required from: neels. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/27085 ) Change subject: follow-up to osmo_sockaddr_from/to_octets() ...................................................................... Patch Set 1: (1 comment) File src/socket.c: https://gerrit.osmocom.org/c/libosmocore/+/27085/comment/04321114_283f779e PS1, Line 1779: os->u.sa.sa_family = AF_INET; This should have been kept as os->u.sin.sin_family, since here you already know you are using the struct sockaddr_in of the union. In the case above which I asked you change, it's more conceptually correct to check the generic struct sockaddr (os->u.sa) field instead of the struct sockaddr_in one (os->u.sin), since you still don't know at that point whether the osmo_sockaddr is from type sockaddr_in. In practice of course it doesn't matter since the os->u.sa.sa_family and os->u.sin.sin_family field point to same place in memory, but conceptually it makes sense to do it the way I say. Otherwise it's like accessing a subclass field without knowing whether the abstract class/interface is actually an instance of that subclass. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/27085 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id202f3fda51bea9149ab3462a2efe35cf08d8030 Gerrit-Change-Number: 27085 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> Gerrit-CC: pespin <pespin@sysmocom.de> Gerrit-Attention: neels <nhofmeyr@sysmocom.de> Gerrit-Comment-Date: Tue, 08 Feb 2022 10:43:58 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
participants (1)
-
pespin