From 0cb921f3e969a08759e113c108dd622720339e3a Mon Sep 17 00:00:00 2001
From: Nick Mathewson <nickm@torproject.org>
Date: Fri, 12 Oct 2012 12:13:10 -0400
Subject: [PATCH] Convert all include-guard macros to avoid reserved
 identifiers.

In C, we technically aren't supposed to define our own things that
start with an underscore.

This is a purely machine-generated commit.  First, I ran this script
on all the headers in src/{common,or,test,tools/*}/*.h :
==============================

use strict;

my %macros = ();
my %skipped = ();
FILE: for my $fn (@ARGV) {
    my $f = $fn;
    if ($fn !~ /^\.\//) {
	$f = "./$fn";
    }
    $skipped{$fn} = 0;
    open(F, $fn);
    while (<F>) {
	if (/^#ifndef ([A-Za-z0-9_]+)/) {
	    $macros{$fn} = $1;
	    next FILE;
	}
    }
}

print "#!/usr/bin/perl -w -i -p\n\n";
for my $fn (@ARGV) {
    if (! exists $macros{$fn}) {
	print "# No macro known for $fn!\n" if (!$skipped{$fn});
	next;
    }
    if ($macros{$fn} !~ /_H_?$/) {
	print "# Weird macro for $fn...\n";
    }
    my $goodmacro = uc $fn;
    $goodmacro =~ s#.*/##;
    $goodmacro =~ s#[\/\-\.]#_#g;
    print "s/(?<![A-Za-z0-9_])$macros{$fn}(?![A-Za-z0-9_])/TOR_${goodmacro}/g;\n"
}
==============================

It produced the following output, which I then re-ran on those same files:

==============================

s/(?<![A-Za-z0-9_])_TOR_ADDRESS_H(?![A-Za-z0-9_])/TOR_ADDRESS_H/g;
s/(?<![A-Za-z0-9_])_TOR_AES_H(?![A-Za-z0-9_])/TOR_AES_H/g;
s/(?<![A-Za-z0-9_])_TOR_COMPAT_H(?![A-Za-z0-9_])/TOR_COMPAT_H/g;
s/(?<![A-Za-z0-9_])_TOR_COMPAT_LIBEVENT_H(?![A-Za-z0-9_])/TOR_COMPAT_LIBEVENT_H/g;
s/(?<![A-Za-z0-9_])_TOR_CONTAINER_H(?![A-Za-z0-9_])/TOR_CONTAINER_H/g;
s/(?<![A-Za-z0-9_])_TOR_CRYPTO_H(?![A-Za-z0-9_])/TOR_CRYPTO_H/g;
s/(?<![A-Za-z0-9_])TOR_DI_OPS_H(?![A-Za-z0-9_])/TOR_DI_OPS_H/g;
s/(?<![A-Za-z0-9_])_TOR_MEMAREA_H(?![A-Za-z0-9_])/TOR_MEMAREA_H/g;
s/(?<![A-Za-z0-9_])_TOR_MEMPOOL_H(?![A-Za-z0-9_])/TOR_MEMPOOL_H/g;
s/(?<![A-Za-z0-9_])TOR_PROCMON_H(?![A-Za-z0-9_])/TOR_PROCMON_H/g;
s/(?<![A-Za-z0-9_])_TOR_TORGZIP_H(?![A-Za-z0-9_])/TOR_TORGZIP_H/g;
s/(?<![A-Za-z0-9_])_TOR_TORINT_H(?![A-Za-z0-9_])/TOR_TORINT_H/g;
s/(?<![A-Za-z0-9_])_TOR_LOG_H(?![A-Za-z0-9_])/TOR_TORLOG_H/g;
s/(?<![A-Za-z0-9_])_TOR_TORTLS_H(?![A-Za-z0-9_])/TOR_TORTLS_H/g;
s/(?<![A-Za-z0-9_])_TOR_UTIL_H(?![A-Za-z0-9_])/TOR_UTIL_H/g;
s/(?<![A-Za-z0-9_])_TOR_BUFFERS_H(?![A-Za-z0-9_])/TOR_BUFFERS_H/g;
s/(?<![A-Za-z0-9_])_TOR_CHANNEL_H(?![A-Za-z0-9_])/TOR_CHANNEL_H/g;
s/(?<![A-Za-z0-9_])_TOR_CHANNEL_TLS_H(?![A-Za-z0-9_])/TOR_CHANNELTLS_H/g;
s/(?<![A-Za-z0-9_])_TOR_CIRCUITBUILD_H(?![A-Za-z0-9_])/TOR_CIRCUITBUILD_H/g;
s/(?<![A-Za-z0-9_])_TOR_CIRCUITLIST_H(?![A-Za-z0-9_])/TOR_CIRCUITLIST_H/g;
s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_EWMA_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_EWMA_H/g;
s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_H/g;
s/(?<![A-Za-z0-9_])_TOR_CIRCUITUSE_H(?![A-Za-z0-9_])/TOR_CIRCUITUSE_H/g;
s/(?<![A-Za-z0-9_])_TOR_COMMAND_H(?![A-Za-z0-9_])/TOR_COMMAND_H/g;
s/(?<![A-Za-z0-9_])_TOR_CONFIG_H(?![A-Za-z0-9_])/TOR_CONFIG_H/g;
s/(?<![A-Za-z0-9_])TOR_CONFPARSE_H(?![A-Za-z0-9_])/TOR_CONFPARSE_H/g;
s/(?<![A-Za-z0-9_])_TOR_CONNECTION_EDGE_H(?![A-Za-z0-9_])/TOR_CONNECTION_EDGE_H/g;
s/(?<![A-Za-z0-9_])_TOR_CONNECTION_H(?![A-Za-z0-9_])/TOR_CONNECTION_H/g;
s/(?<![A-Za-z0-9_])_TOR_CONNECTION_OR_H(?![A-Za-z0-9_])/TOR_CONNECTION_OR_H/g;
s/(?<![A-Za-z0-9_])_TOR_CONTROL_H(?![A-Za-z0-9_])/TOR_CONTROL_H/g;
s/(?<![A-Za-z0-9_])_TOR_CPUWORKER_H(?![A-Za-z0-9_])/TOR_CPUWORKER_H/g;
s/(?<![A-Za-z0-9_])_TOR_DIRECTORY_H(?![A-Za-z0-9_])/TOR_DIRECTORY_H/g;
s/(?<![A-Za-z0-9_])_TOR_DIRSERV_H(?![A-Za-z0-9_])/TOR_DIRSERV_H/g;
s/(?<![A-Za-z0-9_])_TOR_DIRVOTE_H(?![A-Za-z0-9_])/TOR_DIRVOTE_H/g;
s/(?<![A-Za-z0-9_])_TOR_DNS_H(?![A-Za-z0-9_])/TOR_DNS_H/g;
s/(?<![A-Za-z0-9_])_TOR_DNSSERV_H(?![A-Za-z0-9_])/TOR_DNSSERV_H/g;
s/(?<![A-Za-z0-9_])TOR_EVENTDNS_TOR_H(?![A-Za-z0-9_])/TOR_EVENTDNS_TOR_H/g;
s/(?<![A-Za-z0-9_])_TOR_GEOIP_H(?![A-Za-z0-9_])/TOR_GEOIP_H/g;
s/(?<![A-Za-z0-9_])_TOR_HIBERNATE_H(?![A-Za-z0-9_])/TOR_HIBERNATE_H/g;
s/(?<![A-Za-z0-9_])_TOR_MAIN_H(?![A-Za-z0-9_])/TOR_MAIN_H/g;
s/(?<![A-Za-z0-9_])_TOR_MICRODESC_H(?![A-Za-z0-9_])/TOR_MICRODESC_H/g;
s/(?<![A-Za-z0-9_])_TOR_NETWORKSTATUS_H(?![A-Za-z0-9_])/TOR_NETWORKSTATUS_H/g;
s/(?<![A-Za-z0-9_])_TOR_NODELIST_H(?![A-Za-z0-9_])/TOR_NODELIST_H/g;
s/(?<![A-Za-z0-9_])_TOR_NTMAIN_H(?![A-Za-z0-9_])/TOR_NTMAIN_H/g;
s/(?<![A-Za-z0-9_])_TOR_ONION_H(?![A-Za-z0-9_])/TOR_ONION_H/g;
s/(?<![A-Za-z0-9_])_TOR_OR_H(?![A-Za-z0-9_])/TOR_OR_H/g;
s/(?<![A-Za-z0-9_])_TOR_POLICIES_H(?![A-Za-z0-9_])/TOR_POLICIES_H/g;
s/(?<![A-Za-z0-9_])_TOR_REASONS_H(?![A-Za-z0-9_])/TOR_REASONS_H/g;
s/(?<![A-Za-z0-9_])_TOR_RELAY_H(?![A-Za-z0-9_])/TOR_RELAY_H/g;
s/(?<![A-Za-z0-9_])_TOR_RENDCLIENT_H(?![A-Za-z0-9_])/TOR_RENDCLIENT_H/g;
s/(?<![A-Za-z0-9_])_TOR_RENDCOMMON_H(?![A-Za-z0-9_])/TOR_RENDCOMMON_H/g;
s/(?<![A-Za-z0-9_])_TOR_RENDMID_H(?![A-Za-z0-9_])/TOR_RENDMID_H/g;
s/(?<![A-Za-z0-9_])_TOR_RENDSERVICE_H(?![A-Za-z0-9_])/TOR_RENDSERVICE_H/g;
s/(?<![A-Za-z0-9_])_TOR_REPHIST_H(?![A-Za-z0-9_])/TOR_REPHIST_H/g;
s/(?<![A-Za-z0-9_])_TOR_REPLAYCACHE_H(?![A-Za-z0-9_])/TOR_REPLAYCACHE_H/g;
s/(?<![A-Za-z0-9_])_TOR_ROUTER_H(?![A-Za-z0-9_])/TOR_ROUTER_H/g;
s/(?<![A-Za-z0-9_])_TOR_ROUTERLIST_H(?![A-Za-z0-9_])/TOR_ROUTERLIST_H/g;
s/(?<![A-Za-z0-9_])_TOR_ROUTERPARSE_H(?![A-Za-z0-9_])/TOR_ROUTERPARSE_H/g;
s/(?<![A-Za-z0-9_])TOR_ROUTERSET_H(?![A-Za-z0-9_])/TOR_ROUTERSET_H/g;
s/(?<![A-Za-z0-9_])TOR_STATEFILE_H(?![A-Za-z0-9_])/TOR_STATEFILE_H/g;
s/(?<![A-Za-z0-9_])_TOR_STATUS_H(?![A-Za-z0-9_])/TOR_STATUS_H/g;
s/(?<![A-Za-z0-9_])TOR_TRANSPORTS_H(?![A-Za-z0-9_])/TOR_TRANSPORTS_H/g;
s/(?<![A-Za-z0-9_])_TOR_TEST_H(?![A-Za-z0-9_])/TOR_TEST_H/g;
s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_H/g;
s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_NATPMP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_NATPMP_H/g;
s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_UPNP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_UPNP_H/g;
==============================
---
 src/common/address.h                           | 4 ++--
 src/common/aes.h                               | 4 ++--
 src/common/compat.h                            | 4 ++--
 src/common/compat_libevent.h                   | 4 ++--
 src/common/container.h                         | 4 ++--
 src/common/crypto.h                            | 4 ++--
 src/common/memarea.h                           | 4 ++--
 src/common/mempool.h                           | 4 ++--
 src/common/torgzip.h                           | 4 ++--
 src/common/torint.h                            | 4 ++--
 src/common/torlog.h                            | 4 ++--
 src/common/tortls.h                            | 4 ++--
 src/common/util.h                              | 4 ++--
 src/or/buffers.h                               | 4 ++--
 src/or/channel.h                               | 4 ++--
 src/or/channeltls.h                            | 4 ++--
 src/or/circuitbuild.h                          | 4 ++--
 src/or/circuitlist.h                           | 4 ++--
 src/or/circuitmux.h                            | 6 +++---
 src/or/circuitmux_ewma.h                       | 6 +++---
 src/or/circuituse.h                            | 4 ++--
 src/or/command.h                               | 4 ++--
 src/or/config.h                                | 4 ++--
 src/or/connection.h                            | 4 ++--
 src/or/connection_edge.h                       | 4 ++--
 src/or/connection_or.h                         | 4 ++--
 src/or/control.h                               | 4 ++--
 src/or/cpuworker.h                             | 4 ++--
 src/or/directory.h                             | 4 ++--
 src/or/dirserv.h                               | 4 ++--
 src/or/dirvote.h                               | 4 ++--
 src/or/dns.h                                   | 4 ++--
 src/or/dnsserv.h                               | 4 ++--
 src/or/geoip.h                                 | 4 ++--
 src/or/hibernate.h                             | 4 ++--
 src/or/main.h                                  | 4 ++--
 src/or/microdesc.h                             | 4 ++--
 src/or/networkstatus.h                         | 4 ++--
 src/or/nodelist.h                              | 4 ++--
 src/or/ntmain.h                                | 4 ++--
 src/or/onion.h                                 | 4 ++--
 src/or/or.h                                    | 4 ++--
 src/or/policies.h                              | 4 ++--
 src/or/reasons.h                               | 4 ++--
 src/or/relay.h                                 | 4 ++--
 src/or/rendclient.h                            | 4 ++--
 src/or/rendcommon.h                            | 4 ++--
 src/or/rendmid.h                               | 4 ++--
 src/or/rendservice.h                           | 4 ++--
 src/or/rephist.h                               | 4 ++--
 src/or/replaycache.h                           | 4 ++--
 src/or/router.h                                | 4 ++--
 src/or/routerlist.h                            | 4 ++--
 src/or/routerparse.h                           | 4 ++--
 src/or/status.h                                | 4 ++--
 src/test/test.h                                | 4 ++--
 src/tools/tor-fw-helper/tor-fw-helper-natpmp.h | 4 ++--
 src/tools/tor-fw-helper/tor-fw-helper-upnp.h   | 4 ++--
 src/tools/tor-fw-helper/tor-fw-helper.h        | 4 ++--
 59 files changed, 120 insertions(+), 120 deletions(-)

diff --git a/src/common/address.h b/src/common/address.h
index 9e7d750126..6c1b37f21d 100644
--- a/src/common/address.h
+++ b/src/common/address.h
@@ -8,8 +8,8 @@
  * \brief Headers for address.h
  **/
 
-#ifndef _TOR_ADDRESS_H
-#define _TOR_ADDRESS_H
+#ifndef TOR_ADDRESS_H
+#define TOR_ADDRESS_H
 
 #include "orconfig.h"
 #include "torint.h"
diff --git a/src/common/aes.h b/src/common/aes.h
index bde567f87f..fadeacc7ad 100644
--- a/src/common/aes.h
+++ b/src/common/aes.h
@@ -5,8 +5,8 @@
 
 /* Implements a minimal interface to counter-mode AES. */
 
-#ifndef _TOR_AES_H
-#define _TOR_AES_H
+#ifndef TOR_AES_H
+#define TOR_AES_H
 
 /**
  * \file aes.h
diff --git a/src/common/compat.h b/src/common/compat.h
index 42648bb04b..0a7b402524 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -3,8 +3,8 @@
  * Copyright (c) 2007-2012, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
-#ifndef _TOR_COMPAT_H
-#define _TOR_COMPAT_H
+#ifndef TOR_COMPAT_H
+#define TOR_COMPAT_H
 
 #include "orconfig.h"
 #include "torint.h"
diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 56285ef80d..68da472cfc 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -1,8 +1,8 @@
 /* Copyright (c) 2009-2012, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
-#ifndef _TOR_COMPAT_LIBEVENT_H
-#define _TOR_COMPAT_LIBEVENT_H
+#ifndef TOR_COMPAT_LIBEVENT_H
+#define TOR_COMPAT_LIBEVENT_H
 
 #include "orconfig.h"
 
diff --git a/src/common/container.h b/src/common/container.h
index dab3b83f37..0b3a3d1412 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -3,8 +3,8 @@
  * Copyright (c) 2007-2012, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
-#ifndef _TOR_CONTAINER_H
-#define _TOR_CONTAINER_H
+#ifndef TOR_CONTAINER_H
+#define TOR_CONTAINER_H
 
 #include "util.h"
 
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 542bc24ed3..22b1cde2b4 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -10,8 +10,8 @@
  * \brief Headers for crypto.c
  **/
 
-#ifndef _TOR_CRYPTO_H
-#define _TOR_CRYPTO_H
+#ifndef TOR_CRYPTO_H
+#define TOR_CRYPTO_H
 
 #include <stdio.h>
 #include "torint.h"
diff --git a/src/common/memarea.h b/src/common/memarea.h
index b3c76d8d0c..26c3e6dfe3 100644
--- a/src/common/memarea.h
+++ b/src/common/memarea.h
@@ -2,8 +2,8 @@
 /* See LICENSE for licensing information */
 /* Tor dependencies */
 
-#ifndef _TOR_MEMAREA_H
-#define _TOR_MEMAREA_H
+#ifndef TOR_MEMAREA_H
+#define TOR_MEMAREA_H
 
 typedef struct memarea_t memarea_t;
 
diff --git a/src/common/mempool.h b/src/common/mempool.h
index d0a7bc2f36..b01277df86 100644
--- a/src/common/mempool.h
+++ b/src/common/mempool.h
@@ -6,8 +6,8 @@
  * \brief Headers for mempool.c
  **/
 
-#ifndef _TOR_MEMPOOL_H
-#define _TOR_MEMPOOL_H
+#ifndef TOR_MEMPOOL_H
+#define TOR_MEMPOOL_H
 
 /** A memory pool is a context in which a large number of fixed-sized
 * objects can be allocated efficiently.  See mempool.c for implementation
diff --git a/src/common/torgzip.h b/src/common/torgzip.h
index d3ded81f9c..921b232b0f 100644
--- a/src/common/torgzip.h
+++ b/src/common/torgzip.h
@@ -8,8 +8,8 @@
  * \brief Headers for torgzip.h
  **/
 
-#ifndef _TOR_TORGZIP_H
-#define _TOR_TORGZIP_H
+#ifndef TOR_TORGZIP_H
+#define TOR_TORGZIP_H
 
 /** Enumeration of what kind of compression to use.  Only ZLIB_METHOD is
  * guaranteed to be supported by the compress/uncompress functions here;
diff --git a/src/common/torint.h b/src/common/torint.h
index 8771802d70..0db9cc7e24 100644
--- a/src/common/torint.h
+++ b/src/common/torint.h
@@ -8,8 +8,8 @@
  * \brief Header file to define uint32_t and friends
  **/
 
-#ifndef _TOR_TORINT_H
-#define _TOR_TORINT_H
+#ifndef TOR_TORINT_H
+#define TOR_TORINT_H
 
 #include "orconfig.h"
 
diff --git a/src/common/torlog.h b/src/common/torlog.h
index fd34db1ac9..fdd43994af 100644
--- a/src/common/torlog.h
+++ b/src/common/torlog.h
@@ -10,7 +10,7 @@
  * \brief Headers for log.c
  **/
 
-#ifndef _TOR_LOG_H
+#ifndef TOR_TORLOG_H
 
 #include "compat.h"
 
@@ -213,6 +213,6 @@ extern const char *_log_fn_function_name;
 
 #endif /* !GNUC */
 
-# define _TOR_LOG_H
+# define TOR_TORLOG_H
 #endif
 
diff --git a/src/common/tortls.h b/src/common/tortls.h
index 491a5419df..42173f14fb 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -3,8 +3,8 @@
  * Copyright (c) 2007-2012, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
-#ifndef _TOR_TORTLS_H
-#define _TOR_TORTLS_H
+#ifndef TOR_TORTLS_H
+#define TOR_TORTLS_H
 
 /**
  * \file tortls.h
diff --git a/src/common/util.h b/src/common/util.h
index 6667978d18..dc4af6334d 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -8,8 +8,8 @@
  * \brief Headers for util.c
  **/
 
-#ifndef _TOR_UTIL_H
-#define _TOR_UTIL_H
+#ifndef TOR_UTIL_H
+#define TOR_UTIL_H
 
 #include "orconfig.h"
 #include "torint.h"
diff --git a/src/or/buffers.h b/src/or/buffers.h
index a5886adc7a..f31d2910f7 100644
--- a/src/or/buffers.h
+++ b/src/or/buffers.h
@@ -9,8 +9,8 @@
  * \brief Header file for buffers.c.
  **/
 
-#ifndef _TOR_BUFFERS_H
-#define _TOR_BUFFERS_H
+#ifndef TOR_BUFFERS_H
+#define TOR_BUFFERS_H
 
 buf_t *buf_new(void);
 buf_t *buf_new_with_capacity(size_t size);
diff --git a/src/or/channel.h b/src/or/channel.h
index cb9835a9f5..716eb57d62 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -6,8 +6,8 @@
  * \brief Header file for channel.c
  **/
 
-#ifndef _TOR_CHANNEL_H
-#define _TOR_CHANNEL_H
+#ifndef TOR_CHANNEL_H
+#define TOR_CHANNEL_H
 
 #include "or.h"
 #include "circuitmux.h"
diff --git a/src/or/channeltls.h b/src/or/channeltls.h
index ca2fc88940..8eb2a63760 100644
--- a/src/or/channeltls.h
+++ b/src/or/channeltls.h
@@ -6,8 +6,8 @@
  * \brief Header file for channeltls.c
  **/
 
-#ifndef _TOR_CHANNEL_TLS_H
-#define _TOR_CHANNEL_TLS_H
+#ifndef TOR_CHANNELTLS_H
+#define TOR_CHANNELTLS_H
 
 #include "or.h"
 #include "channel.h"
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index 0abffc5166..3ab8fd5ca0 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -9,8 +9,8 @@
  * \brief Header file for circuitbuild.c.
  **/
 
-#ifndef _TOR_CIRCUITBUILD_H
-#define _TOR_CIRCUITBUILD_H
+#ifndef TOR_CIRCUITBUILD_H
+#define TOR_CIRCUITBUILD_H
 
 char *circuit_list_path(origin_circuit_t *circ, int verbose);
 char *circuit_list_path_for_controller(origin_circuit_t *circ);
diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h
index 89e957c70a..0239da306a 100644
--- a/src/or/circuitlist.h
+++ b/src/or/circuitlist.h
@@ -9,8 +9,8 @@
  * \brief Header file for circuitlist.c.
  **/
 
-#ifndef _TOR_CIRCUITLIST_H
-#define _TOR_CIRCUITLIST_H
+#ifndef TOR_CIRCUITLIST_H
+#define TOR_CIRCUITLIST_H
 
 circuit_t * _circuit_get_global_list(void);
 const char *circuit_state_to_string(int state);
diff --git a/src/or/circuitmux.h b/src/or/circuitmux.h
index a3eacaf7d4..b22d1423d0 100644
--- a/src/or/circuitmux.h
+++ b/src/or/circuitmux.h
@@ -6,8 +6,8 @@
  * \brief Header file for circuitmux.c
  **/
 
-#ifndef _TOR_CIRCUITMUX_H
-#define _TOR_CIRCUITMUX_H
+#ifndef TOR_CIRCUITMUX_H
+#define TOR_CIRCUITMUX_H
 
 #include "or.h"
 
@@ -132,5 +132,5 @@ void circuitmux_clear_num_cells(circuitmux_t *cmux, circuit_t *circ);
 void circuitmux_set_num_cells(circuitmux_t *cmux, circuit_t *circ,
                               unsigned int n_cells);
 
-#endif /* _TOR_CIRCUITMUX_H */
+#endif /* TOR_CIRCUITMUX_H */
 
diff --git a/src/or/circuitmux_ewma.h b/src/or/circuitmux_ewma.h
index eec16f3729..dd612e16cb 100644
--- a/src/or/circuitmux_ewma.h
+++ b/src/or/circuitmux_ewma.h
@@ -6,8 +6,8 @@
  * \brief Header file for circuitmux_ewma.c
  **/
 
-#ifndef _TOR_CIRCUITMUX_EWMA_H
-#define _TOR_CIRCUITMUX_EWMA_H
+#ifndef TOR_CIRCUITMUX_EWMA_H
+#define TOR_CIRCUITMUX_EWMA_H
 
 #include "or.h"
 #include "circuitmux.h"
@@ -25,5 +25,5 @@ unsigned int cell_ewma_get_tick(void);
 void cell_ewma_set_scale_factor(const or_options_t *options,
                                 const networkstatus_t *consensus);
 
-#endif /* _TOR_CIRCUITMUX_EWMA_H */
+#endif /* TOR_CIRCUITMUX_EWMA_H */
 
diff --git a/src/or/circuituse.h b/src/or/circuituse.h
index be2bd7ec51..e8760c22d3 100644
--- a/src/or/circuituse.h
+++ b/src/or/circuituse.h
@@ -9,8 +9,8 @@
  * \brief Header file for circuituse.c.
  **/
 
-#ifndef _TOR_CIRCUITUSE_H
-#define _TOR_CIRCUITUSE_H
+#ifndef TOR_CIRCUITUSE_H
+#define TOR_CIRCUITUSE_H
 
 void circuit_expire_building(void);
 void circuit_remove_handled_ports(smartlist_t *needed_ports);
diff --git a/src/or/command.h b/src/or/command.h
index f9a0ef20b7..375d704561 100644
--- a/src/or/command.h
+++ b/src/or/command.h
@@ -9,8 +9,8 @@
  * \brief Header file for command.c.
  **/
 
-#ifndef _TOR_COMMAND_H
-#define _TOR_COMMAND_H
+#ifndef TOR_COMMAND_H
+#define TOR_COMMAND_H
 
 #include "channel.h"
 
diff --git a/src/or/config.h b/src/or/config.h
index 9d170b8af5..f3b28adb78 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -9,8 +9,8 @@
  * \brief Header file for config.c.
  **/
 
-#ifndef _TOR_CONFIG_H
-#define _TOR_CONFIG_H
+#ifndef TOR_CONFIG_H
+#define TOR_CONFIG_H
 
 const char *get_dirportfrontpage(void);
 const or_options_t *get_options(void);
diff --git a/src/or/connection.h b/src/or/connection.h
index 785625e44b..d32c30c4ab 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -9,8 +9,8 @@
  * \brief Header file for connection.c.
  **/
 
-#ifndef _TOR_CONNECTION_H
-#define _TOR_CONNECTION_H
+#ifndef TOR_CONNECTION_H
+#define TOR_CONNECTION_H
 
 /* XXXX For buf_datalen in inline function */
 #include "buffers.h"
diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h
index c320d6ba49..499bf421dd 100644
--- a/src/or/connection_edge.h
+++ b/src/or/connection_edge.h
@@ -9,8 +9,8 @@
  * \brief Header file for connection_edge.c.
  **/
 
-#ifndef _TOR_CONNECTION_EDGE_H
-#define _TOR_CONNECTION_EDGE_H
+#ifndef TOR_CONNECTION_EDGE_H
+#define TOR_CONNECTION_EDGE_H
 
 #define connection_mark_unattached_ap(conn, endreason) \
   _connection_mark_unattached_ap((conn), (endreason), __LINE__, _SHORT_FILE_)
diff --git a/src/or/connection_or.h b/src/or/connection_or.h
index 22126b05fe..adfdde8d1b 100644
--- a/src/or/connection_or.h
+++ b/src/or/connection_or.h
@@ -9,8 +9,8 @@
  * \brief Header file for connection_or.c.
  **/
 
-#ifndef _TOR_CONNECTION_OR_H
-#define _TOR_CONNECTION_OR_H
+#ifndef TOR_CONNECTION_OR_H
+#define TOR_CONNECTION_OR_H
 
 void connection_or_remove_from_identity_map(or_connection_t *conn);
 void connection_or_clear_identity_map(void);
diff --git a/src/or/control.h b/src/or/control.h
index f301ce91be..eea3af724c 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -9,8 +9,8 @@
  * \brief Header file for control.c.
  **/
 
-#ifndef _TOR_CONTROL_H
-#define _TOR_CONTROL_H
+#ifndef TOR_CONTROL_H
+#define TOR_CONTROL_H
 
 void control_update_global_event_mask(void);
 void control_adjust_event_log_severity(void);
diff --git a/src/or/cpuworker.h b/src/or/cpuworker.h
index 91172caa56..73c7eefd4c 100644
--- a/src/or/cpuworker.h
+++ b/src/or/cpuworker.h
@@ -9,8 +9,8 @@
  * \brief Header file for cpuworker.c.
  **/
 
-#ifndef _TOR_CPUWORKER_H
-#define _TOR_CPUWORKER_H
+#ifndef TOR_CPUWORKER_H
+#define TOR_CPUWORKER_H
 
 void cpu_init(void);
 void cpuworkers_rotate(void);
diff --git a/src/or/directory.h b/src/or/directory.h
index fef671a0ef..9ff78d12c4 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -9,8 +9,8 @@
  * \brief Header file for directory.c.
  **/
 
-#ifndef _TOR_DIRECTORY_H
-#define _TOR_DIRECTORY_H
+#ifndef TOR_DIRECTORY_H
+#define TOR_DIRECTORY_H
 
 int directories_have_accepted_server_descriptor(void);
 void directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
diff --git a/src/or/dirserv.h b/src/or/dirserv.h
index 8508c938a8..ca401407d5 100644
--- a/src/or/dirserv.h
+++ b/src/or/dirserv.h
@@ -9,8 +9,8 @@
  * \brief Header file for dirserv.c.
  **/
 
-#ifndef _TOR_DIRSERV_H
-#define _TOR_DIRSERV_H
+#ifndef TOR_DIRSERV_H
+#define TOR_DIRSERV_H
 
 /** What fraction (1 over this number) of the relay ID space do we
  * (as a directory authority) launch connections to at each reachability
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index 6211218641..04cf2f9710 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -9,8 +9,8 @@
  * \brief Header file for dirvote.c.
  **/
 
-#ifndef _TOR_DIRVOTE_H
-#define _TOR_DIRVOTE_H
+#ifndef TOR_DIRVOTE_H
+#define TOR_DIRVOTE_H
 
 /** Lowest allowable value for VoteSeconds. */
 #define MIN_VOTE_SECONDS 20
diff --git a/src/or/dns.h b/src/or/dns.h
index 8c8b476ac8..441a6c3506 100644
--- a/src/or/dns.h
+++ b/src/or/dns.h
@@ -9,8 +9,8 @@
  * \brief Header file for dns.c.
  **/
 
-#ifndef _TOR_DNS_H
-#define _TOR_DNS_H
+#ifndef TOR_DNS_H
+#define TOR_DNS_H
 
 int dns_init(void);
 int has_dns_init_failed(void);
diff --git a/src/or/dnsserv.h b/src/or/dnsserv.h
index 3aaa038d2b..39bd1d33b2 100644
--- a/src/or/dnsserv.h
+++ b/src/or/dnsserv.h
@@ -9,8 +9,8 @@
  * \brief Header file for dnsserv.c.
  **/
 
-#ifndef _TOR_DNSSERV_H
-#define _TOR_DNSSERV_H
+#ifndef TOR_DNSSERV_H
+#define TOR_DNSSERV_H
 
 void dnsserv_configure_listener(connection_t *conn);
 void dnsserv_close_listener(connection_t *conn);
diff --git a/src/or/geoip.h b/src/or/geoip.h
index 4aed4e07bb..bda5fe2c58 100644
--- a/src/or/geoip.h
+++ b/src/or/geoip.h
@@ -9,8 +9,8 @@
  * \brief Header file for geoip.c.
  **/
 
-#ifndef _TOR_GEOIP_H
-#define _TOR_GEOIP_H
+#ifndef TOR_GEOIP_H
+#define TOR_GEOIP_H
 
 #ifdef GEOIP_PRIVATE
 int geoip_parse_entry(const char *line);
diff --git a/src/or/hibernate.h b/src/or/hibernate.h
index 9aa026b7b0..5f99cde015 100644
--- a/src/or/hibernate.h
+++ b/src/or/hibernate.h
@@ -9,8 +9,8 @@
  * \brief Header file for hibernate.c.
  **/
 
-#ifndef _TOR_HIBERNATE_H
-#define _TOR_HIBERNATE_H
+#ifndef TOR_HIBERNATE_H
+#define TOR_HIBERNATE_H
 
 int accounting_parse_options(const or_options_t *options, int validate_only);
 int accounting_is_enabled(const or_options_t *options);
diff --git a/src/or/main.h b/src/or/main.h
index f843b6f9fc..da2bcfd493 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -9,8 +9,8 @@
  * \brief Header file for main.c.
  **/
 
-#ifndef _TOR_MAIN_H
-#define _TOR_MAIN_H
+#ifndef TOR_MAIN_H
+#define TOR_MAIN_H
 
 extern int can_complete_circuit;
 
diff --git a/src/or/microdesc.h b/src/or/microdesc.h
index 5646fc7a85..4b18caaae0 100644
--- a/src/or/microdesc.h
+++ b/src/or/microdesc.h
@@ -9,8 +9,8 @@
  * \brief Header file for microdesc.c.
  **/
 
-#ifndef _TOR_MICRODESC_H
-#define _TOR_MICRODESC_H
+#ifndef TOR_MICRODESC_H
+#define TOR_MICRODESC_H
 
 microdesc_cache_t *get_microdesc_cache(void);
 
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index dcd58f8898..fe16f33918 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -9,8 +9,8 @@
  * \brief Header file for networkstatus.c.
  **/
 
-#ifndef _TOR_NETWORKSTATUS_H
-#define _TOR_NETWORKSTATUS_H
+#ifndef TOR_NETWORKSTATUS_H
+#define TOR_NETWORKSTATUS_H
 
 /** How old do we allow a v2 network-status to get before removing it
  * completely? */
diff --git a/src/or/nodelist.h b/src/or/nodelist.h
index 2e978f1782..13a3847414 100644
--- a/src/or/nodelist.h
+++ b/src/or/nodelist.h
@@ -9,8 +9,8 @@
  * \brief Header file for nodelist.c.
  **/
 
-#ifndef _TOR_NODELIST_H
-#define _TOR_NODELIST_H
+#ifndef TOR_NODELIST_H
+#define TOR_NODELIST_H
 
 #define node_assert_ok(n) STMT_BEGIN {                          \
     tor_assert((n)->ri || (n)->rs);                             \
diff --git a/src/or/ntmain.h b/src/or/ntmain.h
index 07fdcf466b..95a835a42e 100644
--- a/src/or/ntmain.h
+++ b/src/or/ntmain.h
@@ -9,8 +9,8 @@
  * \brief Header file for ntmain.c.
  **/
 
-#ifndef _TOR_NTMAIN_H
-#define _TOR_NTMAIN_H
+#ifndef TOR_NTMAIN_H
+#define TOR_NTMAIN_H
 
 #ifdef _WIN32
 #if !defined (WINCE)
diff --git a/src/or/onion.h b/src/or/onion.h
index 7e0f873c73..e7626f9709 100644
--- a/src/or/onion.h
+++ b/src/or/onion.h
@@ -9,8 +9,8 @@
  * \brief Header file for onion.c.
  **/
 
-#ifndef _TOR_ONION_H
-#define _TOR_ONION_H
+#ifndef TOR_ONION_H
+#define TOR_ONION_H
 
 int onion_pending_add(or_circuit_t *circ, char *onionskin);
 or_circuit_t *onion_next_task(char **onionskin_out);
diff --git a/src/or/or.h b/src/or/or.h
index 96e0299614..39b6d2bb36 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -9,8 +9,8 @@
  * \brief Master header file for Tor-specific functionality.
  **/
 
-#ifndef _TOR_OR_H
-#define _TOR_OR_H
+#ifndef TOR_OR_H
+#define TOR_OR_H
 
 #include "orconfig.h"
 
diff --git a/src/or/policies.h b/src/or/policies.h
index 31f3f06c7d..93fd572e2c 100644
--- a/src/or/policies.h
+++ b/src/or/policies.h
@@ -9,8 +9,8 @@
  * \brief Header file for policies.c.
  **/
 
-#ifndef _TOR_POLICIES_H
-#define _TOR_POLICIES_H
+#ifndef TOR_POLICIES_H
+#define TOR_POLICIES_H
 
 /* (length of "accept 255.255.255.255/255.255.255.255:65535-65535\n" plus a
  * NUL.)
diff --git a/src/or/reasons.h b/src/or/reasons.h
index 377b61b113..0dbf5aa693 100644
--- a/src/or/reasons.h
+++ b/src/or/reasons.h
@@ -9,8 +9,8 @@
  * \brief Header file for reasons.c.
  **/
 
-#ifndef _TOR_REASONS_H
-#define _TOR_REASONS_H
+#ifndef TOR_REASONS_H
+#define TOR_REASONS_H
 
 const char *stream_end_reason_to_control_string(int reason);
 const char *stream_end_reason_to_string(int reason);
diff --git a/src/or/relay.h b/src/or/relay.h
index 5759c51801..3906d6bf85 100644
--- a/src/or/relay.h
+++ b/src/or/relay.h
@@ -9,8 +9,8 @@
  * \brief Header file for relay.c.
  **/
 
-#ifndef _TOR_RELAY_H
-#define _TOR_RELAY_H
+#ifndef TOR_RELAY_H
+#define TOR_RELAY_H
 
 extern uint64_t stats_n_relay_cells_relayed;
 extern uint64_t stats_n_relay_cells_delivered;
diff --git a/src/or/rendclient.h b/src/or/rendclient.h
index 393b556e32..b71fe48be3 100644
--- a/src/or/rendclient.h
+++ b/src/or/rendclient.h
@@ -9,8 +9,8 @@
  * \brief Header file for rendclient.c.
  **/
 
-#ifndef _TOR_RENDCLIENT_H
-#define _TOR_RENDCLIENT_H
+#ifndef TOR_RENDCLIENT_H
+#define TOR_RENDCLIENT_H
 
 void rend_client_purge_state(void);
 
diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h
index be6bd13d2c..fe574b152f 100644
--- a/src/or/rendcommon.h
+++ b/src/or/rendcommon.h
@@ -9,8 +9,8 @@
  * \brief Header file for rendcommon.c.
  **/
 
-#ifndef _TOR_RENDCOMMON_H
-#define _TOR_RENDCOMMON_H
+#ifndef TOR_RENDCOMMON_H
+#define TOR_RENDCOMMON_H
 
 /** Free all storage associated with <b>data</b> */
 static INLINE void
diff --git a/src/or/rendmid.h b/src/or/rendmid.h
index 0af6436dea..74ba16b316 100644
--- a/src/or/rendmid.h
+++ b/src/or/rendmid.h
@@ -9,8 +9,8 @@
  * \brief Header file for rendmid.c.
  **/
 
-#ifndef _TOR_RENDMID_H
-#define _TOR_RENDMID_H
+#ifndef TOR_RENDMID_H
+#define TOR_RENDMID_H
 
 int rend_mid_establish_intro(or_circuit_t *circ, const uint8_t *request,
                              size_t request_len);
diff --git a/src/or/rendservice.h b/src/or/rendservice.h
index 0d6eddaee6..1671602348 100644
--- a/src/or/rendservice.h
+++ b/src/or/rendservice.h
@@ -9,8 +9,8 @@
  * \brief Header file for rendservice.c.
  **/
 
-#ifndef _TOR_RENDSERVICE_H
-#define _TOR_RENDSERVICE_H
+#ifndef TOR_RENDSERVICE_H
+#define TOR_RENDSERVICE_H
 
 #include "or.h"
 
diff --git a/src/or/rephist.h b/src/or/rephist.h
index d47724edb5..28dec8f902 100644
--- a/src/or/rephist.h
+++ b/src/or/rephist.h
@@ -9,8 +9,8 @@
  * \brief Header file for rephist.c.
  **/
 
-#ifndef _TOR_REPHIST_H
-#define _TOR_REPHIST_H
+#ifndef TOR_REPHIST_H
+#define TOR_REPHIST_H
 
 void rep_hist_init(void);
 void rep_hist_note_connect_failed(const char* nickname, time_t when);
diff --git a/src/or/replaycache.h b/src/or/replaycache.h
index 9f3107c513..757102b960 100644
--- a/src/or/replaycache.h
+++ b/src/or/replaycache.h
@@ -6,8 +6,8 @@
  * \brief Header file for replaycache.c.
  **/
 
-#ifndef _TOR_REPLAYCACHE_H
-#define _TOR_REPLAYCACHE_H
+#ifndef TOR_REPLAYCACHE_H
+#define TOR_REPLAYCACHE_H
 
 typedef struct replaycache_s replaycache_t;
 
diff --git a/src/or/router.h b/src/or/router.h
index 39640855e0..7ab057706d 100644
--- a/src/or/router.h
+++ b/src/or/router.h
@@ -9,8 +9,8 @@
  * \brief Header file for router.c.
  **/
 
-#ifndef _TOR_ROUTER_H
-#define _TOR_ROUTER_H
+#ifndef TOR_ROUTER_H
+#define TOR_ROUTER_H
 
 crypto_pk_t *get_onion_key(void);
 time_t get_onion_key_set_at(void);
diff --git a/src/or/routerlist.h b/src/or/routerlist.h
index 58143010b3..c8381996d2 100644
--- a/src/or/routerlist.h
+++ b/src/or/routerlist.h
@@ -8,8 +8,8 @@
  * \brief Header file for routerlist.c.
  **/
 
-#ifndef _TOR_ROUTERLIST_H
-#define _TOR_ROUTERLIST_H
+#ifndef TOR_ROUTERLIST_H
+#define TOR_ROUTERLIST_H
 
 int get_n_authorities(dirinfo_type_t type);
 int trusted_dirs_reload_certs(void);
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index c6382a7f6b..6cf94c1c2f 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -9,8 +9,8 @@
  * \brief Header file for routerparse.c.
  **/
 
-#ifndef _TOR_ROUTERPARSE_H
-#define _TOR_ROUTERPARSE_H
+#ifndef TOR_ROUTERPARSE_H
+#define TOR_ROUTERPARSE_H
 
 int router_get_router_hash(const char *s, size_t s_len, char *digest);
 int router_get_dir_hash(const char *s, char *digest);
diff --git a/src/or/status.h b/src/or/status.h
index 189ac789e1..de49d751c3 100644
--- a/src/or/status.h
+++ b/src/or/status.h
@@ -1,8 +1,8 @@
 /* Copyright (c) 2010-2012, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
-#ifndef _TOR_STATUS_H
-#define _TOR_STATUS_H
+#ifndef TOR_STATUS_H
+#define TOR_STATUS_H
 
 int log_heartbeat(time_t now);
 
diff --git a/src/test/test.h b/src/test/test.h
index 6dcb9490bd..08fad6b313 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -3,8 +3,8 @@
  * Copyright (c) 2007-2012, The Tor Project, Inc. */
 /* See LICENSE for licensing information */
 
-#ifndef _TOR_TEST_H
-#define _TOR_TEST_H
+#ifndef TOR_TEST_H
+#define TOR_TEST_H
 
 /**
  * \file test.h
diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
index 0f97236afb..037d409ac7 100644
--- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
+++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h
@@ -7,8 +7,8 @@
   **/
 
 #ifdef NAT_PMP
-#ifndef _TOR_FW_HELPER_NATPMP_H
-#define _TOR_FW_HELPER_NATPMP_H
+#ifndef TOR_TOR_FW_HELPER_NATPMP_H
+#define TOR_TOR_FW_HELPER_NATPMP_H
 
 #include <natpmp.h>
 
diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.h b/src/tools/tor-fw-helper/tor-fw-helper-upnp.h
index 3a061981d1..add350d2f6 100644
--- a/src/tools/tor-fw-helper/tor-fw-helper-upnp.h
+++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.h
@@ -8,8 +8,8 @@
   **/
 
 #ifdef MINIUPNPC
-#ifndef _TOR_FW_HELPER_UPNP_H
-#define _TOR_FW_HELPER_UPNP_H
+#ifndef TOR_TOR_FW_HELPER_UPNP_H
+#define TOR_TOR_FW_HELPER_UPNP_H
 
 #include <miniupnpc/miniwget.h>
 #include <miniupnpc/miniupnpc.h>
diff --git a/src/tools/tor-fw-helper/tor-fw-helper.h b/src/tools/tor-fw-helper/tor-fw-helper.h
index 08f94d0830..1f6c1ff26b 100644
--- a/src/tools/tor-fw-helper/tor-fw-helper.h
+++ b/src/tools/tor-fw-helper/tor-fw-helper.h
@@ -7,8 +7,8 @@
   * \brief The main header for our firewall helper.
   **/
 
-#ifndef _TOR_FW_HELPER_H
-#define _TOR_FW_HELPER_H
+#ifndef TOR_TOR_FW_HELPER_H
+#define TOR_TOR_FW_HELPER_H
 
 #include <stdint.h>
 #include <stdio.h>
-- 
GitLab