From: Guus Sliepen Date: Sat, 7 Oct 2017 15:17:21 +0000 (+0200) Subject: Update all header guards. X-Git-Tag: release-1.0.33~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d178b58;p=oweals%2Ftinc.git 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. --- diff --git a/src/Makefile.am b/src/Makefile.am index 11f701c..5083103 100644 --- a/src/Makefile.am +++ b/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 \ diff --git a/src/avl_tree.h b/src/avl_tree.h index 4171264..56aaf2e 100644 --- a/src/avl_tree.h +++ b/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 . */ - -#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 diff --git a/src/conf.h b/src/conf.h index 59c081c..1be18c3 100644 --- a/src/conf.h +++ b/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 diff --git a/src/connection.h b/src/connection.h index 099d9d3..206d520 100644 --- a/src/connection.h +++ b/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 , @@ -18,9 +21,6 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_CONNECTION_H__ -#define __TINC_CONNECTION_H__ - #include #include @@ -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 diff --git a/src/device.h b/src/device.h index a3c2914..bf502e0 100644 --- a/src/device.h +++ b/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 diff --git a/src/dropin.h b/src/dropin.h index dc7dbee..e2d5304 100644 --- a/src/dropin.h +++ b/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 diff --git a/src/edge.h b/src/edge.h index 4c65213..ad92641 100644 --- a/src/edge.h +++ b/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 , @@ -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 diff --git a/src/ethernet.h b/src/ethernet.h index 8bf2b03..eea78dd 100644 --- a/src/ethernet.h +++ b/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 diff --git a/src/event.h b/src/event.h index 38a4eb4..d1ca9d2 100644 --- a/src/event.h +++ b/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 , @@ -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 diff --git a/src/fake-gai-errnos.h b/src/fake-gai-errnos.h deleted file mode 100644 index 4ffabb6..0000000 --- a/src/fake-gai-errnos.h +++ /dev/null @@ -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 diff --git a/src/fake-getaddrinfo.h b/src/fake-getaddrinfo.h index 5af7491..9316f5a 100644 --- a/src/fake-getaddrinfo.h +++ b/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 diff --git a/src/fake-getnameinfo.h b/src/fake-getnameinfo.h index 4389a8f..f939ffc 100644 --- a/src/fake-getnameinfo.h +++ b/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 diff --git a/src/getopt.c b/src/getopt.c index d63887e..273a000 100644 --- a/src/getopt.c +++ b/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 #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 @@ -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 #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 diff --git a/src/getopt.h b/src/getopt.h index ddf6fdd..2290d7c 100644 --- a/src/getopt.h +++ b/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 diff --git a/src/getopt1.c b/src/getopt1.c index 19605a5..07f5b2d 100644 --- a/src/getopt1.c +++ b/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 #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 #endif diff --git a/src/graph.h b/src/graph.h index fa521f5..fafffcb 100644 --- a/src/graph.h +++ b/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 , @@ -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 diff --git a/src/have.h b/src/have.h index 396143d..5bd4d66 100644 --- a/src/have.h +++ b/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 #endif -#endif /* __TINC_SYSTEM_H__ */ +#endif diff --git a/src/ipv4.h b/src/ipv4.h index bd63ad0..5fc1afe 100644 --- a/src/ipv4.h +++ b/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 diff --git a/src/ipv6.h b/src/ipv6.h index 6a4466f..b6862b6 100644 --- a/src/ipv6.h +++ b/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 diff --git a/src/list.h b/src/list.h index 197fbb8..2b22c04 100644 --- a/src/list.h +++ b/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 diff --git a/src/logger.h b/src/logger.h index ff2cb34..f50c17e 100644 --- a/src/logger.h +++ b/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 + + 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 diff --git a/src/meta.h b/src/meta.h index fcb09fc..c049b0b 100644 --- a/src/meta.h +++ b/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 , @@ -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 diff --git a/src/net.h b/src/net.h index e251ebd..d72de1d 100644 --- a/src/net.h +++ b/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 #include "ipv6.h" @@ -157,4 +157,4 @@ extern void load_all_subnets(void); extern CRITICAL_SECTION mutex; #endif -#endif /* __TINC_NET_H__ */ +#endif diff --git a/src/netutl.h b/src/netutl.h index bab6717..c445dfd 100644 --- a/src/netutl.h +++ b/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 diff --git a/src/node.h b/src/node.h index 69ed12f..14713b2 100644 --- a/src/node.h +++ b/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 , @@ -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 diff --git a/src/pidfile.h b/src/pidfile.h index 590a7bc..ed539e3 100644 --- a/src/pidfile.h +++ b/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 @@ -50,3 +53,5 @@ extern pid_t write_pid (const char *pidfile); */ extern int remove_pid (const char *pidfile); #endif + +#endif diff --git a/src/process.h b/src/process.h index 8d2d562..c0fc80f 100644 --- a/src/process.h +++ b/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 diff --git a/src/protocol.h b/src/protocol.h index 147475a..5ddb68c 100644 --- a/src/protocol.h +++ b/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 diff --git a/src/proxy.h b/src/proxy.h index a982943..9eb2903 100644 --- a/src/proxy.h +++ b/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 @@ -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 { diff --git a/src/route.h b/src/route.h index 7b45e76..74f7005 100644 --- a/src/route.h +++ b/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 diff --git a/src/subnet.h b/src/subnet.h index e129a95..878d877 100644 --- a/src/subnet.h +++ b/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 , @@ -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 diff --git a/src/system.h b/src/system.h index dfb4c6d..504e59c 100644 --- a/src/system.h +++ b/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 diff --git a/src/tincd.c b/src/tincd.c index 98a9a64..e338850 100644 --- a/src/tincd.c +++ b/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(); diff --git a/src/uml_device.c b/src/uml_device.c index a0b87f9..2db5896 100644 --- a/src/uml_device.c +++ b/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(); } } diff --git a/src/utils.h b/src/utils.h index 4d447b1..b598700 100644 --- a/src/utils.h +++ b/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 diff --git a/src/xalloc.h b/src/xalloc.h index e75f1bb..468d6bb 100644 --- a/src/xalloc.h +++ b/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) {