[libvirt] [PATCHv2] error: Fix typos in argument checking macros

Peter Krempa pkrempa at redhat.com
Tue Jun 19 14:19:02 UTC 2012


Macro virCheckNullArgGoto is supposed to check for NULL argument but
checks non-NULL instead.

Macro virCheckNonNullArgReturn reports error as if the argument should
be NULL when it shouldn't.
---
 src/internal.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/internal.h b/src/internal.h
index 1b1598b..60be95d 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -235,27 +235,27 @@
             virReportInvalidArg(flags,                                  \
                                 _("unsupported flags (0x%lx) in function %s"), \
                                 __unsuppflags, __FUNCTION__);           \
             return retval;                                              \
         }                                                               \
     } while (0)

 # define virCheckNonNullArgReturn(argname, retval)  \
     do {                                            \
         if (argname == NULL) {                      \
-            virReportInvalidNullArg(argname);       \
+            virReportInvalidNonNullArg(argname);    \
             return retval;                          \
         }                                           \
     } while (0)
 # define virCheckNullArgGoto(argname, label)        \
     do {                                            \
-        if (argname == NULL) {                      \
+        if (argname != NULL) {                      \
             virReportInvalidNullArg(argname);       \
             goto label;                             \
         }                                           \
     } while (0)
 # define virCheckNonNullArgGoto(argname, label)     \
     do {                                            \
         if (argname == NULL) {                      \
             virReportInvalidNonNullArg(argname);    \
             goto label;                             \
         }                                           \
-- 
1.7.8.6




More information about the libvir-list mailing list