提交 65d6a1df 编写于 作者: J Jonathon Jongsma 提交者: Ján Tomko

util: log: use #pragma once in headers

Signed-off-by: NJonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 2edd1c1d
......@@ -19,13 +19,12 @@
*
*/
#ifndef LIBVIRT_VIRLOG_H
# define LIBVIRT_VIRLOG_H
#pragma once
# include "internal.h"
# include "virbuffer.h"
#include "internal.h"
#include "virbuffer.h"
# ifdef PACKAGER_VERSION
#ifdef PACKAGER_VERSION
# ifdef PACKAGER
# define VIR_LOG_VERSION_STRING \
"libvirt version: " VERSION ", package: " PACKAGER_VERSION " (" PACKAGER ")"
......@@ -33,10 +32,10 @@
# define VIR_LOG_VERSION_STRING \
"libvirt version: " VERSION ", package: " PACKAGER_VERSION
# endif
# else
#else
# define VIR_LOG_VERSION_STRING \
"libvirt version: " VERSION
# endif
#endif
/*
* To be made public
......@@ -48,7 +47,7 @@ typedef enum {
VIR_LOG_ERROR,
} virLogPriority;
# define VIR_LOG_DEFAULT VIR_LOG_WARN
#define VIR_LOG_DEFAULT VIR_LOG_WARN
typedef enum {
VIR_LOG_TO_STDERR = 0,
......@@ -73,7 +72,7 @@ struct _virLogSource {
* log statements in a file are conditionally disabled
* at compile time due to configure options.
*/
# define VIR_LOG_INIT(n) \
#define VIR_LOG_INIT(n) \
static ATTRIBUTE_UNUSED virLogSource virLogSelf = { \
.name = "" n "", \
.priority = VIR_LOG_ERROR, \
......@@ -86,10 +85,10 @@ struct _virLogSource {
* are printed to stderr for debugging or to an appropriate channel
* defined at runtime from the libvirt daemon configuration file
*/
# ifdef ENABLE_DEBUG
#ifdef ENABLE_DEBUG
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__)
# else
#else
/**
* virLogEatParams:
*
......@@ -102,22 +101,22 @@ static inline void virLogEatParams(virLogSourcePtr unused, ...)
}
# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \
virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__)
# endif /* !ENABLE_DEBUG */
#endif /* !ENABLE_DEBUG */
# define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
#define VIR_INFO_INT(src, filename, linenr, funcname, ...) \
virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__)
# define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
#define VIR_WARN_INT(src, filename, linenr, funcname, ...) \
virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, NULL, __VA_ARGS__)
# define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \
#define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \
virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, NULL, __VA_ARGS__)
# define VIR_DEBUG(...) \
#define VIR_DEBUG(...) \
VIR_DEBUG_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
# define VIR_INFO(...) \
#define VIR_INFO(...) \
VIR_INFO_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
# define VIR_WARN(...) \
#define VIR_WARN(...) \
VIR_WARN_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
# define VIR_ERROR(...) \
#define VIR_ERROR(...) \
VIR_ERROR_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__)
......@@ -238,5 +237,3 @@ int virLogParseOutputs(const char *src,
virLogOutputPtr **outputs) ATTRIBUTE_NONNULL(1);
int virLogParseFilters(const char *src,
virLogFilterPtr **filters) ATTRIBUTE_NONNULL(1);
#endif /* LIBVIRT_VIRLOG_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册