]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Convert virSecurityReportError into a macro
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 11 Feb 2010 23:18:54 +0000 (00:18 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 15 Feb 2010 09:45:25 +0000 (10:45 +0100)
The virRaiseError macro inside of virSecurityReportError expands to
virRaiseErrorFull and includes the __FILE__, __FUNCTION__ and __LINE__
information. But this three values are always the same for every call
to virSecurityReportError and do not reflect the actual error context.

Converting virSecurityReportError into a macro results in getting the
correct __FILE__, __FUNCTION__ and __LINE__ information.

src/security/security_driver.c
src/security/security_driver.h

index 27945a6697cffff1de7f16ea91a375a2e81219f9..4c98190e10add607c2fe4a3cd8e7a32b255f8ec2 100644 (file)
@@ -90,24 +90,6 @@ virSecurityDriverStartup(virSecurityDriverPtr *drv,
     return -2;
 }
 
-void
-virSecurityReportError(int code, const char *fmt, ...)
-{
-    va_list args;
-    char errorMessage[1024];
-
-    if (fmt) {
-        va_start(args, fmt);
-        vsnprintf(errorMessage, sizeof(errorMessage) - 1, fmt, args);
-        va_end(args);
-    } else
-        errorMessage[0] = '\0';
-
-    virRaiseError(NULL, NULL, NULL, VIR_FROM_SECURITY, code,
-                  VIR_ERR_ERROR, NULL, NULL, NULL, -1, -1, "%s",
-                  errorMessage);
-}
-
 /*
  * Helpers
  */
index 8860d814315fff74ffdd08d02f941480c9e77d84..15671b3601399624010d9180f6e285ad3b852d60 100644 (file)
@@ -88,9 +88,9 @@ int virSecurityDriverStartup(virSecurityDriverPtr *drv,
 int
 virSecurityDriverVerify(virDomainDefPtr def);
 
-void
-virSecurityReportError(int code, const char *fmt, ...)
-    ATTRIBUTE_FMT_PRINTF(2, 3);
+#define virSecurityReportError(code, fmt...)                        \
+    virReportErrorHelper(NULL, VIR_FROM_SECURITY, code, __FILE__,   \
+                         __FUNCTION__, __LINE__, fmt)
 
 /* Helpers */
 void virSecurityDriverInit(virSecurityDriverPtr drv);