mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
util: buffer: Simplify convoluted condition
Spare a few more lines rather than having a condition with a nested ternary. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
27bab9cac4
commit
a5217cd7c0
@ -64,11 +64,19 @@ virBufferAdjustIndent(virBufferPtr buf, int indent)
|
||||
{
|
||||
if (!buf || buf->error)
|
||||
return;
|
||||
if (indent > 0 ? INT_MAX - indent < buf->indent
|
||||
: buf->indent < -indent) {
|
||||
virBufferSetError(buf, -1);
|
||||
return;
|
||||
|
||||
if (indent > 0) {
|
||||
if (INT_MAX - indent < buf->indent) {
|
||||
virBufferSetError(buf, -1);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (buf->indent < -indent) {
|
||||
virBufferSetError(buf, -1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
buf->indent += indent;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user