aboutgitcodebugslistschat
path: root/util.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-09-28 14:33:12 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-09-29 12:21:41 +0200
commit84fec4e998b625f36f2d89dd9784ed4bb393631a (patch)
tree10a550d8ffe97e3d3f04e00ec67b30b93a28b3b8 /util.c
parenta1a058533c0cfaee621bf5d49ccd7d1e038550d9 (diff)
downloadpasst-84fec4e998b625f36f2d89dd9784ed4bb393631a.tar
passt-84fec4e998b625f36f2d89dd9784ed4bb393631a.tar.gz
passt-84fec4e998b625f36f2d89dd9784ed4bb393631a.tar.bz2
passt-84fec4e998b625f36f2d89dd9784ed4bb393631a.tar.lz
passt-84fec4e998b625f36f2d89dd9784ed4bb393631a.tar.xz
passt-84fec4e998b625f36f2d89dd9784ed4bb393631a.tar.zst
passt-84fec4e998b625f36f2d89dd9784ed4bb393631a.zip
Clean up parsing of port ranges
conf_ports() parses ranges of ports for the -t, -u, -T and -U options. The code is quite difficult to the follow, to the point that clang-tidy and cppcheck disagree on whether one of the pointers can be NULL at some points. Rework the code with the use of two new helper functions: * parse_port_range() operates a bit like strtoul(), but can parse a whole port range specification (e.g. '80' or '1000-1015') * next_chunk() does the necessary wrapping around strchr() to advance to just after the next given delimiter, while cleanly handling if there are no more delimiters The new version is easier to follow, and also removes some cppcheck warnings. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.c')
0 files changed, 0 insertions, 0 deletions