提交 4616ff52 编写于 作者: D Daniel P. Berrange 提交者: Guido Günther

Introduce virReportError macro for general error reporting

Nearly every source file does something like

  #define VIR_FROM_THIS VIR_FROM_FOO
  #define virFooReportErorr(code, ...) \
     virReportErrorHelper(VIR_FROM_THIS, code,  __FILE__,    \
                          __FUNCTION__, __LINE__, \
                          __VA_ARGS__)

This creates needless duplication and inconsistent error
reporting function names in each file. It is trivial to
just have virterror_internal.h provide a virReportError
macro that is equivalent

* src/util/virterror_internal.h: Define virReportError(code, ...)
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>

(cherry picked from commit 7e94acd4)
上级 5adafc83
......@@ -560,6 +560,7 @@ msg_gen_function += virNetworkReportError
msg_gen_function += virNodeDeviceReportError
msg_gen_function += virNWFilterReportError
msg_gen_function += virRaiseError
msg_gen_function += virReportError
msg_gen_function += virReportErrorHelper
msg_gen_function += virReportSystemError
msg_gen_function += virSecretReportError
......
......@@ -40,9 +40,6 @@
#include "util.h"
#include "virstring.h"
#include "ignore-value.h"
#define virReportError(code, ...) \
virReportErrorHelper(VIR_FROM_NONE, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
#define VIR_FROM_THIS VIR_FROM_NONE
......
......@@ -76,6 +76,9 @@ void virReportOOMErrorFull(int domcode,
# define virReportOOMError() \
virReportOOMErrorFull(VIR_FROM_THIS, __FILE__, __FUNCTION__, __LINE__)
# define virReportError(code, ...) \
virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
int virSetError(virErrorPtr newerr);
void virDispatchError(virConnectPtr conn);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册