[libvirt PATCH 2/4] src: introduce VIR_UNLESS and VIR_ELSIF

Ján Tomko jtomko at redhat.com
Fri Apr 1 13:27:34 UTC 2022


Inspired by executable line noise, introduce more readable alternatives
to
    if (!(expr))
and
    else if

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/internal.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/internal.h b/src/internal.h
index 4cfb022b41..f8ca751014 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -548,3 +548,6 @@ enum {
 # define fprintf(fh, ...) g_fprintf(fh, __VA_ARGS__)
 
 #endif /* VIR_NO_GLIB_STDIO */
+
+#define VIR_UNLESS(e) if (!(e))
+#define VIR_ELSIF else if
-- 
2.34.1



More information about the libvir-list mailing list