mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
virDomainDeviceLoadparmIsValid: Simplify value lenght check
Use the new STRLIM macro and unify it with the empty string check. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8eb7471eb3
commit
d23389d2b7
@ -6300,15 +6300,10 @@ virDomainDeviceLoadparmIsValid(const char *loadparm)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (virStringIsEmpty(loadparm)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("loadparm cannot be an empty string"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen(loadparm) > 8) {
|
||||
if (virStringIsEmpty(loadparm) || !STRLIM(loadparm, 8)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("loadparm '%s' exceeds 8 characters"), loadparm);
|
||||
_("loadparm value '%s' must be between 1 and 8 characters"),
|
||||
loadparm);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
internal error: loadparm 'LOADPARM1' exceeds 8 characters
|
||||
internal error: loadparm value 'LOADPARM1' must be between 1 and 8 characters
|
||||
|
Loading…
x
Reference in New Issue
Block a user