]> git.ipfire.org Git - thirdparty/systemd.git/commit
network: use a common helper to parse bounded ranges
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 16 Sep 2023 10:06:19 +0000 (12:06 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 22 Sep 2023 06:16:47 +0000 (08:16 +0200)
commit851cdffd1bfe7a1f2d3dfc0d343003aab6b44620
treed60ac8f76f5da23fa85cf9ef8d5f8b8cbc33ea36
parent3b6cabd806c6eb5eec4ac21c903a5033bea94e9d
network: use a common helper to parse bounded ranges

This compresses repetetive code and makes it easier to add new options
in networkd. The formatting of error messages becomes uniform. The
error message always specifies the rvalue literally, instead of using
a "descriptive name". This makes the message much easier to handle for
the user.

I opted to add just one parser, and wrap it with inline functions to proxy
the type. This is less verbose than copying functions for each type
separately, and the compiler should be able to get rid of the inline wrapper
almost entirely.

asserts are reordered to use the same order as the parameter list.
This makes the code easier to read.

No functional change intended, apart from the difference in error message
formatting.
src/network/netdev/bond.c
src/network/netdev/bridge.c
src/network/netdev/geneve.c
src/network/netdev/l2tp-tunnel.c
src/network/netdev/macvlan.c
src/network/netdev/tunnel.c
src/shared/conf-parser.c
src/shared/conf-parser.h