[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]