[libvirt] [PATCH 45/46] tools: use #pragma once in headers

Jonathon Jongsma jjongsma at redhat.com
Tue Jun 18 16:13:15 UTC 2019


Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 tools/nss/libvirt_nss.h              | 27 ++++-----
 tools/virsh-completer.h              |  6 +-
 tools/virsh-console.h                | 11 ++--
 tools/virsh-domain-monitor.h         |  7 +--
 tools/virsh-domain.h                 |  7 +--
 tools/virsh-host.h                   |  7 +--
 tools/virsh-interface.h              |  9 +--
 tools/virsh-network.h                |  9 +--
 tools/virsh-nodedev.h                |  7 +--
 tools/virsh-nwfilter.h               | 11 ++--
 tools/virsh-pool.h                   |  9 +--
 tools/virsh-secret.h                 |  7 +--
 tools/virsh-snapshot.h               |  7 +--
 tools/virsh-util.h                   | 11 ++--
 tools/virsh-volume.h                 |  9 +--
 tools/virsh.h                        | 77 ++++++++++++------------
 tools/virt-admin-completer.h         |  6 +-
 tools/virt-admin.h                   | 11 ++--
 tools/virt-host-validate-bhyve.h     |  5 +-
 tools/virt-host-validate-common.h    | 13 ++---
 tools/virt-host-validate-lxc.h       |  5 +-
 tools/virt-host-validate-qemu.h      |  5 +-
 tools/vsh-table.h                    |  7 +--
 tools/vsh.h                          | 87 ++++++++++++++--------------
 tools/wireshark/src/packet-libvirt.h |  5 +-
 25 files changed, 146 insertions(+), 219 deletions(-)

diff --git a/tools/nss/libvirt_nss.h b/tools/nss/libvirt_nss.h
index 4c7525a0d0..75a2e4fd93 100644
--- a/tools/nss/libvirt_nss.h
+++ b/tools/nss/libvirt_nss.h
@@ -23,17 +23,16 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_NSS_H
-# define LIBVIRT_NSS_H
+#pragma once
 
-# include <nss.h>
-# include <netdb.h>
+#include <nss.h>
+#include <netdb.h>
 
-# if !defined(LIBVIRT_NSS_GUEST)
-#  define NSS_NAME(s) _nss_libvirt_##s##_r
-# else
-#  define NSS_NAME(s) _nss_libvirt_guest_##s##_r
-# endif
+#if !defined(LIBVIRT_NSS_GUEST)
+# define NSS_NAME(s) _nss_libvirt_##s##_r
+#else
+# define NSS_NAME(s) _nss_libvirt_guest_##s##_r
+#endif
 
 enum nss_status
 NSS_NAME(gethostbyname)(const char *name, struct hostent *result,
@@ -48,17 +47,15 @@ enum nss_status
 NSS_NAME(gethostbyname3)(const char *name, int af, struct hostent *result,
                          char *buffer, size_t buflen, int *errnop,
                          int *herrnop, int32_t *ttlp, char **canonp);
-# ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
+#ifdef HAVE_STRUCT_GAIH_ADDRTUPLE
 enum nss_status
 NSS_NAME(gethostbyname4)(const char *name, struct gaih_addrtuple **pat,
                          char *buffer, size_t buflen, int *errnop,
                          int *herrnop, int32_t *ttlp);
-# endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
+#endif /* HAVE_STRUCT_GAIH_ADDRTUPLE */
 
-# if defined(HAVE_BSD_NSS)
+#if defined(HAVE_BSD_NSS)
 ns_mtab*
 nss_module_register(const char *name, unsigned int *size,
                     nss_module_unregister_fn *unregister);
-# endif /* HAVE_BSD_NSS */
-
-#endif /* LIBVIRT_NSS_H */
+#endif /* HAVE_BSD_NSS */
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index cd3cc9ecae..9b3951f4fd 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_COMPLETER_H
-# define LIBVIRT_VIRSH_COMPLETER_H
+#pragma once
 
-# include "vsh.h"
+#include "vsh.h"
 
 char ** virshDomainNameCompleter(vshControl *ctl,
                                  const vshCmd *cmd,
@@ -118,4 +117,3 @@ char ** virshCellnoCompleter(vshControl *ctl,
 char ** virshDomainShutdownModeCompleter(vshControl *ctl,
                                          const vshCmd *cmd,
                                          unsigned int flags);
-#endif /* LIBVIRT_VIRSH_COMPLETER_H */
diff --git a/tools/virsh-console.h b/tools/virsh-console.h
index bc1a70b518..e89484d24b 100644
--- a/tools/virsh-console.h
+++ b/tools/virsh-console.h
@@ -18,18 +18,15 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_CONSOLE_H
-# define LIBVIRT_VIRSH_CONSOLE_H
+#pragma once
 
-# ifndef WIN32
+#ifndef WIN32
 
-#  include <virsh.h>
+# include <virsh.h>
 
 int virshRunConsole(vshControl *ctl,
                     virDomainPtr dom,
                     const char *dev_name,
                     unsigned int flags);
 
-# endif /* !WIN32 */
-
-#endif /* LIBVIRT_VIRSH_CONSOLE_H */
+#endif /* !WIN32 */
diff --git a/tools/virsh-domain-monitor.h b/tools/virsh-domain-monitor.h
index d24e0bbd40..77e83502db 100644
--- a/tools/virsh-domain-monitor.h
+++ b/tools/virsh-domain-monitor.h
@@ -18,15 +18,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_DOMAIN_MONITOR_H
-# define LIBVIRT_VIRSH_DOMAIN_MONITOR_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 char *virshGetDomainDescription(vshControl *ctl, virDomainPtr dom,
                                 bool title, unsigned int flags)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
 
 extern const vshCmdDef domMonitoringCmds[];
-
-#endif /* LIBVIRT_VIRSH_DOMAIN_MONITOR_H */
diff --git a/tools/virsh-domain.h b/tools/virsh-domain.h
index 119d4422a1..02996d51b1 100644
--- a/tools/virsh-domain.h
+++ b/tools/virsh-domain.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_DOMAIN_H
-# define LIBVIRT_VIRSH_DOMAIN_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 struct virshDomainEventCallback {
     const char *name;
@@ -32,5 +31,3 @@ typedef struct virshDomainEventCallback virshDomainEventCallback;
 extern virshDomainEventCallback virshDomainEventCallbacks[];
 
 extern const vshCmdDef domManagementCmds[];
-
-#endif /* LIBVIRT_VIRSH_DOMAIN_H */
diff --git a/tools/virsh-host.h b/tools/virsh-host.h
index 395e39cd57..f4c2aa316d 100644
--- a/tools/virsh-host.h
+++ b/tools/virsh-host.h
@@ -18,11 +18,8 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_HOST_H
-# define LIBVIRT_VIRSH_HOST_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 extern const vshCmdDef hostAndHypervisorCmds[];
-
-#endif /* LIBVIRT_VIRSH_HOST_H */
diff --git a/tools/virsh-interface.h b/tools/virsh-interface.h
index e110e3a8e2..ad7bf36ab4 100644
--- a/tools/virsh-interface.h
+++ b/tools/virsh-interface.h
@@ -18,20 +18,17 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_INTERFACE_H
-# define LIBVIRT_VIRSH_INTERFACE_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 virInterfacePtr virshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
                                            const char *optname,
                                            const char **name, unsigned int flags);
 
 /* default is lookup by Name and MAC */
-# define virshCommandOptInterface(_ctl, _cmd, _name) \
+#define virshCommandOptInterface(_ctl, _cmd, _name) \
     virshCommandOptInterfaceBy(_ctl, _cmd, NULL, _name, \
                                VIRSH_BYMAC | VIRSH_BYNAME)
 
 extern const vshCmdDef ifaceCmds[];
-
-#endif /* LIBVIRT_VIRSH_INTERFACE_H */
diff --git a/tools/virsh-network.h b/tools/virsh-network.h
index 18b8e4365f..3c786dd7a1 100644
--- a/tools/virsh-network.h
+++ b/tools/virsh-network.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_NETWORK_H
-# define LIBVIRT_VIRSH_NETWORK_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 virNetworkPtr
 virshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
@@ -33,7 +32,7 @@ virshCommandOptNetworkPort(vshControl *ctl, const vshCmd *cmd,
                            const char **name);
 
 /* default is lookup by Name and UUID */
-# define virshCommandOptNetwork(_ctl, _cmd, _name) \
+#define virshCommandOptNetwork(_ctl, _cmd, _name) \
     virshCommandOptNetworkBy(_ctl, _cmd, _name, \
                              VIRSH_BYUUID | VIRSH_BYNAME)
 
@@ -46,5 +45,3 @@ typedef struct virshNetworkEventCallback virshNetworkEventCallback;
 extern virshNetworkEventCallback virshNetworkEventCallbacks[];
 
 extern const vshCmdDef networkCmds[];
-
-#endif /* LIBVIRT_VIRSH_NETWORK_H */
diff --git a/tools/virsh-nodedev.h b/tools/virsh-nodedev.h
index e58eedf6ea..9691b0db4d 100644
--- a/tools/virsh-nodedev.h
+++ b/tools/virsh-nodedev.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_NODEDEV_H
-# define LIBVIRT_VIRSH_NODEDEV_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 struct virshNodedevEventCallback {
     const char *name;
@@ -32,5 +31,3 @@ typedef struct virshNodedevEventCallback virshNodedevEventCallback;
 extern virshNodedevEventCallback virshNodedevEventCallbacks[];
 
 extern const vshCmdDef nodedevCmds[];
-
-#endif /* LIBVIRT_VIRSH_NODEDEV_H */
diff --git a/tools/virsh-nwfilter.h b/tools/virsh-nwfilter.h
index 2ac9bdff7f..e29a8903e5 100644
--- a/tools/virsh-nwfilter.h
+++ b/tools/virsh-nwfilter.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_NWFILTER_H
-# define LIBVIRT_VIRSH_NWFILTER_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 virNWFilterPtr
 virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd,
@@ -32,14 +31,12 @@ virshCommandOptNWFilterBindingBy(vshControl *ctl, const vshCmd *cmd,
                                  const char **name, unsigned int flags);
 
 /* default is lookup by Name and UUID */
-# define virshCommandOptNWFilter(_ctl, _cmd, _name) \
+#define virshCommandOptNWFilter(_ctl, _cmd, _name) \
     virshCommandOptNWFilterBy(_ctl, _cmd, _name, \
                               VIRSH_BYUUID | VIRSH_BYNAME)
 
 /* default is lookup by port dev */
-# define virshCommandOptNWFilterBinding(_ctl, _cmd, _name) \
+#define virshCommandOptNWFilterBinding(_ctl, _cmd, _name) \
     virshCommandOptNWFilterBindingBy(_ctl, _cmd, _name, 0)
 
 extern const vshCmdDef nwfilterCmds[];
-
-#endif /* LIBVIRT_VIRSH_NWFILTER_H */
diff --git a/tools/virsh-pool.h b/tools/virsh-pool.h
index 458e843d3c..219f0eea42 100644
--- a/tools/virsh-pool.h
+++ b/tools/virsh-pool.h
@@ -18,17 +18,16 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_POOL_H
-# define LIBVIRT_VIRSH_POOL_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 virStoragePoolPtr
 virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
                       const char **name, unsigned int flags);
 
 /* default is lookup by Name and UUID */
-# define virshCommandOptPool(_ctl, _cmd, _optname, _name) \
+#define virshCommandOptPool(_ctl, _cmd, _optname, _name) \
     virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
                           VIRSH_BYUUID | VIRSH_BYNAME)
 
@@ -41,5 +40,3 @@ typedef struct virshPoolEventCallback virshPoolEventCallback;
 extern virshPoolEventCallback virshPoolEventCallbacks[];
 
 extern const vshCmdDef storagePoolCmds[];
-
-#endif /* LIBVIRT_VIRSH_POOL_H */
diff --git a/tools/virsh-secret.h b/tools/virsh-secret.h
index 71271f7c80..6ebe573f87 100644
--- a/tools/virsh-secret.h
+++ b/tools/virsh-secret.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_SECRET_H
-# define LIBVIRT_VIRSH_SECRET_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 struct virshSecretEventCallback {
     const char *name;
@@ -32,5 +31,3 @@ typedef struct virshSecretEventCallback virshSecretEventCallback;
 extern virshSecretEventCallback virshSecretEventCallbacks[];
 
 extern const vshCmdDef secretCmds[];
-
-#endif /* LIBVIRT_VIRSH_SECRET_H */
diff --git a/tools/virsh-snapshot.h b/tools/virsh-snapshot.h
index c9e706ded6..49517a4235 100644
--- a/tools/virsh-snapshot.h
+++ b/tools/virsh-snapshot.h
@@ -18,11 +18,8 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_SNAPSHOT_H
-# define LIBVIRT_VIRSH_SNAPSHOT_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 extern const vshCmdDef snapshotCmds[];
-
-#endif /* LIBVIRT_VIRSH_SNAPSHOT_H */
diff --git a/tools/virsh-util.h b/tools/virsh-util.h
index fb2ed277af..55520302ff 100644
--- a/tools/virsh-util.h
+++ b/tools/virsh-util.h
@@ -16,13 +16,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_UTIL_H
-# define LIBVIRT_VIRSH_UTIL_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
-# include <libxml/parser.h>
-# include <libxml/xpath.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
 
 virDomainPtr
 virshLookupDomainBy(vshControl *ctl,
@@ -103,5 +102,3 @@ virshDomainGetXML(vshControl *ctl,
                   xmlXPathContextPtr *ctxt)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4)
     ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
-
-#endif /* LIBVIRT_VIRSH_UTIL_H */
diff --git a/tools/virsh-volume.h b/tools/virsh-volume.h
index 66cf9cfa54..15cab0fd8c 100644
--- a/tools/virsh-volume.h
+++ b/tools/virsh-volume.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_VOLUME_H
-# define LIBVIRT_VIRSH_VOLUME_H
+#pragma once
 
-# include "virsh.h"
+#include "virsh.h"
 
 virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
                                       const char *optname,
@@ -29,10 +28,8 @@ virStorageVolPtr virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
                                       const char **name, unsigned int flags);
 
 /* default is lookup by Name and UUID */
-# define virshCommandOptVol(_ctl, _cmd, _optname, _pooloptname, _name) \
+#define virshCommandOptVol(_ctl, _cmd, _optname, _pooloptname, _name) \
     virshCommandOptVolBy(_ctl, _cmd, _optname, _pooloptname, _name, \
                          VIRSH_BYUUID | VIRSH_BYNAME)
 
 extern const vshCmdDef storageVolCmds[];
-
-#endif /* LIBVIRT_VIRSH_VOLUME_H */
diff --git a/tools/virsh.h b/tools/virsh.h
index 254ce3289e..847ed25151 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -18,46 +18,45 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRSH_H
-# define LIBVIRT_VIRSH_H
+#pragma once
 
-# include <stdarg.h>
-# include <unistd.h>
-# include <sys/stat.h>
-# include <termios.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <termios.h>
 
-# include "internal.h"
-# include "virerror.h"
-# include "virthread.h"
-# include "virpolkit.h"
-# include "vsh.h"
-# include "virsh-completer.h"
+#include "internal.h"
+#include "virerror.h"
+#include "virthread.h"
+#include "virpolkit.h"
+#include "vsh.h"
+#include "virsh-completer.h"
 
-# define VIRSH_PROMPT_RW    "virsh # "
-# define VIRSH_PROMPT_RO    "virsh > "
+#define VIRSH_PROMPT_RW    "virsh # "
+#define VIRSH_PROMPT_RO    "virsh > "
 
-# define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_FROM_THIS VIR_FROM_NONE
 
 /*
  * Command group types
  */
-# define VIRSH_CMD_GRP_DOM_MANAGEMENT   "Domain Management"
-# define VIRSH_CMD_GRP_DOM_MONITORING   "Domain Monitoring"
-# define VIRSH_CMD_GRP_STORAGE_POOL     "Storage Pool"
-# define VIRSH_CMD_GRP_STORAGE_VOL      "Storage Volume"
-# define VIRSH_CMD_GRP_NETWORK          "Networking"
-# define VIRSH_CMD_GRP_NODEDEV          "Node Device"
-# define VIRSH_CMD_GRP_IFACE            "Interface"
-# define VIRSH_CMD_GRP_NWFILTER         "Network Filter"
-# define VIRSH_CMD_GRP_SECRET           "Secret"
-# define VIRSH_CMD_GRP_SNAPSHOT         "Snapshot"
-# define VIRSH_CMD_GRP_HOST_AND_HV      "Host and Hypervisor"
-# define VIRSH_CMD_GRP_VIRSH            "Virsh itself"
+#define VIRSH_CMD_GRP_DOM_MANAGEMENT   "Domain Management"
+#define VIRSH_CMD_GRP_DOM_MONITORING   "Domain Monitoring"
+#define VIRSH_CMD_GRP_STORAGE_POOL     "Storage Pool"
+#define VIRSH_CMD_GRP_STORAGE_VOL      "Storage Volume"
+#define VIRSH_CMD_GRP_NETWORK          "Networking"
+#define VIRSH_CMD_GRP_NODEDEV          "Node Device"
+#define VIRSH_CMD_GRP_IFACE            "Interface"
+#define VIRSH_CMD_GRP_NWFILTER         "Network Filter"
+#define VIRSH_CMD_GRP_SECRET           "Secret"
+#define VIRSH_CMD_GRP_SNAPSHOT         "Snapshot"
+#define VIRSH_CMD_GRP_HOST_AND_HV      "Host and Hypervisor"
+#define VIRSH_CMD_GRP_VIRSH            "Virsh itself"
 
 /*
  * Common command options
  */
-# define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \
+#define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \
     {.name = "pool", \
      .type = VSH_OT_DATA, \
      .flags = VSH_OFLAG_REQ, \
@@ -66,7 +65,7 @@
      .completer_flags = cflags, \
     }
 
-# define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
+#define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
     {.name = "domain", \
      .type = VSH_OT_DATA, \
      .flags = VSH_OFLAG_REQ, \
@@ -75,35 +74,35 @@
      .completer_flags = cflags, \
     }
 
-# define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
+#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
     VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
 
-# define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
+#define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
     {.name = "config", \
      .type = VSH_OT_BOOL, \
      .help = _helpstr \
     }
 
-# define VIRSH_COMMON_OPT_LIVE(_helpstr) \
+#define VIRSH_COMMON_OPT_LIVE(_helpstr) \
     {.name = "live", \
      .type = VSH_OT_BOOL, \
      .help = _helpstr \
     }
 
-# define VIRSH_COMMON_OPT_CURRENT(_helpstr) \
+#define VIRSH_COMMON_OPT_CURRENT(_helpstr) \
     {.name = "current", \
      .type = VSH_OT_BOOL, \
      .help = _helpstr \
     }
 
-# define VIRSH_COMMON_OPT_FILE(_helpstr) \
+#define VIRSH_COMMON_OPT_FILE(_helpstr) \
     {.name = "file", \
      .type = VSH_OT_DATA, \
      .flags = VSH_OFLAG_REQ, \
      .help = _helpstr \
     }
 
-# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, oflags, cflags) \
+#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING(_helpstr, oflags, cflags) \
     {.name = "domain", \
      .type = VSH_OT_STRING, \
      .flags = oflags, \
@@ -112,11 +111,11 @@
      .completer_flags = cflags, \
     }
 
-# define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(oflags, cflags) \
+#define VIRSH_COMMON_OPT_DOMAIN_OT_STRING_FULL(oflags, cflags) \
     VIRSH_COMMON_OPT_DOMAIN_OT_STRING(N_("domain name, id or uuid"), \
                                       oflags, cflags)
 
-# define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \
+#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(_helpstr, cflags) \
     {.name = "domain", \
      .type = VSH_OT_ARGV, \
      .flags = VSH_OFLAG_NONE, \
@@ -125,7 +124,7 @@
      .completer_flags = cflags, \
     }
 
-# define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
+#define VIRSH_COMMON_OPT_DOMAIN_OT_ARGV_FULL(cflags) \
     VIRSH_COMMON_OPT_DOMAIN_OT_ARGV(N_("domain name, id or uuid"), cflags)
 
 typedef struct _virshControl virshControl;
@@ -171,5 +170,3 @@ typedef enum {
 } virshLookupByFlags;
 
 virConnectPtr virshConnect(vshControl *ctl, const char *uri, bool readonly);
-
-#endif /* LIBVIRT_VIRSH_H */
diff --git a/tools/virt-admin-completer.h b/tools/virt-admin-completer.h
index a0b09f1ec9..b6f68ce205 100644
--- a/tools/virt-admin-completer.h
+++ b/tools/virt-admin-completer.h
@@ -18,13 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRT_ADMIN_COMPLETER_H
-# define LIBVIRT_VIRT_ADMIN_COMPLETER_H
+#pragma once
 
-# include "vsh.h"
+#include "vsh.h"
 
 char **
 vshAdmServerCompleter(vshControl *ctl,
                       const vshCmd *cmd,
                       unsigned int flags);
-#endif /* LIBVIRT_VIRT_ADMIN_COMPLETER_H */
diff --git a/tools/virt-admin.h b/tools/virt-admin.h
index a58bb7bef2..9f9fdc503d 100644
--- a/tools/virt-admin.h
+++ b/tools/virt-admin.h
@@ -18,13 +18,12 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VIRT_ADMIN_H
-# define LIBVIRT_VIRT_ADMIN_H
+#pragma once
 
-# include "internal.h"
-# include "vsh.h"
+#include "internal.h"
+#include "vsh.h"
 
-# define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_FROM_THIS VIR_FROM_NONE
 
 /*
  * Command group types
@@ -40,5 +39,3 @@ struct _vshAdmControl {
     virAdmConnectPtr conn;      /* connection to a daemon's admin server */
     bool wantReconnect;
 };
-
-#endif /* LIBVIRT_VIRT_ADMIN_H */
diff --git a/tools/virt-host-validate-bhyve.h b/tools/virt-host-validate-bhyve.h
index c9a3f2b5b4..a5fd22c871 100644
--- a/tools/virt-host-validate-bhyve.h
+++ b/tools/virt-host-validate-bhyve.h
@@ -19,9 +19,6 @@
  *
  */
 
-#ifndef LIBVIRT_VIRT_HOST_VALIDATE_BHYVE_H
-# define LIBVIRT_VIRT_HOST_VALIDATE_BHYVE_H
+#pragma once
 
 int virHostValidateBhyve(void);
-
-#endif /* LIBVIRT_VIRT_HOST_VALIDATE_BHYVE_H */
diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-common.h
index 94a5005d5d..c4e4fa2175 100644
--- a/tools/virt-host-validate-common.h
+++ b/tools/virt-host-validate-common.h
@@ -19,13 +19,12 @@
  *
  */
 
-#ifndef LIBVIRT_VIRT_HOST_VALIDATE_COMMON_H
-# define LIBVIRT_VIRT_HOST_VALIDATE_COMMON_H
+#pragma once
 
-# include "internal.h"
-# include "virutil.h"
-# include "virbitmap.h"
-# include "virenum.h"
+#include "internal.h"
+#include "virutil.h"
+#include "virbitmap.h"
+#include "virenum.h"
 
 typedef enum {
     VIR_HOST_VALIDATE_FAIL,
@@ -84,5 +83,3 @@ int virHostValidateCGroupControllers(const char *hvname,
 
 int virHostValidateIOMMU(const char *hvname,
                          virHostValidateLevel level);
-
-#endif /* LIBVIRT_VIRT_HOST_VALIDATE_COMMON_H */
diff --git a/tools/virt-host-validate-lxc.h b/tools/virt-host-validate-lxc.h
index b8d3dd8eb0..fefab17552 100644
--- a/tools/virt-host-validate-lxc.h
+++ b/tools/virt-host-validate-lxc.h
@@ -19,9 +19,6 @@
  *
  */
 
-#ifndef LIBVIRT_VIRT_HOST_VALIDATE_LXC_H
-# define LIBVIRT_VIRT_HOST_VALIDATE_LXC_H
+#pragma once
 
 int virHostValidateLXC(void);
-
-#endif /* LIBVIRT_VIRT_HOST_VALIDATE_LXC_H */
diff --git a/tools/virt-host-validate-qemu.h b/tools/virt-host-validate-qemu.h
index 031029dd61..ddb86aa52c 100644
--- a/tools/virt-host-validate-qemu.h
+++ b/tools/virt-host-validate-qemu.h
@@ -19,9 +19,6 @@
  *
  */
 
-#ifndef LIBVIRT_VIRT_HOST_VALIDATE_QEMU_H
-# define LIBVIRT_VIRT_HOST_VALIDATE_QEMU_H
+#pragma once
 
 int virHostValidateQEMU(void);
-
-#endif /* LIBVIRT_VIRT_HOST_VALIDATE_QEMU_H */
diff --git a/tools/vsh-table.h b/tools/vsh-table.h
index e5b8a9f480..ef0042ffcc 100644
--- a/tools/vsh-table.h
+++ b/tools/vsh-table.h
@@ -18,10 +18,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VSH_TABLE_H
-# define LIBVIRT_VSH_TABLE_H
+#pragma once
 
-# include "vsh.h"
+#include "vsh.h"
 
 typedef struct _vshTable vshTable;
 typedef struct _vshTableRow vshTableRow;
@@ -33,5 +32,3 @@ vshTablePtr vshTableNew(const char *format, ...);
 int vshTableRowAppend(vshTablePtr table, const char *arg, ...);
 void vshTablePrintToStdout(vshTablePtr table, vshControl *ctl);
 char *vshTablePrintToString(vshTablePtr table, bool header);
-
-#endif /* LIBVIRT_VSH_TABLE_H */
diff --git a/tools/vsh.h b/tools/vsh.h
index 68fbe0a1f2..4e02bb177d 100644
--- a/tools/vsh.h
+++ b/tools/vsh.h
@@ -18,36 +18,35 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_VSH_H
-# define LIBVIRT_VSH_H
+#pragma once
 
-# include <stdarg.h>
-# include <unistd.h>
-# include <sys/stat.h>
-# include <termios.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <termios.h>
 
-# include "internal.h"
-# include "virerror.h"
-# include "virthread.h"
+#include "internal.h"
+#include "virerror.h"
+#include "virthread.h"
 
-# define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_FROM_THIS VIR_FROM_NONE
 
-# define GETTIMEOFDAY(T) gettimeofday(T, NULL)
-# define VSH_MAX_XML_FILE (10*1024*1024)
-# define VSH_MATCH(FLAG) (flags & (FLAG))
+#define GETTIMEOFDAY(T) gettimeofday(T, NULL)
+#define VSH_MAX_XML_FILE (10*1024*1024)
+#define VSH_MATCH(FLAG) (flags & (FLAG))
 
 /**
  * The log configuration
  */
-# define MSG_BUFFER    4096
-# define DIR_MODE      (S_IWUSR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)  /* 0755 */
-# define FILE_MODE     (S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH)                                /* 0644 */
-# define LOCK_MODE     (S_IWUSR | S_IRUSR)                                                    /* 0600 */
-# define LVL_DEBUG     "DEBUG"
-# define LVL_INFO      "INFO"
-# define LVL_NOTICE    "NOTICE"
-# define LVL_WARNING   "WARNING"
-# define LVL_ERROR     "ERROR"
+#define MSG_BUFFER    4096
+#define DIR_MODE      (S_IWUSR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)  /* 0755 */
+#define FILE_MODE     (S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH)                                /* 0644 */
+#define LOCK_MODE     (S_IWUSR | S_IRUSR)                                                    /* 0600 */
+#define LVL_DEBUG     "DEBUG"
+#define LVL_INFO      "INFO"
+#define LVL_NOTICE    "NOTICE"
+#define LVL_WARNING   "WARNING"
+#define LVL_ERROR     "ERROR"
 
 /**
  * vshErrorLevel:
@@ -62,7 +61,7 @@ typedef enum {
     VSH_ERR_ERROR
 } vshErrorLevel;
 
-# define VSH_DEBUG_DEFAULT VSH_ERR_ERROR
+#define VSH_DEBUG_DEFAULT VSH_ERR_ERROR
 
 /*
  * virsh command line grammar:
@@ -218,9 +217,9 @@ struct _vshControl {
     int keepalive_interval;     /* Client keepalive interval */
     int keepalive_count;        /* Client keepalive count */
 
-# ifndef WIN32
+#ifndef WIN32
     struct termios termattr;    /* settings of the tty terminal */
-# endif
+#endif
     bool istty;                 /* is the terminal a tty */
 
     const vshClientHooks *hooks;/* mandatory client specific hooks */
@@ -313,7 +312,7 @@ void vshDebug(vshControl *ctl, int level, const char *format, ...)
     ATTRIBUTE_FMT_PRINTF(3, 4);
 
 /* User visible sort, so we want locale-specific case comparison.  */
-# define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
+#define vshStrcasecmp(S1, S2) strcasecmp(S1, S2)
 int vshNameSorter(const void *a, const void *b);
 
 virTypedParameterPtr vshFindTypedParamByName(const char *name,
@@ -386,7 +385,7 @@ bool cmdQuit(vshControl *ctl, const vshCmd *cmd);
 bool cmdSelfTest(vshControl *ctl, const vshCmd *cmd);
 bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
 
-# define VSH_CMD_CD \
+#define VSH_CMD_CD \
     { \
         .name = "cd", \
         .handler = cmdCd, \
@@ -395,7 +394,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .flags = VSH_CMD_FLAG_NOCONNECT \
     }
 
-# define VSH_CMD_ECHO \
+#define VSH_CMD_ECHO \
     { \
         .name = "echo", \
         .handler = cmdEcho, \
@@ -404,7 +403,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .flags = VSH_CMD_FLAG_NOCONNECT \
     }
 
-# define VSH_CMD_EXIT \
+#define VSH_CMD_EXIT \
     { \
         .name = "exit", \
         .handler = cmdQuit, \
@@ -413,7 +412,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .flags = VSH_CMD_FLAG_NOCONNECT \
     }
 
-# define VSH_CMD_HELP \
+#define VSH_CMD_HELP \
     { \
         .name = "help", \
         .handler = cmdHelp, \
@@ -422,7 +421,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .flags = VSH_CMD_FLAG_NOCONNECT \
     }
 
-# define VSH_CMD_PWD \
+#define VSH_CMD_PWD \
     { \
         .name = "pwd", \
         .handler = cmdPwd, \
@@ -431,7 +430,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .flags = VSH_CMD_FLAG_NOCONNECT \
     }
 
-# define VSH_CMD_QUIT \
+#define VSH_CMD_QUIT \
     { \
         .name = "quit", \
         .handler = cmdQuit, \
@@ -440,7 +439,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .flags = VSH_CMD_FLAG_NOCONNECT \
     }
 
-# define VSH_CMD_SELF_TEST \
+#define VSH_CMD_SELF_TEST \
     { \
         .name = "self-test", \
         .handler = cmdSelfTest, \
@@ -450,7 +449,7 @@ bool cmdComplete(vshControl *ctl, const vshCmd *cmd);
         .alias = "self-test" \
     }
 
-# define VSH_CMD_COMPLETE \
+#define VSH_CMD_COMPLETE \
     { \
         .name = "complete", \
         .handler = cmdComplete, \
@@ -467,16 +466,16 @@ char * vshReadline(vshControl *ctl, const char *prompt);
 
 /* allocation wrappers */
 void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int line);
-# define vshMalloc(_ctl, _sz)    _vshMalloc(_ctl, _sz, __FILE__, __LINE__)
+#define vshMalloc(_ctl, _sz)    _vshMalloc(_ctl, _sz, __FILE__, __LINE__)
 
 void *_vshCalloc(vshControl *ctl, size_t nmemb, size_t sz,
                  const char *filename, int line);
-# define vshCalloc(_ctl, _nmemb, _sz) \
+#define vshCalloc(_ctl, _nmemb, _sz) \
     _vshCalloc(_ctl, _nmemb, _sz, __FILE__, __LINE__)
 
 char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
                  int line);
-# define vshStrdup(_ctl, _s)    _vshStrdup(_ctl, _s, __FILE__, __LINE__)
+#define vshStrdup(_ctl, _s)    _vshStrdup(_ctl, _s, __FILE__, __LINE__)
 
 /* Macros to help dealing with mutually exclusive options. */
 
@@ -493,7 +492,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
  * This helper does an early return and therefore it has to be called
  * before anything that would require cleanup.
  */
-# define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
+#define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
     if ((EXPR1) && (EXPR2)) { \
         vshError(ctl, _("Options --%s and --%s are mutually exclusive"), \
                  NAME1, NAME2); \
@@ -511,7 +510,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
  * This helper does an early return and therefore it has to be called
  * before anything that would require cleanup.
  */
-# define VSH_EXCLUSIVE_OPTIONS(NAME1, NAME2) \
+#define VSH_EXCLUSIVE_OPTIONS(NAME1, NAME2) \
     VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \
                                NAME2, vshCommandOptBool(cmd, NAME2))
 
@@ -526,7 +525,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
  * This helper does an early return and therefore it has to be called
  * before anything that would require cleanup.
  */
-# define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \
+#define VSH_EXCLUSIVE_OPTIONS_VAR(VARNAME1, VARNAME2) \
     VSH_EXCLUSIVE_OPTIONS_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2)
 
 /* Macros to help dealing with required options. */
@@ -544,7 +543,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
  * This helper does an early return and therefore it has to be called
  * before anything that would require cleanup.
  */
-# define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
+#define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \
     do { \
         if ((EXPR1) && !(EXPR2)) { \
             vshError(ctl, _("Option --%s is required by option --%s"), \
@@ -564,7 +563,7 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
  * This helper does an early return and therefore it has to be called
  * before anything that would require cleanup.
  */
-# define VSH_REQUIRE_OPTION(NAME1, NAME2) \
+#define VSH_REQUIRE_OPTION(NAME1, NAME2) \
     VSH_REQUIRE_OPTION_EXPR(NAME1, vshCommandOptBool(cmd, NAME1), \
                             NAME2, vshCommandOptBool(cmd, NAME2))
 
@@ -580,7 +579,5 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
  * This helper does an early return and therefore it has to be called
  * before anything that would require cleanup.
  */
-# define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \
+#define VSH_REQUIRE_OPTION_VAR(VARNAME1, VARNAME2) \
     VSH_REQUIRE_OPTION_EXPR(#VARNAME1, VARNAME1, #VARNAME2, VARNAME2)
-
-#endif /* LIBVIRT_VSH_H */
diff --git a/tools/wireshark/src/packet-libvirt.h b/tools/wireshark/src/packet-libvirt.h
index 3b7a0f054d..14e6e13696 100644
--- a/tools/wireshark/src/packet-libvirt.h
+++ b/tools/wireshark/src/packet-libvirt.h
@@ -17,10 +17,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_PACKET_LIBVIRT_H
-# define LIBVIRT_PACKET_LIBVIRT_H
+#pragma once
 
 void proto_register_libvirt(void);
 void proto_reg_handoff_libvirt(void);
-
-#endif /* LIBVIRT_PACKET_LIBVIRT_H */
-- 
2.20.1




More information about the libvir-list mailing list