On a Thursday in 2021, Peter Krempa wrote:
Tim pointed out that some of the code could be simplified a bit more
by
using virTristateBool parsing functions and also that strnlen could be
used instead of strlen.
This series does those cleanups as well as one further refactor of
character verification in virDomainDeviceLoadparmIsValid.
Peter Krempa (6):
util: enum: Add helpers for converting virTristate* to a plain bool
conf: seclabel: Parse booleans using virXMLPropTristateBool instead of
virStringParseYesNo
internal: Add STRLIM macro for checking string length using strnlen()
virDomainDeviceLoadparmIsValid: Simplify value lenght check
virDomainDeviceLoadparmIsValid: Use 'strspn' instead of a loop
conf: domain: Convert all string length checks to STRLIM
src/conf/domain_conf.c | 83 +++++++------------
src/internal.h | 9 ++
src/libvirt_private.syms | 2 +
src/util/virenum.c | 54 ++++++++++++
src/util/virenum.h | 2 +
.../machine-loadparm-s390-char-invalid.err | 2 +-
.../machine-loadparm-s390-len-invalid.err | 2 +-
7 files changed, 99 insertions(+), 55 deletions(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano