[libvirt] [snmp PATCH 09/20] src: Fix header file defines

Michal Privoznik posted 20 patches 5 years, 9 months ago
[libvirt] [snmp PATCH 09/20] src: Fix header file defines
Posted by Michal Privoznik 5 years, 9 months ago
To avoid multiple includes, header files start with:

  #ifndef __SOMETHING__
  # define __SOMETHING__

Well, SOMETHING should be the file name, and there should be a
space after hash and before 'define'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/libvirtNotifications.h | 6 +++---
 src/libvirtSnmp.h          | 6 +++---
 src/libvirtSnmpError.h     | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/libvirtNotifications.h b/src/libvirtNotifications.h
index 0be8fdc..ee7a2e3 100644
--- a/src/libvirtNotifications.h
+++ b/src/libvirtNotifications.h
@@ -20,8 +20,8 @@
  * Author: Michal Privoznik <mprivozn@redhat.com>
  */
 
-#ifndef LIBVIRTNOTIFICATIONS_H
-#define LIBVIRTNOTIFICATIONS_H
+#ifndef __LIBVIRT_NOTIFICATIONS_H__
+# define __LIBVIRT_NOTIFICATIONS_H__
 
 #include "libvirtSnmp.h"
 
@@ -30,4 +30,4 @@
  */
 int send_libvirtGuestNotif_trap(virDomainPtr dom);
 
-#endif /* LIBVIRTNOTIFICATIONS_H */
+#endif /* __LIBVIRT_NOTIFICATIONS_H__ */
diff --git a/src/libvirtSnmp.h b/src/libvirtSnmp.h
index bac9988..2c5b0e5 100644
--- a/src/libvirtSnmp.h
+++ b/src/libvirtSnmp.h
@@ -20,8 +20,8 @@
  * Author: Michal Privoznik <mprivozn@redhat.com>
  */
 
-#ifndef __VIR_SNMP_H__
-#define __VIR_SNMP_H__
+#ifndef __LIBVIRT_SNMP_H__
+# define __LIBVIRT_SNMP_H__
 
 /* standard libvirt includes */
 #include <libvirt/libvirt.h>
@@ -60,5 +60,5 @@ libvirtSnmpDestroy(unsigned char *uuid);
 extern int
 libvirtSnmpChangeState(unsigned char *uuid, int newstate, int oldstate);
 
-#endif /* __VIR_SNMP_H__ */
+#endif /* __LIBVIRT_SNMP_H__ */
 
diff --git a/src/libvirtSnmpError.h b/src/libvirtSnmpError.h
index 518cc03..6d59478 100644
--- a/src/libvirtSnmpError.h
+++ b/src/libvirtSnmpError.h
@@ -20,12 +20,12 @@
  * Author: Michal Privoznik <mprivozn@redhat.com>
  */
 
-#ifndef __VIR_SNMP_ERROR_H__
-#define __VIR_SNMP_ERROR_H__
+#ifndef __LIBVIRT_SNMP_ERROR_H__
+# define __LIBVIRT_SNMP_ERROR_H__
 
 #include <libvirt/libvirt.h>
 #include <libvirt/virterror.h>
 
 extern void printLibvirtError(const char *msg);
 
-#endif
+#endif /* __LIBVIRT_SNMP_ERROR_H__ */
-- 
2.18.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [snmp PATCH 09/20] src: Fix header file defines
Posted by Pino Toscano 5 years, 8 months ago
On Thursday, 18 October 2018 14:26:47 CET Michal Privoznik wrote:
> To avoid multiple includes, header files start with:
> 
>   #ifndef __SOMETHING__
>   # define __SOMETHING__
> 
> Well, SOMETHING should be the file name, and there should be a
> space after hash and before 'define'.

Note that identifier start that with two underscores (or even with two
underscores in their name, IIRC) are reserved for the system.
I know the likelyhood of a name conflict with a system identifier with
LIBVIRT in the name is very low, still I saw people reporting these
"reserved names used" issues in the past.

I'd simply use LIBVIRTSNMP_ (or something like that) as prefix.

-- 
Pino Toscano--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list