Browse Source

Update all header guards.

Don't start with underscores, as those are reserved for system
libraries. Make sure all start with TINC_, and that they appear at
the top of the file.
Guus Sliepen 6 years ago
parent
commit
d178b583df
36 changed files with 200 additions and 186 deletions
  1. 0 1
      src/Makefile.am
  2. 4 5
      src/avl_tree.h
  3. 4 4
      src/conf.h
  4. 4 4
      src/connection.h
  5. 4 4
      src/device.h
  6. 4 4
      src/dropin.h
  7. 4 4
      src/edge.h
  8. 4 4
      src/ethernet.h
  9. 4 4
      src/event.h
  10. 0 19
      src/fake-gai-errnos.h
  11. 14 4
      src/fake-getaddrinfo.h
  12. 3 3
      src/fake-getnameinfo.h
  13. 33 33
      src/getopt.c
  14. 13 13
      src/getopt.h
  15. 4 4
      src/getopt1.c
  16. 4 4
      src/graph.h
  17. 4 4
      src/have.h
  18. 5 5
      src/ipv4.h
  19. 7 7
      src/ipv6.h
  20. 4 4
      src/list.h
  21. 22 3
      src/logger.h
  22. 4 4
      src/meta.h
  23. 4 4
      src/net.h
  24. 4 4
      src/netutl.h
  25. 4 4
      src/node.h
  26. 5 0
      src/pidfile.h
  27. 4 4
      src/process.h
  28. 4 4
      src/protocol.h
  29. 3 3
      src/proxy.h
  30. 4 4
      src/route.h
  31. 4 4
      src/subnet.h
  32. 4 4
      src/system.h
  33. 1 1
      src/tincd.c
  34. 1 1
      src/uml_device.c
  35. 4 4
      src/utils.h
  36. 5 4
      src/xalloc.h

+ 0 - 1
src/Makefile.am

@@ -14,7 +14,6 @@ tincd_SOURCES = \
 	edge.c edge.h \
 	ethernet.h \
 	event.c event.h \
-	fake-gai-errnos.h \
 	fake-getaddrinfo.c fake-getaddrinfo.h \
 	fake-getnameinfo.c fake-getnameinfo.h \
 	graph.c graph.h \

+ 4 - 5
src/avl_tree.h

@@ -1,3 +1,6 @@
+#ifndef TINC_AVL_TREE_H
+#define TINC_AVL_TREE_H
+
 /*
     avl_tree.h -- header file for avl_tree.c
     Copyright (C) 1998 Michael H. Buselli
@@ -30,10 +33,6 @@
     Guus Sliepen <guus@tinc-vpn.org>.
 */
 
-
-#ifndef __AVL_TREE_H__
-#define __AVL_TREE_H__
-
 #ifndef AVL_DEPTH
 #ifndef AVL_COUNT
 #define AVL_DEPTH
@@ -140,4 +139,4 @@ extern unsigned int avl_index(const avl_node_t *);
 extern unsigned int avl_depth(const avl_tree_t *);
 #endif
 
-#endif							/* __AVL_TREE_H__ */
+#endif

+ 4 - 4
src/conf.h

@@ -1,3 +1,6 @@
+#ifndef TINC_CONF_H
+#define TINC_CONF_H
+
 /*
     conf.h -- header for conf.c
     Copyright (C) 1998-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_CONF_H__
-#define __TINC_CONF_H__
-
 #include "avl_tree.h"
 #include "list.h"
 
@@ -65,4 +65,4 @@ extern bool read_connection_config(struct connection_t *);
 extern FILE *ask_and_open(const char *, const char *);
 extern bool is_safe_path(const char *);
 
-#endif							/* __TINC_CONF_H__ */
+#endif

+ 4 - 4
src/connection.h

@@ -1,3 +1,6 @@
+#ifndef TINC_CONNECTION_H
+#define TINC_CONNECTION_H
+
 /*
     connection.h -- header for connection.c
     Copyright (C) 2000-2016 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_CONNECTION_H__
-#define __TINC_CONNECTION_H__
-
 #include <openssl/rsa.h>
 #include <openssl/evp.h>
 
@@ -115,4 +115,4 @@ extern void connection_add(connection_t *);
 extern void connection_del(connection_t *);
 extern void dump_connections(void);
 
-#endif							/* __TINC_CONNECTION_H__ */
+#endif

+ 4 - 4
src/device.h

@@ -1,3 +1,6 @@
+#ifndef TINC_DEVICE_H
+#define TINC_DEVICE_H
+
 /*
     device.h -- generic header for device.c
     Copyright (C) 2001-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_DEVICE_H__
-#define __TINC_DEVICE_H__
-
 #include "net.h"
 
 extern int device_fd;
@@ -44,4 +44,4 @@ extern const devops_t uml_devops;
 extern const devops_t vde_devops;
 extern devops_t devops;
 
-#endif							/* __TINC_DEVICE_H__ */
+#endif

+ 4 - 4
src/dropin.h

@@ -1,3 +1,6 @@
+#ifndef TINC_DROPIN_H
+#define TINC_DROPIN_H
+
 /*
     dropin.h -- header file for dropin.c
     Copyright (C) 2000-2005 Ivo Timmermans,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __DROPIN_H__
-#define __DROPIN_H__
-
 #include "fake-getaddrinfo.h"
 #include "fake-getnameinfo.h"
 
@@ -45,4 +45,4 @@ extern int gettimeofday(struct timeval *, void *);
 extern int usleep(long long);
 #endif
 
-#endif							/* __DROPIN_H__ */
+#endif

+ 4 - 4
src/edge.h

@@ -1,3 +1,6 @@
+#ifndef TINC_EDGE_H
+#define TINC_EDGE_H
+
 /*
     edge.h -- header for edge.c
     Copyright (C) 2001-2006 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_EDGE_H__
-#define __TINC_EDGE_H__
-
 #include "avl_tree.h"
 #include "connection.h"
 #include "net.h"
@@ -51,4 +51,4 @@ extern void edge_del(edge_t *);
 extern edge_t *lookup_edge(struct node_t *, struct node_t *);
 extern void dump_edges(void);
 
-#endif							/* __TINC_EDGE_H__ */
+#endif

+ 4 - 4
src/ethernet.h

@@ -1,3 +1,6 @@
+#ifndef TINC_ETHERNET_H
+#define TINC_ETHERNET_H
+
 /*
     ethernet.h -- missing Ethernet related definitions
     Copyright (C) 2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_ETHERNET_H__
-#define __TINC_ETHERNET_H__
-
 #ifndef ETH_ALEN
 #define ETH_ALEN 6
 #endif
@@ -86,4 +86,4 @@ struct  ether_arp {
 #define arp_op ea_hdr.ar_op
 #endif
 
-#endif /* __TINC_ETHERNET_H__ */
+#endif

+ 4 - 4
src/event.h

@@ -1,3 +1,6 @@
+#ifndef TINC_EVENT_H
+#define TINC_EVENT_H
+
 /*
     event.h -- header for event.c
     Copyright (C) 2002-2009 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_EVENT_H__
-#define __TINC_EVENT_H__
-
 #include "avl_tree.h"
 
 extern avl_tree_t *event_tree;
@@ -44,4 +44,4 @@ extern void event_del(event_t *);
 extern event_t *get_expired_event(void);
 extern event_t *peek_next_event(void);
 
-#endif							/* __TINC_EVENT_H__ */
+#endif

+ 0 - 19
src/fake-gai-errnos.h

@@ -1,19 +0,0 @@
-/*
- * fake library for ssh
- *
- * This file is included in getaddrinfo.c and getnameinfo.c.
- * See getaddrinfo.c and getnameinfo.c.
- */
-
-/* for old netdb.h */
-#ifndef EAI_NODATA
-#define EAI_NODATA	1
-#endif
-
-#ifndef EAI_MEMORY
-#define EAI_MEMORY	2
-#endif
-
-#ifndef EAI_FAMILY
-#define EAI_FAMILY	3
-#endif

+ 14 - 4
src/fake-getaddrinfo.h

@@ -1,7 +1,17 @@
-#ifndef _FAKE_GETADDRINFO_H
-#define _FAKE_GETADDRINFO_H
+#ifndef TINC_FAKE_GETADDRINFO_H
+#define TINC_FAKE_GETADDRINFO_H
 
-#include "fake-gai-errnos.h"
+#ifndef EAI_NODATA
+#define EAI_NODATA	1
+#endif
+
+#ifndef EAI_MEMORY
+#define EAI_MEMORY	2
+#endif
+
+#ifndef EAI_FAMILY
+#define EAI_FAMILY	3
+#endif
 
 #ifndef AI_PASSIVE
 # define AI_PASSIVE        1
@@ -44,4 +54,4 @@ char *gai_strerror(int ecode);
 void freeaddrinfo(struct addrinfo *ai);
 #endif /* !HAVE_FREEADDRINFO */
 
-#endif /* _FAKE_GETADDRINFO_H */
+#endif

+ 3 - 3
src/fake-getnameinfo.h

@@ -1,5 +1,5 @@
-#ifndef _FAKE_GETNAMEINFO_H
-#define _FAKE_GETNAMEINFO_H
+#ifndef TINC_FAKE_GETNAMEINFO_H
+#define TINC_FAKE_GETNAMEINFO_H
 
 #if !HAVE_DECL_GETNAMEINFO
 int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, 
@@ -13,4 +13,4 @@ int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
 # define NI_MAXHOST 1025
 #endif /* !NI_MAXHOST */
 
-#endif /* _FAKE_GETNAMEINFO_H */
+#endif

+ 33 - 33
src/getopt.c

@@ -34,7 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "../config.h"
 #endif
 
-#if !defined (__STDC__) || !__STDC__
+#if !defined (STDC) || !STDC
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
 #ifndef const
@@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
    it is simpler to just do this in the source for each such file.  */
 
 #define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#if !defined (_LIBC) && defined (GLIBC) && GLIBC >= 2
 #include <gnu-versions.h>
 #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
 #define ELIDE_CODE
@@ -68,8 +68,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 
 /* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef	__GNU_LIBRARY__
+   to get GNU_LIBRARY defined.  */
+#ifdef	GNU_LIBRARY
 /* Don't include stdlib.h for non-GNU C libraries because some of them
    contain conflicting prototypes for getopt.  */
 #include <stdlib.h>
@@ -83,7 +83,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #endif
 #endif
 
-#if defined (WIN32) && !defined (__CYGWIN32__)
+#if defined (WIN32) && !defined (CYGWIN32)
 /* It's not Unix, really.  See?  Capital letters.  */
 #include <windows.h>
 #define getpid() GetCurrentProcessId()
@@ -132,7 +132,7 @@ int optind = 1;
    causes problems with re-calling getopt as programs generally don't
    know that. */
 
-int __getopt_initialized = 0;
+int getopt_initialized = 0;
 
 /* The next char to be scanned in the option-element
    in which the last option character we returned was found.
@@ -191,7 +191,7 @@ static enum
 /* Value of POSIXLY_CORRECT environment variable.  */
 static char *posixly_correct;
 
-#ifdef	__GNU_LIBRARY__
+#ifdef	GNU_LIBRARY
 /* We want to avoid inclusion of string.h with non-GNU libraries
    because there are many ways it can cause trouble.
    On some systems, it contains special magic macros that don't work
@@ -221,17 +221,17 @@ my_index (str, chr)
 
 /* If using GCC, we can safely declare strlen this way.
    If not using GCC, it is ok not to declare it.  */
-#ifdef __GNUC__
+#ifdef GNUC
 /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
    That was relevant to code that was here before.  */
-#if !defined (__STDC__) || !__STDC__
+#if !defined (STDC) || !STDC
 /* gcc with -traditional declares the built-in strlen to return int,
    and has done so at least since version 2.4.5. -- rms.  */
 extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
+#endif /* not STDC */
+#endif /* GNUC */
 
-#endif /* not __GNU_LIBRARY__ */
+#endif /* not GNU_LIBRARY */
 
 /* Handle permutation of arguments.  */
 
@@ -247,7 +247,7 @@ static int last_nonopt;
    indicating ARGV elements that should not be considered arguments.  */
 
 /* Defined in getopt_init.c  */
-extern char *__getopt_nonoption_flags;
+extern char *getopt_nonoption_flags;
 
 static int nonoption_flags_max_len;
 static int nonoption_flags_len;
@@ -255,7 +255,7 @@ static int nonoption_flags_len;
 static int original_argc;
 static char *const *original_argv;
 
-extern pid_t __libc_pid;
+extern pid_t libc_pid;
 
 /* Make sure the environment variable bash 2.0 puts in the environment
    is valid for the getopt call we must make sure that the ARGV passed
@@ -269,14 +269,14 @@ store_args_and_env (int argc, char *const *argv)
   original_argc = argc;
   original_argv = argv;
 }
-text_set_element (__libc_subinit, store_args_and_env);
+text_set_element (libc_subinit, store_args_and_env);
 
 # define SWAP_FLAGS(ch1, ch2) \
   if (nonoption_flags_len > 0)						      \
     {									      \
-      char __tmp = __getopt_nonoption_flags[ch1];			      \
-      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];	      \
-      __getopt_nonoption_flags[ch2] = __tmp;				      \
+      char tmp = getopt_nonoption_flags[ch1];			      \
+      getopt_nonoption_flags[ch1] = getopt_nonoption_flags[ch2];	      \
+      getopt_nonoption_flags[ch2] = tmp;				      \
     }
 #else	/* !_LIBC */
 # define SWAP_FLAGS(ch1, ch2)
@@ -291,7 +291,7 @@ text_set_element (__libc_subinit, store_args_and_env);
    `first_nonopt' and `last_nonopt' are relocated so that they describe
    the new indices of the non-options in ARGV after they are moved.  */
 
-#if defined (__STDC__) && __STDC__
+#if defined (STDC) && STDC
 static void exchange (char **);
 #endif
 
@@ -310,7 +310,7 @@ exchange (argv)
      but it consists of two parts that need to be swapped next.  */
 
 #ifdef _LIBC
-  /* First make sure the handling of the `__getopt_nonoption_flags'
+  /* First make sure the handling of the `getopt_nonoption_flags'
      string can work normally.  Our top argument must be in the range
      of the string.  */
   if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
@@ -322,11 +322,11 @@ exchange (argv)
 	nonoption_flags_len = nonoption_flags_max_len = 0;
       else
 	{
-	  memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len);
+	  memcpy (new_str, getopt_nonoption_flags, nonoption_flags_max_len);
 	  memset (&new_str[nonoption_flags_max_len], '\0',
 		  top + 1 - nonoption_flags_max_len);
 	  nonoption_flags_max_len = top + 1;
-	  __getopt_nonoption_flags = new_str;
+	  getopt_nonoption_flags = new_str;
 	}
     }
 #endif
@@ -377,7 +377,7 @@ exchange (argv)
 
 /* Initialize the internal data when the first call is made.  */
 
-#if defined (__STDC__) && __STDC__
+#if defined (STDC) && STDC
 static const char *_getopt_initialize (int, char *const *, const char *);
 #endif
 static const char *
@@ -419,23 +419,23 @@ _getopt_initialize (argc, argv, optstring)
     {
       if (nonoption_flags_max_len == 0)
 	{
-	  if (__getopt_nonoption_flags == NULL
-	      || __getopt_nonoption_flags[0] == '\0')
+	  if (getopt_nonoption_flags == NULL
+	      || getopt_nonoption_flags[0] == '\0')
 	    nonoption_flags_max_len = -1;
 	  else
 	    {
-	      const char *orig_str = __getopt_nonoption_flags;
+	      const char *orig_str = getopt_nonoption_flags;
 	      int len = nonoption_flags_max_len = strlen (orig_str);
 	      if (nonoption_flags_max_len < argc)
 		nonoption_flags_max_len = argc;
-	      __getopt_nonoption_flags =
+	      getopt_nonoption_flags =
 		(char *) malloc (nonoption_flags_max_len);
-	      if (__getopt_nonoption_flags == NULL)
+	      if (getopt_nonoption_flags == NULL)
 		nonoption_flags_max_len = -1;
 	      else
 		{
-		  memcpy (__getopt_nonoption_flags, orig_str, len);
-		  memset (&__getopt_nonoption_flags[len], '\0',
+		  memcpy (getopt_nonoption_flags, orig_str, len);
+		  memset (&getopt_nonoption_flags[len], '\0',
 			  nonoption_flags_max_len - len);
 		}
 	    }
@@ -516,12 +516,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 {
   optarg = NULL;
 
-  if (optind == 0 || !__getopt_initialized)
+  if (optind == 0 || !getopt_initialized)
     {
       if (optind == 0)
 	optind = 1;	/* Don't scan ARGV[0], the program name.  */
       optstring = _getopt_initialize (argc, argv, optstring);
-      __getopt_initialized = 1;
+      getopt_initialized = 1;
     }
 
   /* Test whether ARGV[optind] points to a non-option argument.
@@ -531,7 +531,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 #ifdef _LIBC
 #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'	      \
 		     || (optind < nonoption_flags_len			      \
-			 && __getopt_nonoption_flags[optind] == '1'))
+			 && getopt_nonoption_flags[optind] == '1'))
 #else
 #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
 #endif

+ 13 - 13
src/getopt.h

@@ -1,3 +1,6 @@
+#ifndef TINC_GETOPT_H
+#define TINC_GETOPT_H
+
 /* Declarations for getopt.
    Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
 
@@ -19,10 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#ifdef	__cplusplus
+#ifdef	cplusplus
 extern "C" {
 #endif
 
@@ -80,7 +80,7 @@ extern int optopt;
 
 struct option
 {
-#if defined (__STDC__) && __STDC__
+#if defined (STDC) && STDC
   const char *name;
 #else
   char *name;
@@ -98,15 +98,15 @@ struct option
 #define required_argument	1
 #define optional_argument	2
 
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+#if defined (STDC) && STDC
+#ifdef GNU_LIBRARY
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
 extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
+#else /* not GNU_LIBRARY */
 extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
+#endif /* GNU_LIBRARY */
 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
 		        const struct option *longopts, int *longind);
 extern int getopt_long_only (int argc, char *const *argv,
@@ -118,16 +118,16 @@ extern int _getopt_internal (int argc, char *const *argv,
 			     const char *shortopts,
 		             const struct option *longopts, int *longind,
 			     int long_only);
-#else /* not __STDC__ */
+#else /* not STDC */
 extern int getopt ();
 extern int getopt_long ();
 extern int getopt_long_only ();
 
 extern int _getopt_internal ();
-#endif /* __STDC__ */
+#endif /* STDC */
 
-#ifdef	__cplusplus
+#ifdef	cplusplus
 }
 #endif
 
-#endif /* _GETOPT_H */
+#endif

+ 4 - 4
src/getopt1.c

@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "getopt.h"
 
-#if !defined (__STDC__) || !__STDC__
+#if !defined (STDC) || !STDC
 /* This is a separate conditional since some stdc systems
    reject `defined (const)'.  */
 #ifndef const
@@ -44,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
    it is simpler to just do this in the source for each such file.  */
 
 #define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#if !defined (_LIBC) && defined (GLIBC) && GLIBC >= 2
 #include <gnu-versions.h>
 #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
 #define ELIDE_CODE
@@ -55,8 +55,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 
 /* This needs to come after some library #include
-   to get __GNU_LIBRARY__ defined.  */
-#ifdef __GNU_LIBRARY__
+   to get GNU_LIBRARY defined.  */
+#ifdef GNU_LIBRARY
 #include <stdlib.h>
 #endif
 

+ 4 - 4
src/graph.h

@@ -1,3 +1,6 @@
+#ifndef TINC_GRAPH_H
+#define TINC_GRAPH_H
+
 /*
     graph.h -- header for graph.c
     Copyright (C) 2001-2012 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,10 +21,7 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_GRAPH_H__
-#define __TINC_GRAPH_H__
-
 extern void graph(void);
 extern void dump_graph(void);
 
-#endif /* __TINC_GRAPH_H__ */
+#endif

+ 4 - 4
src/have.h

@@ -1,3 +1,6 @@
+#ifndef TINC_HAVE_H
+#define TINC_HAVE_H
+
 /*
     have.h -- include headers which are known to exist
     Copyright (C) 1998-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_HAVE_H__
-#define __TINC_HAVE_H__
-
 #ifdef HAVE_MINGW
 #ifdef WITH_WINDOWS2000
 #define WINVER Windows2000
@@ -211,4 +211,4 @@
 #include <linux/if_tun.h>
 #endif
 
-#endif /* __TINC_SYSTEM_H__ */
+#endif

+ 5 - 5
src/ipv4.h

@@ -1,3 +1,6 @@
+#ifndef TINC_IPV4_H
+#define TINC_IPV4_H
+
 /*
     ipv4.h -- missing IPv4 related definitions
     Copyright (C) 2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_IPV4_H__
-#define __TINC_IPV4_H__
-
 #ifndef AF_INET
 #define AF_INET 2
 #endif
@@ -63,7 +63,7 @@
 
 #ifndef HAVE_STRUCT_IP
 struct ip {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
 	unsigned int ip_hl:4;
 	unsigned int ip_v:4;
 #else
@@ -146,4 +146,4 @@ struct icmp {
 } __attribute__ ((__packed__));
 #endif
 
-#endif /* __TINC_IPV4_H__ */
+#endif

+ 7 - 7
src/ipv6.h

@@ -1,3 +1,6 @@
+#ifndef TINC_IPV6_H
+#define TINC_IPV6_H
+
 /*
     ipv6.h -- missing IPv6 related definitions
     Copyright (C) 2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_IPV6_H__
-#define __TINC_IPV6_H__
-
 #ifndef AF_INET6
 #define AF_INET6 10
 #endif
@@ -54,9 +54,9 @@ struct sockaddr_in6 {
 
 #ifndef IN6_IS_ADDR_V4MAPPED
 #define IN6_IS_ADDR_V4MAPPED(a) \
-        ((((__const uint32_t *) (a))[0] == 0) \
-        && (((__const uint32_t *) (a))[1] == 0) \
-        && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
+        ((((const uint32_t *) (a))[0] == 0) \
+        && (((const uint32_t *) (a))[1] == 0) \
+        && (((const uint32_t *) (a))[2] == htonl (0xffff)))
 #endif
 
 #ifndef HAVE_STRUCT_IP6_HDR
@@ -127,4 +127,4 @@ struct nd_opt_hdr {
 } __attribute__ ((__packed__));
 #endif
 
-#endif /* __TINC_IPV6_H__ */
+#endif

+ 4 - 4
src/list.h

@@ -1,3 +1,6 @@
+#ifndef TINC_LIST_H
+#define TINC_LIST_H
+
 /*
     list.h -- header file for list.c
     Copyright (C) 2000-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_LIST_H__
-#define __TINC_LIST_H__
-
 typedef struct list_node_t {
 	struct list_node_t *prev;
 	struct list_node_t *next;
@@ -75,4 +75,4 @@ extern void list_delete_list(list_t *);
 extern void list_foreach(list_t *, list_action_t);
 extern void list_foreach_node(list_t *, list_action_node_t);
 
-#endif							/* __TINC_LIST_H__ */
+#endif

+ 22 - 3
src/logger.h

@@ -1,5 +1,24 @@
-#ifndef __TINC_LOGGER_H__
-#define __TINC_LOGGER_H__
+#ifndef TINC_LOGGER_H
+#define TINC_LOGGER_H
+
+/*
+    logger.h -- header file for logger.c
+    Copyright (C) 2003-2016 Guus Sliepen <guus@tinc-vpn.org>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
 
 typedef enum debug_t {
 	DEBUG_NOTHING = 0,			/* Quiet mode, only show starting/stopping of the daemon */
@@ -53,4 +72,4 @@ extern void closelogger(void);
 
 #define ifdebug(l) if(debug_level >= DEBUG_##l)
 
-#endif /* __TINC_LOGGER_H__ */
+#endif

+ 4 - 4
src/meta.h

@@ -1,3 +1,6 @@
+#ifndef TINC_META_H
+#define TINC_META_H
+
 /*
     meta.h -- header for meta.c
     Copyright (C) 2000-2006 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_META_H__
-#define __TINC_META_H__
-
 #include "connection.h"
 
 extern bool send_meta(struct connection_t *, const char *, int);
@@ -28,4 +28,4 @@ extern void broadcast_meta(struct connection_t *, const char *, int);
 extern bool flush_meta(struct connection_t *);
 extern bool receive_meta(struct connection_t *);
 
-#endif							/* __TINC_META_H__ */
+#endif

+ 4 - 4
src/net.h

@@ -1,3 +1,6 @@
+#ifndef TINC_NET_H
+#define TINC_NET_H
+
 /*
     net.h -- header for net.c
     Copyright (C) 1998-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_NET_H__
-#define __TINC_NET_H__
-
 #include <openssl/evp.h>
 
 #include "ipv6.h"
@@ -157,4 +157,4 @@ extern void load_all_subnets(void);
 extern CRITICAL_SECTION mutex;
 #endif
 
-#endif							/* __TINC_NET_H__ */
+#endif

+ 4 - 4
src/netutl.h

@@ -1,3 +1,6 @@
+#ifndef TINC_NETUTL_H
+#define TINC_NETUTL_H
+
 /*
     netutl.h -- header file for netutl.c
     Copyright (C) 1998-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_NETUTL_H__
-#define __TINC_NETUTL_H__
-
 #include "net.h"
 
 extern bool hostnames;
@@ -40,4 +40,4 @@ extern void maskcpy(void *, const void *, int, int);
 extern void mask(void *, int, int);
 extern bool maskcheck(const void *, int, int);
 
-#endif							/* __TINC_NETUTL_H__ */
+#endif

+ 4 - 4
src/node.h

@@ -1,3 +1,6 @@
+#ifndef TINC_NODE_H
+#define TINC_NODE_H
+
 /*
     node.h -- header for node.c
     Copyright (C) 2001-2016 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_NODE_H__
-#define __TINC_NODE_H__
-
 #include "avl_tree.h"
 #include "connection.h"
 #include "event.h"
@@ -103,4 +103,4 @@ extern node_t *lookup_node_udp(const sockaddr_t *);
 extern void update_node_udp(node_t *, const sockaddr_t *);
 extern void dump_nodes(void);
 
-#endif							/* __TINC_NODE_H__ */
+#endif

+ 5 - 0
src/pidfile.h

@@ -1,3 +1,6 @@
+#ifndef TINC_PIDFILE_H
+#define TINC_PIDFILE_H
+
 /*
     pidfile.h - interact with pidfiles
     Copyright (c) 1995  Martin Schulze <Martin.Schulze@Linux.DE>
@@ -50,3 +53,5 @@ extern pid_t write_pid (const char *pidfile);
  */
 extern int remove_pid (const char *pidfile);
 #endif
+
+#endif

+ 4 - 4
src/process.h

@@ -1,3 +1,6 @@
+#ifndef TINC_PROCESS_H
+#define TINC_PROCESS_H
+
 /*
     process.h -- header file for process.c
     Copyright (C) 1999-2005 Ivo Timmermans,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_PROCESS_H__
-#define __TINC_PROCESS_H__
-
 extern bool do_detach;
 extern bool sighup;
 extern bool sigalrm;
@@ -34,4 +34,4 @@ extern bool kill_other(int);
 extern bool init_service(void);
 #endif
 
-#endif							/* __TINC_PROCESS_H__ */
+#endif

+ 4 - 4
src/protocol.h

@@ -1,3 +1,6 @@
+#ifndef TINC_PROTOCOL_H
+#define TINC_PROTOCOL_H
+
 /*
     protocol.h -- header for protocol.c
     Copyright (C) 1999-2005 Ivo Timmermans,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_PROTOCOL_H__
-#define __TINC_PROTOCOL_H__
-
 /* Protocol version. Different versions are incompatible,
    incompatible version have different protocols.
  */
@@ -123,4 +123,4 @@ extern bool req_key_h(struct connection_t *);
 extern bool ans_key_h(struct connection_t *);
 extern bool tcppacket_h(struct connection_t *);
 
-#endif							/* __TINC_PROTOCOL_H__ */
+#endif

+ 3 - 3
src/proxy.h

@@ -1,3 +1,6 @@
+#ifndef TINC_PROXY_H
+#define TINC_PROXY_H
+
 /*
     proxy.h -- header for proxy.c
     Copyright (C) 2015 Guus Sliepen <guus@tinc-vpn.org>
@@ -17,9 +20,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_PROXY_H__
-#define __TINC_PROXY_H__
-
 #include "connection.h"
 
 typedef enum proxytype_t {

+ 4 - 4
src/route.h

@@ -1,3 +1,6 @@
+#ifndef TINC_ROUTE_H
+#define TINC_ROUTE_H
+
 /*
     route.h -- header file for route.c
     Copyright (C) 2000-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_ROUTE_H__
-#define __TINC_ROUTE_H__
-
 #include "net.h"
 #include "node.h"
 
@@ -56,4 +56,4 @@ extern mac_t mymac;
 extern void age_subnets(void);
 extern void route(struct node_t *, struct vpn_packet_t *);
 
-#endif							/* __TINC_ROUTE_H__ */
+#endif

+ 4 - 4
src/subnet.h

@@ -1,3 +1,6 @@
+#ifndef TINC_SUBNET_H
+#define TINC_SUBNET_H
+
 /*
     subnet.h -- header for subnet.c
     Copyright (C) 2000-2009 Guus Sliepen <guus@tinc-vpn.org>,
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_SUBNET_H__
-#define __TINC_SUBNET_H__
-
 #include "net.h"
 
 typedef enum subnet_type_t {
@@ -85,4 +85,4 @@ extern subnet_t *lookup_subnet_ipv6(const ipv6_t *);
 extern void dump_subnets(void);
 extern void subnet_cache_flush(void);
 
-#endif							/* __TINC_SUBNET_H__ */
+#endif

+ 4 - 4
src/system.h

@@ -1,3 +1,6 @@
+#ifndef TINC_SYSTEM_H
+#define TINC_SYSTEM_H
+
 /*
     system.h -- system headers
     Copyright (C) 1998-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_SYSTEM_H__
-#define __TINC_SYSTEM_H__
-
 #include "config.h"
 
 #include "have.h"
@@ -43,4 +43,4 @@ typedef int bool;
 typedef int socklen_t;
 #endif
 
-#endif /* __TINC_SYSTEM_H__ */
+#endif

+ 1 - 1
src/tincd.c

@@ -543,7 +543,7 @@ static bool drop_privs() {
 			       "initgroups", strerror(errno));
 			return false;
 		}
-#ifndef __ANDROID__
+#ifndef ANDROID
 // Not supported in android NDK
 		endgrent();
 		endpwent();

+ 1 - 1
src/uml_device.c

@@ -260,7 +260,7 @@ static bool read_packet(vpn_packet_t *packet) {
 		}
 
 		default:
-			logger(LOG_ERR, "Invalid value for state variable in " __FILE__);
+			logger(LOG_ERR, "Invalid value for state variable in " FILE);
 			abort();
 	}
 }

+ 4 - 4
src/utils.h

@@ -1,3 +1,6 @@
+#ifndef TINC_UTILS_H
+#define TINC_UTILS_H
+
 /*
     utils.h -- header file for utils.c
     Copyright (C) 1999-2005 Ivo Timmermans
@@ -18,9 +21,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef __TINC_UTILS_H__
-#define __TINC_UTILS_H__
-
 extern bool hex2bin(char *src, char *dst, int length);
 extern void bin2hex(char *src, char *dst, int length);
 
@@ -44,4 +44,4 @@ extern unsigned int bitfield_to_int(const void *bitfield, size_t size);
 
 int memcmp_constant_time (const void *a, const void *b, size_t size);
 
-#endif							/* __TINC_UTILS_H__ */
+#endif

+ 5 - 4
src/xalloc.h

@@ -1,3 +1,6 @@
+#ifndef TINC_XALLOC_H
+#define TINC_XALLOC_H
+
 /*
    xalloc.h -- malloc and related fuctions with out of memory checking
    Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
@@ -15,10 +18,8 @@
 
    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc., Foundation,
-   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  */
-
-#ifndef __TINC_XALLOC_H__
-#define __TINC_XALLOC_H__
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
 
 static inline void *xmalloc(size_t n) __attribute__ ((__malloc__));
 static inline void *xmalloc(size_t n) {