[libvirt] [PATCH 01/19] Use #pragma once in driver headers

Jonathon Jongsma jjongsma at redhat.com
Fri Jun 7 20:20:12 UTC 2019


Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 src/driver-hypervisor.h | 12 ++++--------
 src/driver-interface.h  | 12 ++++--------
 src/driver-network.h    | 12 ++++--------
 src/driver-nodedev.h    | 12 ++++--------
 src/driver-nwfilter.h   | 12 ++++--------
 src/driver-secret.h     | 12 ++++--------
 src/driver-state.h      | 12 ++++--------
 src/driver-storage.h    | 12 ++++--------
 src/driver-stream.h     | 12 ++++--------
 src/driver.h            | 37 +++++++++++++++++--------------------
 10 files changed, 53 insertions(+), 92 deletions(-)

diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h
index 5315e33dde..b15aaa36bc 100644
--- a/src/driver-hypervisor.h
+++ b/src/driver-hypervisor.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_HYPERVISOR_H
-# define LIBVIRT_DRIVER_HYPERVISOR_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvConnectURIProbe)(char **uri);
@@ -1581,6 +1580,3 @@ struct _virHypervisorDriver {
     virDrvNodeGetSEVInfo nodeGetSEVInfo;
     virDrvDomainGetLaunchSecurityInfo domainGetLaunchSecurityInfo;
 };
-
-
-#endif /* LIBVIRT_DRIVER_HYPERVISOR_H */
diff --git a/src/driver-interface.h b/src/driver-interface.h
index 5373f5e66a..117c93b66f 100644
--- a/src/driver-interface.h
+++ b/src/driver-interface.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_INTERFACE_H
-# define LIBVIRT_DRIVER_INTERFACE_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvConnectNumOfInterfaces)(virConnectPtr conn);
@@ -117,6 +116,3 @@ struct _virInterfaceDriver {
     virDrvInterfaceChangeCommit interfaceChangeCommit;
     virDrvInterfaceChangeRollback interfaceChangeRollback;
 };
-
-
-#endif /* LIBVIRT_DRIVER_INTERFACE_H */
diff --git a/src/driver-network.h b/src/driver-network.h
index 2715c7bfec..a4f71a8fd1 100644
--- a/src/driver-network.h
+++ b/src/driver-network.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_NETWORK_H
-# define LIBVIRT_DRIVER_NETWORK_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvConnectNumOfNetworks)(virConnectPtr conn);
@@ -152,6 +151,3 @@ struct _virNetworkDriver {
     virDrvNetworkIsPersistent networkIsPersistent;
     virDrvNetworkGetDHCPLeases networkGetDHCPLeases;
 };
-
-
-#endif /* LIBVIRT_DRIVER_NETWORK_H */
diff --git a/src/driver-nodedev.h b/src/driver-nodedev.h
index c506e846f6..d0fc7f19cf 100644
--- a/src/driver-nodedev.h
+++ b/src/driver-nodedev.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_NODEDEV_H
-# define LIBVIRT_DRIVER_NODEDEV_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvNodeNumOfDevices)(virConnectPtr conn,
@@ -115,6 +114,3 @@ struct _virNodeDeviceDriver {
     virDrvNodeDeviceCreateXML nodeDeviceCreateXML;
     virDrvNodeDeviceDestroy nodeDeviceDestroy;
 };
-
-
-#endif /* LIBVIRT_DRIVER_NODEDEV_H */
diff --git a/src/driver-nwfilter.h b/src/driver-nwfilter.h
index 7bcb823f0a..7e95622423 100644
--- a/src/driver-nwfilter.h
+++ b/src/driver-nwfilter.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_NWFILTER_H
-# define LIBVIRT_DRIVER_NWFILTER_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvConnectNumOfNWFilters)(virConnectPtr conn);
@@ -108,6 +107,3 @@ struct _virNWFilterDriver {
     virDrvNWFilterBindingDelete nwfilterBindingDelete;
     virDrvNWFilterBindingGetXMLDesc nwfilterBindingGetXMLDesc;
 };
-
-
-#endif /* LIBVIRT_DRIVER_NWFILTER_H */
diff --git a/src/driver-secret.h b/src/driver-secret.h
index 1dcae63880..125238fe7b 100644
--- a/src/driver-secret.h
+++ b/src/driver-secret.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_SECRET_H
-# define LIBVIRT_DRIVER_SECRET_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 enum {
     /* This getValue call is inside libvirt, override the "private" flag.
@@ -113,6 +112,3 @@ struct _virSecretDriver {
     virDrvConnectSecretEventRegisterAny connectSecretEventRegisterAny;
     virDrvConnectSecretEventDeregisterAny connectSecretEventDeregisterAny;
 };
-
-
-#endif /* LIBVIRT_DRIVER_SECRET_H */
diff --git a/src/driver-state.h b/src/driver-state.h
index a8595662af..974b2252ee 100644
--- a/src/driver-state.h
+++ b/src/driver-state.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_STATE_H
-# define LIBVIRT_DRIVER_STATE_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvStateInitialize)(bool privileged,
@@ -49,6 +48,3 @@ struct _virStateDriver {
     virDrvStateReload stateReload;
     virDrvStateStop stateStop;
 };
-
-
-#endif /* LIBVIRT_DRIVER_STATE_H */
diff --git a/src/driver-storage.h b/src/driver-storage.h
index 2a855c34d8..e11d1b7895 100644
--- a/src/driver-storage.h
+++ b/src/driver-storage.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_STORAGE_H
-# define LIBVIRT_DRIVER_STORAGE_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvConnectNumOfStoragePools)(virConnectPtr conn);
@@ -279,6 +278,3 @@ struct _virStorageDriver {
     virDrvStoragePoolIsActive storagePoolIsActive;
     virDrvStoragePoolIsPersistent storagePoolIsPersistent;
 };
-
-
-#endif /* LIBVIRT_DRIVER_STORAGE_H */
diff --git a/src/driver-stream.h b/src/driver-stream.h
index 4978f90d2d..a5b16c8c4e 100644
--- a/src/driver-stream.h
+++ b/src/driver-stream.h
@@ -18,12 +18,11 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_STREAM_H
-# define LIBVIRT_DRIVER_STREAM_H
+#pragma once
 
-# ifndef __VIR_DRIVER_H_INCLUDES___
-#  error "Don't include this file directly, only use driver.h"
-# endif
+#ifndef __VIR_DRIVER_H_INCLUDES___
+# error "Don't include this file directly, only use driver.h"
+#endif
 
 typedef int
 (*virDrvStreamSend)(virStreamPtr st,
@@ -92,6 +91,3 @@ struct _virStreamDriver {
     virDrvStreamFinish streamFinish;
     virDrvStreamAbort streamAbort;
 };
-
-
-#endif /* LIBVIRT_DRIVER_STREAM_H */
diff --git a/src/driver.h b/src/driver.h
index 6472bd9367..3fcea0d629 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -19,14 +19,13 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#ifndef LIBVIRT_DRIVER_H
-# define LIBVIRT_DRIVER_H
+#pragma once
 
-# include <unistd.h>
+#include <unistd.h>
 
-# include "internal.h"
-# include "libvirt_internal.h"
-# include "viruri.h"
+#include "internal.h"
+#include "libvirt_internal.h"
+#include "viruri.h"
 
 
 /* Status codes returned from driver open call. */
@@ -56,24 +55,24 @@ typedef enum {
  *   != 0  Feature is supported.
  *   0     Feature is not supported.
  */
-# define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
+#define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
     ((drv)->connectSupportsFeature ? \
         (drv)->connectSupportsFeature((conn), (feature)) > 0 : 0)
 
 
-# define __VIR_DRIVER_H_INCLUDES___
+#define __VIR_DRIVER_H_INCLUDES___
 
-# include "driver-hypervisor.h"
-# include "driver-interface.h"
-# include "driver-network.h"
-# include "driver-nodedev.h"
-# include "driver-nwfilter.h"
-# include "driver-secret.h"
-# include "driver-state.h"
-# include "driver-stream.h"
-# include "driver-storage.h"
+#include "driver-hypervisor.h"
+#include "driver-interface.h"
+#include "driver-network.h"
+#include "driver-nodedev.h"
+#include "driver-nwfilter.h"
+#include "driver-secret.h"
+#include "driver-state.h"
+#include "driver-stream.h"
+#include "driver-storage.h"
 
-# undef __VIR_DRIVER_H_INCLUDES___
+#undef __VIR_DRIVER_H_INCLUDES___
 
 typedef struct _virConnectDriver virConnectDriver;
 typedef virConnectDriver *virConnectDriverPtr;
@@ -126,5 +125,3 @@ int virSetConnectNWFilter(virConnectPtr conn);
 int virSetConnectNodeDev(virConnectPtr conn);
 int virSetConnectSecret(virConnectPtr conn);
 int virSetConnectStorage(virConnectPtr conn);
-
-#endif /* LIBVIRT_DRIVER_H */
-- 
2.20.1




More information about the libvir-list mailing list