]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/resolve/resolved-dns-transaction.c
basic/in-addr-util: add IN_ADDR_TO_STRING
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Jun 2022 09:24:02 +0000 (11:24 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 6 Jun 2022 07:52:52 +0000 (09:52 +0200)
commit84dbb3fd83ef7d7e5b2ea02be1f492974384256c
tree8b709e5d9f164c9b8297a08dc328bd9c92e01d83
parentb547241728487c0dca22780241b04964f2eb37af
basic/in-addr-util: add IN_ADDR_TO_STRING

Since we don't need the error value, and the buffer is allocated with a fixed
size, the whole logic provided by in_addr_to_string() becomes unnecessary, so
it's enough to wrap inet_ntop() directly.

inet_ntop() can only fail with ENOSPC. But we specify a buffer that is supposed
to be large enough, so this should never fail. A bunch of tests of this are added.
This allows all the wrappers like strna(), strnull(), strempty() to be dropped.

The guard of 'if (DEBUG_LOGGING)' can be dropped from around log_debug(),
because log_debug() implements the check outside of the function call. But
log_link_debug() does not, so it we need it to avoid unnecessary evaluation of
the formatting.
23 files changed:
src/basic/in-addr-util.c
src/basic/in-addr-util.h
src/libsystemd-network/sd-dhcp6-client.c
src/libsystemd-network/sd-ipv4ll.c
src/libsystemd-network/sd-ndisc.c
src/libsystemd-network/sd-radv.c
src/libsystemd-network/test-ipv4ll-manual.c
src/network/netdev/l2tp-tunnel.c
src/network/networkd-address.c
src/network/networkd-bridge-mdb.c
src/network/networkd-dhcp6.c
src/network/networkd-ipv6ll.c
src/network/networkd-ndisc.c
src/network/networkd-neighbor.c
src/network/networkd-nexthop.c
src/nspawn/nspawn-expose-ports.c
src/resolve/resolved-bus.c
src/resolve/resolved-dns-cache.c
src/resolve/resolved-dns-transaction.c
src/resolve/resolved-manager.c
src/resolve/test-resolved-stream.c
src/test/test-in-addr-util.c
src/test/test-utmp.c