Attention is currently required from: msuraev. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/28993 )
Change subject: Use osmo_sockaddr_strs_to_str() for multiaddr helper ......................................................................
Patch Set 8: Code-Review-1
(3 comments)
Patchset:
PS8: the code added in https://gerrit.osmocom.org/c/libosmocore/+/28992 should move to this function, as indicated below
File src/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/28993/comment/dda0b532_5a697daa PS8, Line 208: * buf_len >= 2: (hostA|hostB|...|...) (this doc is wrong)
https://gerrit.osmocom.org/c/libosmocore/+/28993/comment/16eeb34d_42c05fa7 PS8, Line 211: { if you use an implementation like this here, we don't need to add osmo_sockaddr_strs_to_str() at all and save a lot of dynamic allocations:
struct osmo_strbuf sb = { ... }; if (i != 1) OSMO_STRBUF_PRINTF(sb, "("); for (...) { struct osmo_sockaddr_str ss; if (i) OSMO_STRBUF_PRINTF(sb, "|"); osmo_sockaddr_str_from_str2(&ss, hosts[i]); OSMO_STRBUF_PRINTF(sb, OSMO_SOCKADDR_STR_FMT, OSMO_SOCKADDR_STR_FMT_ARGS(&ss)); } if (i != 1) OSMO_STRBUF_PRINTF(sb, ")"); return sb.chars_needed;