]> git.ipfire.org Git - thirdparty/libvirt.git/commit
internal: Add STRLIM macro for checking string length using strnlen()
authorPeter Krempa <pkrempa@redhat.com>
Wed, 24 Nov 2021 16:03:07 +0000 (17:03 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 1 Dec 2021 12:39:47 +0000 (13:39 +0100)
commit8eb7471eb360f627e2b80bc75bd4552785b9625c
treed828ab6213325717725526e4796f0b96b1d1786b
parent92204134806ba4c41ba6cbc20ad2408015e7f3d5
internal: Add STRLIM macro for checking string length using strnlen()

As a microoprimization when checking whether length of a string fits
into a limit we don't necessarily need to calculate the full length but
can use strnlen to check only LIMIT+1 chars. Add a macro which will
simplify the expressions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/internal.h