From 393adfaf9b0fb1cada87effedcba8e21f0837bce Mon Sep 17 00:00:00 2001
From: Richard Russon <rich@flatcap.org>
Date: Thu, 16 Mar 2017 23:19:36 +0000
Subject: [PATCH] tidy: unify include-guards

- add missing include-guards
- unify existing include-guards
- unnecessary conditionals around whole source
---
 account.h               |  6 +++---
 ascii.h                 |  7 +++----
 attach.h                |  7 ++++---
 bcache.h                |  7 ++++---
 browser.h               |  7 ++++---
 buffer.h                |  7 +++----
 buffy.h                 |  6 +++---
 charset.h               |  6 +++---
 compress.h              |  6 +++---
 copy.h                  |  5 +++++
 crypt-gpgme.h           |  6 +++---
 crypt-mod-pgp-gpgme.c   |  3 ---
 crypt-mod-smime-gpgme.c |  3 ---
 crypt-mod.h             |  6 +++---
 crypthash.h             |  6 +++---
 doc/makedoc-defs.h      |  5 +++++
 dotlock.h               |  6 +++---
 filter.h                |  7 +++----
 functions.h             |  5 +++++
 globals.h               |  5 +++++
 group.h                 |  6 +++---
 hash.h                  |  6 +++---
 hcache-backend.h        |  6 +++---
 hcache.h                |  6 +++---
 history.h               |  6 +++---
 imap/auth.h             |  6 +++---
 imap/imap.h             |  6 +++---
 imap/imap_private.h     |  6 +++---
 imap/message.h          |  6 +++---
 init.h                  |  5 +++++
 keymap.h                |  6 +++---
 lib.h                   |  7 ++++---
 mailbox.h               |  6 +++---
 mapping.h               |  6 +++---
 mbyte.h                 |  6 +++---
 md5.h                   |  6 +++---
 mime.h                  |  5 +++++
 mutt.h                  | 10 +++-------
 mutt_commands.h         |  6 +++---
 mutt_crypt.h            |  6 +++---
 mutt_curses.h           |  6 +++---
 mutt_idna.h             |  4 ++--
 mutt_lua.h              |  2 +-
 mutt_menu.h             |  6 +++---
 mutt_notmuch.h          |  2 +-
 mutt_options.h          |  6 +++---
 mutt_regex.h            |  6 +++---
 mutt_sasl.h             |  6 +++---
 mutt_sasl_plain.h       |  6 +++---
 mutt_socket.h           |  6 +++---
 mutt_ssl.h              |  6 +++---
 mutt_tunnel.h           |  6 +++---
 mx.h                    |  6 +++---
 myvar.h                 |  7 +++----
 nntp.h                  |  6 +++---
 pager.h                 |  5 +++++
 pgp.c                   |  4 ----
 pgp.h                   |  5 +++++
 pgpkey.c                |  3 ---
 pgplib.h                |  5 +++++
 pgppacket.h             |  6 +++---
 pop.h                   |  6 +++---
 protos.h                |  3 +++
 remailer.c              |  4 ----
 remailer.h              |  8 ++++----
 rfc1524.h               |  6 +++---
 rfc2047.h               |  5 +++++
 rfc2231.h               |  5 +++++
 rfc3676.h               |  4 ++--
 rfc822.h                |  6 +++---
 sha1.h                  |  6 +++---
 sidebar.h               |  6 +++---
 smime.c                 |  4 ----
 smime.h                 |  4 +++-
 sort.h                  |  5 +++++
 url.h                   |  6 +++---
 utf8.c                  |  3 ---
 version.c               |  2 +-
 version.h               |  6 +++---
 wcwidth.c               |  4 ----
 80 files changed, 237 insertions(+), 204 deletions(-)

diff --git a/account.h b/account.h
index 8cbc19539..d418b2682 100644
--- a/account.h
+++ b/account.h
@@ -17,8 +17,8 @@
 
 /* remote host account manipulation (POP/IMAP) */
 
-#ifndef _MUTT_ACCOUNT_H_
-#define _MUTT_ACCOUNT_H_ 1
+#ifndef _MUTT_ACCOUNT_H
+#define _MUTT_ACCOUNT_H 1
 
 #include "url.h"
 
@@ -58,4 +58,4 @@ int mutt_account_getlogin (ACCOUNT* account);
 int mutt_account_getpass (ACCOUNT* account);
 void mutt_account_unsetpass (ACCOUNT* account);
 
-#endif /* _MUTT_ACCOUNT_H_ */
+#endif /* _MUTT_ACCOUNT_H */
diff --git a/ascii.h b/ascii.h
index d3391398f..eaf13513d 100644
--- a/ascii.h
+++ b/ascii.h
@@ -15,14 +15,13 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 /*
  * Versions of the string comparison functions which are
  * locale-insensitive.
  */
 
-#ifndef _ASCII_H
-# define _ASCII_H
+#ifndef _MUTT_ASCII_H
+#define _MUTT_ASCII_H 1
 
 #include <ctype.h>
 
@@ -44,4 +43,4 @@ static inline char* ascii_strlower (char *s)
   return s;
 }
 
-#endif
+#endif /* _MUTT_ASCII_H */
diff --git a/attach.h b/attach.h
index 7aa129a35..a581146f3 100644
--- a/attach.h
+++ b/attach.h
@@ -17,8 +17,8 @@
 
 /* common protos for compose / attach menus */
 
-#ifndef _ATTACH_H_
-#define _ATTACH_H_ 1
+#ifndef _MUTT_ATTACH_H
+#define _MUTT_ATTACH_H 1
 
 #include "mutt_menu.h"
 
@@ -52,4 +52,5 @@ void mutt_attach_forward(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen,
                          BODY *cur, int flags);
 void mutt_attach_reply(FILE *fp, HEADER *hdr, ATTACHPTR **idx, short idxlen,
                        BODY *cur, int flags);
-#endif /* _ATTACH_H_ */
+
+#endif /* _MUTT_ATTACH_H */
diff --git a/bcache.h b/bcache.h
index dfb9d6550..a0859f9d9 100644
--- a/bcache.h
+++ b/bcache.h
@@ -15,8 +15,9 @@
  * You should have received a copy of the GNU General Public License along with
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef _BCACHE_H_
-#define _BCACHE_H_ 1
+
+#ifndef _MUTT_BCACHE_H
+#define _MUTT_BCACHE_H 1
 
 #include "account.h"
 
@@ -75,4 +76,4 @@ int mutt_bcache_list(body_cache_t *bcache,
 		     int (*want_id)(const char *id, body_cache_t *bcache,
 				    void *data), void *data);
 
-#endif /* _BCACHE_H_ */
+#endif /* _MUTT_BCACHE_H */
diff --git a/browser.h b/browser.h
index 40a9e7baf..2590e9f79 100644
--- a/browser.h
+++ b/browser.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _BROWSER_H
-#define _BROWSER_H 1
+#ifndef _MUTT_BROWSER_H
+#define _MUTT_BROWSER_H 1
 
 #ifdef USE_NNTP
 #include "nntp.h"
@@ -66,4 +66,5 @@ struct browser_state
   unsigned unmarked : 1;
 #endif
 };
-#endif /* _BROWSER_H */
+
+#endif /* _MUTT_BROWSER_H */
diff --git a/buffer.h b/buffer.h
index 0faa607d1..c40c89188 100644
--- a/buffer.h
+++ b/buffer.h
@@ -13,8 +13,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef BUFFER_INCLUDED
-#define BUFFER_INCLUDED
+#ifndef _MUTT_BUFFER_H
+#define _MUTT_BUFFER_H 1
 
 #include <sys/types.h>
 
@@ -44,5 +44,4 @@ void mutt_buffer_addstr(BUFFER *buf, const char *s);
 void mutt_buffer_addch(BUFFER *buf, char c);
 int mutt_extract_token(BUFFER *dest, BUFFER *tok, int flags);
 
-#endif
-
+#endif /* _MUTT_BUFFER_H */
diff --git a/buffy.h b/buffy.h
index f6a0c50cf..8910f1064 100644
--- a/buffy.h
+++ b/buffy.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _BUFFY_H
-#define _BUFFY_H
+#ifndef _MUTT_BUFFY_H
+#define _MUTT_BUFFY_H 1
 
 /*parameter to mutt_parse_mailboxes*/
 #define MUTT_MAILBOXES   1
@@ -68,4 +68,4 @@ void mutt_buffy_setnotified (const char *path);
 
 int mh_buffy (BUFFY *mailbox, int check_stats);
 
-#endif /* _BUFFY_H */
+#endif /* _MUTT_BUFFY_H */
diff --git a/charset.h b/charset.h
index 6f66b093a..29e02f5d7 100644
--- a/charset.h
+++ b/charset.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _CHARSET_H
-#define _CHARSET_H
+#ifndef _MUTT_CHARSET_H
+#define _MUTT_CHARSET_H 1
 
 #include <iconv.h>
 
@@ -50,4 +50,4 @@ char *mutt_get_default_charset (void);
  */
 int mutt_check_charset (const char *s, int strict);
 
-#endif /* _CHARSET_H */
+#endif /* _MUTT_CHARSET_H */
diff --git a/compress.h b/compress.h
index 94cafeca5..bfa262b67 100644
--- a/compress.h
+++ b/compress.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _COMPRESS_H_
-#define _COMPRESS_H_
+#ifndef _MUTT_COMPRESS_H
+#define _MUTT_COMPRESS_H 1
 
 int mutt_comp_can_append    (CONTEXT *ctx);
 int mutt_comp_can_read      (const char *path);
@@ -25,4 +25,4 @@ int mutt_comp_valid_command (const char *cmd);
 
 extern struct mx_ops mx_comp_ops;
 
-#endif /* _COMPRESS_H_ */
+#endif /* _MUTT_COMPRESS_H */
diff --git a/copy.h b/copy.h
index 72da8a519..51b69c265 100644
--- a/copy.h
+++ b/copy.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_COPY_H
+#define _MUTT_COPY_H 1
+
 /* flags to _mutt_copy_message */
 #define MUTT_CM_NOHEADER        1       /* don't copy the message header */
 #define MUTT_CM_PREFIX          (1<<1)  /* quote the message */
@@ -66,3 +69,5 @@ int _mutt_copy_message(FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body,
 int mutt_copy_message(FILE *fpout, CONTEXT *src, HEADER *hdr, int flags, int chflags);
 
 int mutt_append_message(CONTEXT *dest, CONTEXT *src, HEADER *hdr, int cmflags, int chflags);
+
+#endif /* _MUTT_COPY_H */
diff --git a/crypt-gpgme.h b/crypt-gpgme.h
index 7f5bd82f9..f9c174f75 100644
--- a/crypt-gpgme.h
+++ b/crypt-gpgme.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef CRYPT_GPGME_H
-#define CRYPT_GPGME_H
+#ifndef _MUTT_CRYPT_GPGME_H
+#define _MUTT_CRYPT_GPGME_H 1
 
 #include "mutt_crypt.h"
 
@@ -54,4 +54,4 @@ int smime_gpgme_verify_sender (HEADER *h);
 
 void mutt_gpgme_set_sender (const char *sender);
 
-#endif
+#endif /* _MUTT_CRYPT_GPGME_H */
diff --git a/crypt-mod-pgp-gpgme.c b/crypt-mod-pgp-gpgme.c
index 1333cf759..44dffa49c 100644
--- a/crypt-mod-pgp-gpgme.c
+++ b/crypt-mod-pgp-gpgme.c
@@ -21,8 +21,6 @@
 
 #include "config.h"
 
-#ifdef CRYPT_BACKEND_GPGME
-
 #include "crypt-mod.h"
 #include "crypt-gpgme.h"
 
@@ -140,4 +138,3 @@ struct crypt_module_specs crypt_mod_pgp_gpgme =
     }
   };
 
-#endif
diff --git a/crypt-mod-smime-gpgme.c b/crypt-mod-smime-gpgme.c
index 368f53a32..b2c19bb0b 100644
--- a/crypt-mod-smime-gpgme.c
+++ b/crypt-mod-smime-gpgme.c
@@ -21,8 +21,6 @@
 
 #include "config.h"
 
-#ifdef CRYPT_BACKEND_GPGME
-
 #include "crypt-mod.h"
 #include "crypt-gpgme.h"
 
@@ -112,4 +110,3 @@ struct crypt_module_specs crypt_mod_smime_gpgme =
     }
   };
 
-#endif
diff --git a/crypt-mod.h b/crypt-mod.h
index cfa406923..61149a309 100644
--- a/crypt-mod.h
+++ b/crypt-mod.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef CRYPTOGRAPHY_H
-#define CRYPTOGRAPHY_H
+#ifndef _MUTT_CRYPT_MOD_H
+#define _MUTT_CRYPT_MOD_H 1
 
 #include "mutt.h"
 #include "mutt_crypt.h"
@@ -134,4 +134,4 @@ crypt_module_specs_t crypto_module_lookup (int identifier);
 #define CRYPT_MOD_CALL(identifier, func) \
   *(crypto_module_lookup (APPLICATION_ ## identifier))->functions.func
 
-#endif
+#endif /* _MUTT_CRYPT_MOD_H */
diff --git a/crypthash.h b/crypthash.h
index de7653362..c00c98294 100644
--- a/crypthash.h
+++ b/crypthash.h
@@ -13,8 +13,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _CRYPTHASH_H
-# define _CRYPTHASH_H
+#ifndef _MUTT_CRYPTHASH_H
+#define _MUTT_CRYPTHASH_H 1
 
 
 # include <sys/types.h>
@@ -29,4 +29,4 @@
 /* POINTER defines a generic pointer type */
 typedef unsigned char *POINTER;
 
-#endif
+#endif /* _MUTT_CRYPTHASH_H */
diff --git a/doc/makedoc-defs.h b/doc/makedoc-defs.h
index 6a4bd2df6..c6f05c16c 100644
--- a/doc/makedoc-defs.h
+++ b/doc/makedoc-defs.h
@@ -15,6 +15,9 @@
 
 /* build complete documentation */
 
+#ifndef _MUTT_MAKEDOC_DEFS_H
+#define _MUTT_MAKEDOC_DEFS_H 1
+
 #ifdef MAKEDOC_FULL
 # ifndef CRYPT_BACKEND_GPGME
 #  define CRYPT_BACKEND_GPGME
@@ -83,3 +86,5 @@
 #  define USE_LUA
 # endif
 #endif
+
+#endif /* _MUTT_MAKEDOC_DEFS_H */
diff --git a/dotlock.h b/dotlock.h
index 1a67a78d8..145e4e430 100644
--- a/dotlock.h
+++ b/dotlock.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _DOTLOCK_H
-#define _DOTLOCK_H
+#ifndef _MUTT_DOTLOCK_H
+#define _MUTT_DOTLOCK_H 1
 
 /* exit values */
 
@@ -42,4 +42,4 @@
 int dotlock_invoke (const char *, int, int, int);
 #endif
 
-#endif
+#endif /* _MUTT_DOTLOCK_H */
diff --git a/filter.h b/filter.h
index aa13fb72e..90c24ff96 100644
--- a/filter.h
+++ b/filter.h
@@ -13,8 +13,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef FILTER_INCLUDED
-#define FILTER_INCLUDED
+#ifndef _MUTT_FILTER_H
+#define _MUTT_FILTER_H 1
 
 #include <unistd.h>
 #include <stdio.h>
@@ -24,5 +24,4 @@ pid_t mutt_create_filter_fd(const char *cmd, FILE **in, FILE **out, FILE **err,
 pid_t mutt_create_filter(const char *s, FILE **in, FILE **out, FILE **err);
 int mutt_wait_filter(pid_t pid);
 
-#endif
-
+#endif /* _MUTT_FILTER_H */
diff --git a/functions.h b/functions.h
index 829344212..b458cc20a 100644
--- a/functions.h
+++ b/functions.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_FUNCTIONS_H
+#define _MUTT_FUNCTIONS_H 1
+
 /*
  * This file contains the structures needed to parse ``bind'' commands, as
  * well as the default bindings for each menu.
@@ -565,3 +568,5 @@ const struct binding_t OpMix[] = { /* map: mixmaster */
 };
 #endif /* MIXMASTER */
 // clang-format on
+
+#endif /* _MUTT_FUNCTIONS_H */
diff --git a/globals.h b/globals.h
index e8d2ebeaf..96467138c 100644
--- a/globals.h
+++ b/globals.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_GLOBALS_H
+#define _MUTT_GLOBALS_H 1
+
 WHERE void (*mutt_error) (const char *, ...);
 WHERE void (*mutt_message) (const char *, ...);
 
@@ -350,3 +353,5 @@ extern const char * const Months[];
 #include "mutt_crypt.h"
 #include "git-ver.h"
 #endif /* MAIN_C */
+
+#endif /* _MUTT_GLOBALS_H */
diff --git a/group.h b/group.h
index ac1b3df79..bcdabc055 100644
--- a/group.h
+++ b/group.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_GROUP_H_
-#define _MUTT_GROUP_H_ 1
+#ifndef _MUTT_GROUP_H
+#define _MUTT_GROUP_H 1
 
 #define MUTT_GROUP   0
 #define MUTT_UNGROUP 1
@@ -33,4 +33,4 @@ int mutt_group_context_clear(group_context_t **ctx);
 int mutt_group_context_remove_rx(group_context_t *ctx, const char *s);
 int mutt_group_context_remove_adrlist(group_context_t *ctx, ADDRESS *a);
 
-#endif /* _MUTT_GROUP_H_ */
+#endif /* _MUTT_GROUP_H */
diff --git a/hash.h b/hash.h
index 501fbf281..fca5e0486 100644
--- a/hash.h
+++ b/hash.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _HASH_H
-#define _HASH_H
+#ifndef _MUTT_HASH_H
+#define _MUTT_HASH_H 1
 
 union hash_key
 {
@@ -74,4 +74,4 @@ struct hash_walk_state {
 
 struct hash_elem *hash_walk(const HASH *table, struct hash_walk_state *state);
 
-#endif
+#endif /* _MUTT_HASH_H */
diff --git a/hcache-backend.h b/hcache-backend.h
index 29c38e451..9d7b1ecb4 100644
--- a/hcache-backend.h
+++ b/hcache-backend.h
@@ -18,8 +18,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _HCACHE_BACKEND_H_
-#define _HCACHE_BACKEND_H_
+#ifndef _MUTT_HCACHE_BACKEND_H
+#define _MUTT_HCACHE_BACKEND_H 1
 
 #include <stdlib.h> /* for size_t */
 
@@ -128,4 +128,4 @@ typedef struct
     .backend = hcache_##_name##_backend       \
   };
 
-#endif /* _HCACHE_BACKEND_H_ */
+#endif /* _MUTT_HCACHE_BACKEND_H */
diff --git a/hcache.h b/hcache.h
index 53ebd2fa8..7af66ce29 100644
--- a/hcache.h
+++ b/hcache.h
@@ -18,8 +18,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _HCACHE_H_
-#define _HCACHE_H_ 1
+#ifndef _MUTT_HCACHE_H
+#define _MUTT_HCACHE_H 1
 
 #include "mutt.h"
 
@@ -157,4 +157,4 @@ int
 mutt_hcache_is_valid_backend(const char *s);
 
 
-#endif /* _HCACHE_H_ */
+#endif /* _MUTT_HCACHE_H */
diff --git a/history.h b/history.h
index f3c12402f..cd8610b5d 100644
--- a/history.h
+++ b/history.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _HISTORY_H
-#define _HISTORY_H
+#ifndef _MUTT_HISTORY_H
+#define _MUTT_HISTORY_H 1
 
 enum history_class
 {
@@ -44,4 +44,4 @@ void mutt_reset_history_state(history_class_t hclass);
 int mutt_history_at_scratch(history_class_t hclass);
 void mutt_history_save_scratch(history_class_t hclass, const char *s);
 
-#endif
+#endif /* _MUTT_HISTORY_H */
diff --git a/imap/auth.h b/imap/auth.h
index a45718104..8ff959861 100644
--- a/imap/auth.h
+++ b/imap/auth.h
@@ -18,8 +18,8 @@
 /* common defs for authenticators. A good place to set up a generic callback
  * system */
 
-#ifndef _IMAP_AUTH_H
-#define _IMAP_AUTH_H 1
+#ifndef _MUTT_IMAP_AUTH_H
+#define _MUTT_IMAP_AUTH_H 1
 
 typedef enum
 {
@@ -52,4 +52,4 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata, const char* method);
 imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method);
 #endif
 
-#endif /* _IMAP_AUTH_H */
+#endif /* _MUTT_IMAP_AUTH_H */
diff --git a/imap/imap.h b/imap/imap.h
index c2b437aab..53a7a1ef1 100644
--- a/imap/imap.h
+++ b/imap/imap.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _IMAP_H
-#define _IMAP_H 1
+#ifndef _MUTT_IMAP_H
+#define _MUTT_IMAP_H 1
 
 #include "account.h"
 #include "browser.h"
@@ -73,4 +73,4 @@ void imap_get_parent (char *output, const char *mbox, size_t olen, char delim);
 void imap_get_parent_path (char *output, const char *path, size_t olen);
 void imap_clean_path (char *path, size_t plen);
 
-#endif
+#endif /* _MUTT_IMAP_H */
diff --git a/imap/imap_private.h b/imap/imap_private.h
index 601174923..011285684 100644
--- a/imap/imap_private.h
+++ b/imap/imap_private.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _IMAP_PRIVATE_H
-#define _IMAP_PRIVATE_H 1
+#ifndef _MUTT_IMAP_PRIVATE_H
+#define _MUTT_IMAP_PRIVATE_H 1
 
 #include "account.h"
 #include "imap.h"
@@ -309,4 +309,4 @@ void imap_utf_decode (IMAP_DATA *idata, char **s);
 #define imap_hcache_keylen mutt_strlen
 #endif /* USE_HCACHE */
 
-#endif
+#endif /* _MUTT_IMAP_PRIVATE_H */
diff --git a/imap/message.h b/imap/message.h
index 24066dd40..163859d80 100644
--- a/imap/message.h
+++ b/imap/message.h
@@ -18,8 +18,8 @@
 
 /* message.c data structures */
 
-#ifndef MESSAGE_H
-#define MESSAGE_H 1
+#ifndef _MUTT_IMAP_MESSAGE_H
+#define _MUTT_IMAP_MESSAGE_H 1
 
 /* -- data structures -- */
 /* IMAP-specific header data, stored as HEADER->data */
@@ -52,4 +52,4 @@ typedef struct
 /* -- macros -- */
 #define HEADER_DATA(ph) ((IMAP_HEADER_DATA*) ((ph)->data))
 
-#endif /* MESSAGE_H */
+#endif /* _MUTT_IMAP_MESSAGE_H */
diff --git a/init.h b/init.h
index 0056d4bf9..8581fd8e1 100644
--- a/init.h
+++ b/init.h
@@ -16,6 +16,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_INIT_H
+#define _MUTT_INIT_H 1
+
 #ifdef _MAKEDOC
 # include "config.h"
 # include "doc/makedoc-defs.h"
@@ -4525,3 +4528,5 @@ const struct command_t Commands[] = {
   { "unsubscribe",	parse_unsubscribe,	0 },
   { NULL,		NULL,			0 }
 };
+
+#endif /* _MUTT_INIT_H */
diff --git a/keymap.h b/keymap.h
index e15c65b06..e1300103e 100644
--- a/keymap.h
+++ b/keymap.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef KEYMAP_H
-#define KEYMAP_H
+#ifndef _MUTT_KEYMAP_H
+#define _MUTT_KEYMAP_H 1
 
 #include "mapping.h"
 
@@ -118,4 +118,4 @@ extern const struct binding_t OpMix[];
 
 #include "keymap_defs.h"
 
-#endif /* KEYMAP_H */
+#endif /* _MUTT_KEYMAP_H */
diff --git a/lib.h b/lib.h
index 7404bcbc6..da02da64d 100644
--- a/lib.h
+++ b/lib.h
@@ -18,8 +18,8 @@
 
 /* mutt functions which are generally useful. */
 
-#ifndef _LIB_H
-# define _LIB_H
+#ifndef _MUTT_LIB_H
+#define _MUTT_LIB_H 1
 
 # include <stdio.h>
 # include <string.h>
@@ -206,4 +206,5 @@ void safe_realloc (void *, size_t);
 int  mutt_inbox_cmp (const char *a, const char *b);
 
 const char *mutt_strsysexit(int e);
-#endif
+
+#endif /* _MUTT_LIB_H */
diff --git a/mailbox.h b/mailbox.h
index 9e626bdb4..dee3e77ee 100644
--- a/mailbox.h
+++ b/mailbox.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MAILBOX_H
-#define _MAILBOX_H
+#ifndef _MUTT_MAILBOX_H
+#define _MUTT_MAILBOX_H 1
 
 /* flags for mutt_open_mailbox() */
 #define MUTT_NOSORT     (1<<0) /* do not sort the mailbox after opening it */
@@ -88,4 +88,4 @@ int mx_check_empty(const char *path);
 int mx_is_maildir(const char *path);
 int mx_is_mh(const char *path);
 
-#endif
+#endif /* _MUTT_MAILBOX_H */
diff --git a/mapping.h b/mapping.h
index ef75c2110..7d6c007e7 100644
--- a/mapping.h
+++ b/mapping.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef MAPPING_H
-#define MAPPING_H
+#ifndef _MUTT_MAPPING_H
+#define _MUTT_MAPPING_H 1
 
 struct mapping_t
 {
@@ -29,4 +29,4 @@ char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct mapping
 
 int mutt_getvaluebyname(const char *name, const struct mapping_t *map);
 
-#endif
+#endif /* _MUTT_MAPPING_H */
diff --git a/mbyte.h b/mbyte.h
index 8fde29b97..3ad916c1d 100644
--- a/mbyte.h
+++ b/mbyte.h
@@ -13,8 +13,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MBYTE_H
-# define _MBYTE_H
+#ifndef _MUTT_MBYTE_H
+#define _MUTT_MBYTE_H 1
 
 # ifdef HAVE_WC_FUNCS
 #  ifdef HAVE_WCHAR_H
@@ -65,4 +65,4 @@ extern int Charset_is_utf8;
 wchar_t replacement_char(void);
 int is_display_corrupting_utf8(wchar_t wc);
 
-#endif /* _MBYTE_H */
+#endif /* _MUTT_MBYTE_H */
diff --git a/md5.h b/md5.h
index 1280c0fce..c06c357f3 100644
--- a/md5.h
+++ b/md5.h
@@ -22,8 +22,8 @@
  * Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
  */
 
-#ifndef _MD5_H
-#define _MD5_H 1
+#ifndef _MUTT_MD5_H
+#define _MUTT_MD5_H 1
 
 #include <stdio.h>
 
@@ -127,4 +127,4 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW;
 extern void *__md5_buffer (const char *buffer, size_t len,
 			   void *resblock) __THROW;
 
-#endif /* md5.h */
+#endif /* _MUTT_MD5_H */
diff --git a/mime.h b/mime.h
index cbf0b6eed..028de19e7 100644
--- a/mime.h
+++ b/mime.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_MIME_H
+#define _MUTT_MIME_H 1
+
 /* Content-Type */
 enum
 {
@@ -76,3 +79,5 @@ extern const char *BodyEncodings[];
 #ifndef _SENDLIB_C
 extern char MimeSpecials[];
 #endif
+
+#endif /* _MUTT_MIME_H */
diff --git a/mutt.h b/mutt.h
index 93ae78e08..48ba7c673 100644
--- a/mutt.h
+++ b/mutt.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef MUTT_H
-#define MUTT_H
+#ifndef _MUTT_H
+#define _MUTT_H 1
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -1157,8 +1157,4 @@ typedef struct
 #include "lib.h"
 #include "globals.h"
 
-#endif /*MUTT_H*/
-
-
-
-
+#endif /* _MUTT_H */
diff --git a/mutt_commands.h b/mutt_commands.h
index c0550b2d7..ea18bde4c 100644
--- a/mutt_commands.h
+++ b/mutt_commands.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef MUTT_COMMANDS_H
-#define MUTT_COMMANDS_H
+#ifndef _MUTT_COMMANDS_H
+#define _MUTT_COMMANDS_H 1
 
 #include "mutt.h"
 
@@ -30,4 +30,4 @@ struct command_t
 const struct command_t *mutt_command_get(const char *s);
 void mutt_commands_apply(void *data, void (*application)(void *, const struct command_t *));
 
-#endif
+#endif /* _MUTT_COMMANDS_H */
diff --git a/mutt_crypt.h b/mutt_crypt.h
index 6413cbd3e..08bd3e463 100644
--- a/mutt_crypt.h
+++ b/mutt_crypt.h
@@ -21,8 +21,8 @@
    all defined in crypt.c and cryptglue.c
 */
 
-#ifndef MUTT_CRYPT_H
-#define MUTT_CRYPT_H
+#ifndef _MUTT_CRYPT_H
+#define _MUTT_CRYPT_H 1
 
 #include "mutt.h"        /* Need this to declare BODY, ADDRESS. STATE etc. */
 /* FIXME: They should be pointer to anonymous structures for better
@@ -285,4 +285,4 @@ int crypt_smime_verify_one (BODY *sigbdy, STATE *s, const char *tempf);
 
 void crypt_init (void);
 
-#endif /*MUTT_CRYPT_H*/
+#endif /* _MUTT_CRYPT_H */
diff --git a/mutt_curses.h b/mutt_curses.h
index ffe8eacfb..766078a4c 100644
--- a/mutt_curses.h
+++ b/mutt_curses.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_CURSES_H_
-#define _MUTT_CURSES_H_ 1
+#ifndef _MUTT_CURSES_H
+#define _MUTT_CURSES_H 1
 
 #ifdef USE_SLANG_CURSES
 
@@ -258,4 +258,4 @@ void ci_start_color (void);
 
 #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; }
 
-#endif /* _MUTT_CURSES_H_ */
+#endif /* _MUTT_CURSES_H */
diff --git a/mutt_idna.h b/mutt_idna.h
index 60ee6beaf..454d6dd56 100644
--- a/mutt_idna.h
+++ b/mutt_idna.h
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MUTT_IDNA_H
-# define _MUTT_IDNA_H
+#define _MUTT_IDNA_H 1
 
 #include "rfc822.h"
 #include "charset.h"
@@ -52,4 +52,4 @@ int mutt_env_to_intl(ENVELOPE *env, char **tag, char **err);
 
 const char *mutt_addr_for_display (ADDRESS *a);
 
-#endif
+#endif /* _MUTT_IDNA_H */
diff --git a/mutt_lua.h b/mutt_lua.h
index 5521cfe47..7a9f88ff7 100644
--- a/mutt_lua.h
+++ b/mutt_lua.h
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MUTT_LUA_H
-#define _MUTT_LUA_H
+#define _MUTT_LUA_H 1
 
 #include "mutt.h"
 
diff --git a/mutt_menu.h b/mutt_menu.h
index 9c55b44c6..606183d75 100644
--- a/mutt_menu.h
+++ b/mutt_menu.h
@@ -19,8 +19,8 @@
  * This file is named mutt_menu.h so it doesn't collide with ncurses menu.h
  */
 
-#ifndef _MUTT_MENU_H_
-#define _MUTT_MENU_H_ 1
+#ifndef _MUTT_MENU_H
+#define _MUTT_MENU_H 1
 
 #include "keymap.h"
 #include "mutt_regex.h"
@@ -127,4 +127,4 @@ int index_color(int index_no);
 
 int mutt_limit_current_thread (HEADER *h);
 
-#endif /* _MUTT_MENU_H_ */
+#endif /* _MUTT_MENU_H */
diff --git a/mutt_notmuch.h b/mutt_notmuch.h
index b7620fbc1..349b1f80c 100644
--- a/mutt_notmuch.h
+++ b/mutt_notmuch.h
@@ -16,7 +16,7 @@
  */
 
 #ifndef _MUTT_NOTMUCH_H
-#define _MUTT_NOTMUCH_H
+#define _MUTT_NOTMUCH_H 1
 
 #include <stdbool.h>
 
diff --git a/mutt_options.h b/mutt_options.h
index 56c54f2f9..fcfc39910 100644
--- a/mutt_options.h
+++ b/mutt_options.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef MUTT_OPTIONS_H
-#define MUTT_OPTIONS_H
+#ifndef _MUTT_OPTIONS_H
+#define _MUTT_OPTIONS_H 1
 
 #include "mutt.h"
 
@@ -58,4 +58,4 @@ int mutt_option_to_string(const struct option_t *opt, char *val, size_t len);
 const struct option_t *mutt_option_get(const char *s);
 int mutt_option_set(const struct option_t *val, BUFFER *err);
 
-#endif
+#endif /* _MUTT_OPTIONS_H */
diff --git a/mutt_regex.h b/mutt_regex.h
index af98baad5..eb6e1f002 100644
--- a/mutt_regex.h
+++ b/mutt_regex.h
@@ -19,8 +19,8 @@
  * A (more) generic interface to regular expression matching
  */
 
-#ifndef MUTT_REGEX_H
-#define MUTT_REGEX_H
+#ifndef _MUTT_REGEX_H
+#define _MUTT_REGEX_H 1
 
 #include <regex.h>
 
@@ -47,4 +47,4 @@ WHERE REGEXP ReplyRegexp;
 WHERE REGEXP Smileys;
 WHERE REGEXP GecosMask;
 
-#endif /* MUTT_REGEX_H */
+#endif /* _MUTT_REGEX_H */
diff --git a/mutt_sasl.h b/mutt_sasl.h
index 2dfaf2764..5393085b7 100644
--- a/mutt_sasl.h
+++ b/mutt_sasl.h
@@ -17,8 +17,8 @@
 
 /* common SASL helper routines */
 
-#ifndef _MUTT_SASL_H_
-#define _MUTT_SASL_H_ 1
+#ifndef _MUTT_SASL_H
+#define _MUTT_SASL_H 1
 
 #include <sasl/sasl.h>
 
@@ -50,4 +50,4 @@ typedef struct
 }
 SASL_DATA;
 
-#endif /* _MUTT_SASL_H_ */
+#endif /* _MUTT_SASL_H */
diff --git a/mutt_sasl_plain.h b/mutt_sasl_plain.h
index 9c6410deb..fd3934d02 100644
--- a/mutt_sasl_plain.h
+++ b/mutt_sasl_plain.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_SASL_PLAIN_H_
-#define _MUTT_SASL_PLAIN_H_
+#ifndef _MUTT_SASL_PLAIN_H
+#define _MUTT_SASL_PLAIN_H 1
 
 #include <stdlib.h> /* for size_t */
 
@@ -42,4 +42,4 @@
 size_t mutt_sasl_plain_msg(char *buf, size_t buflen, const char *cmd,
                            const char *authz, const char *user, const char *pass);
 
-#endif /* _MUTT_SASL_PLAIN_H_ */
+#endif /* _MUTT_SASL_PLAIN_H */
diff --git a/mutt_socket.h b/mutt_socket.h
index b4a436bcc..6f6f5844f 100644
--- a/mutt_socket.h
+++ b/mutt_socket.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_SOCKET_H_
-#define _MUTT_SOCKET_H_ 1
+#ifndef _MUTT_SOCKET_H
+#define _MUTT_SOCKET_H 1
 
 #include "account.h"
 #include "lib.h"
@@ -71,4 +71,4 @@ int raw_socket_open(CONNECTION *conn);
 int raw_socket_close(CONNECTION *conn);
 int raw_socket_poll(CONNECTION *conn);
 
-#endif /* _MUTT_SOCKET_H_ */
+#endif /* _MUTT_SOCKET_H */
diff --git a/mutt_ssl.h b/mutt_ssl.h
index 355065572..4d49280b7 100644
--- a/mutt_ssl.h
+++ b/mutt_ssl.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_SSL_H_
-#define _MUTT_SSL_H_ 1
+#ifndef _MUTT_SSL_H
+#define _MUTT_SSL_H 1
 
 #include "mutt_socket.h"
 
@@ -25,4 +25,4 @@ int mutt_ssl_starttls (CONNECTION* conn);
 int mutt_ssl_socket_setup (CONNECTION *conn);
 #endif
 
-#endif /* _MUTT_SSL_H_ */
+#endif /* _MUTT_SSL_H */
diff --git a/mutt_tunnel.h b/mutt_tunnel.h
index 36e0becd8..360af096b 100644
--- a/mutt_tunnel.h
+++ b/mutt_tunnel.h
@@ -13,11 +13,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _MUTT_TUNNEL_H_
-#define _MUTT_TUNNEL_H_ 1
+#ifndef _MUTT_TUNNEL_H
+#define _MUTT_TUNNEL_H 1
 
 #include "mutt_socket.h"
 
 int mutt_tunnel_socket_setup(CONNECTION *conn);
 
-#endif /* _MUTT_TUNNEL_H_ */
+#endif /* _MUTT_TUNNEL_H */
diff --git a/mx.h b/mx.h
index d66f79156..249720f7f 100644
--- a/mx.h
+++ b/mx.h
@@ -21,8 +21,8 @@
  * generic mailbox api.  None of these functions should be called directly.
  */
 
-#ifndef _MX_H
-#define _MX_H
+#ifndef _MUTT_MX_H
+#define _MUTT_MX_H 1
 
 #include "mailbox.h"
 #include "buffy.h"
@@ -89,4 +89,4 @@ extern struct mx_ops mx_mbox_ops;
 extern struct mx_ops mx_mh_ops;
 extern struct mx_ops mx_mmdf_ops;
 
-#endif
+#endif /* _MUTT_MX_H */
diff --git a/myvar.h b/myvar.h
index e3f07934c..911c85377 100644
--- a/myvar.h
+++ b/myvar.h
@@ -13,8 +13,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef MYVAR_INCLUDED
-#define MYVAR_INCLUDED
+#ifndef _MUTT_MYVAR_H
+#define _MUTT_MYVAR_H 1
 
 #include <sys/types.h>
 
@@ -22,5 +22,4 @@ const char *myvar_get(const char *var);
 int var_to_string(int idx, char *val, size_t len);
 int mutt_option_index(const char *s);
 
-#endif
-
+#endif /* _MUTT_MYVAR_H */
diff --git a/nntp.h b/nntp.h
index a66509722..8b140693f 100644
--- a/nntp.h
+++ b/nntp.h
@@ -17,8 +17,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _NNTP_H_
-#define _NNTP_H_ 1
+#ifndef _MUTT_NNTP_H
+#define _MUTT_NNTP_H 1
 
 #include "mutt_socket.h"
 #include "mailbox.h"
@@ -162,4 +162,4 @@ void nntp_hcache_update(NNTP_DATA *nntp_data, header_cache_t *hc);
 
 extern struct mx_ops mx_nntp_ops;
 
-#endif /* _NNTP_H_ */
+#endif /* _MUTT_NNTP_H */
diff --git a/pager.h b/pager.h
index f12c945b2..8eccf6696 100644
--- a/pager.h
+++ b/pager.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_PAGER_H
+#define _MUTT_PAGER_H 1
+
 #include "attach.h"
 
 /* dynamic internal flags */
@@ -48,3 +51,5 @@ typedef struct
 int mutt_do_pager(const char *banner, const char *tempfile, int do_color, pager_t *info);
 int mutt_pager(const char *banner, const char *fname, int flags, pager_t *extra);
 void update_index(MUTTMENU *menu, CONTEXT *ctx, int check, int oldcount, int index_hint);
+
+#endif /* _MUTT_PAGER_H */
diff --git a/pgp.c b/pgp.c
index 70ebbcc1e..be560c967 100644
--- a/pgp.c
+++ b/pgp.c
@@ -55,8 +55,6 @@
 # include <sys/resource.h>
 #endif
 
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
-
 #include "mutt_crypt.h"
 #include "mutt_menu.h"
 
@@ -1806,5 +1804,3 @@ int pgp_send_menu (HEADER *msg, int *redraw)
   return (msg->security);
 }
 
-
-#endif /* CRYPT_BACKEND_CLASSIC_PGP */
diff --git a/pgp.h b/pgp.h
index 872b33e53..b31bec244 100644
--- a/pgp.h
+++ b/pgp.h
@@ -17,6 +17,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_PGP_H
+#define _MUTT_PGP_H 1
+
 #ifdef CRYPT_BACKEND_CLASSIC_PGP
 
 #include "mutt_crypt.h"
@@ -90,3 +93,5 @@ BODY *pgp_sign_message(BODY *a);
 int pgp_send_menu(HEADER *msg, int *redraw);
 
 #endif /* CRYPT_BACKEND_CLASSIC_PGP */
+
+#endif /* _MUTT_PGP_H */
diff --git a/pgpkey.c b/pgpkey.c
index 595f771ed..1d0d1d250 100644
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -36,8 +36,6 @@
 
 #include <locale.h>
 
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
-
 struct pgp_cache
 {
   char *what;
@@ -1030,4 +1028,3 @@ out:
   return NULL;
 }
 
-#endif /* CRYPT_BACKEND_CLASSIC_PGP */
diff --git a/pgplib.h b/pgplib.h
index 421d8d2bc..dc541389f 100644
--- a/pgplib.h
+++ b/pgplib.h
@@ -16,6 +16,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_PGPLIB_H
+#define _MUTT_PGPLIB_H 1
+
 #ifdef CRYPT_BACKEND_CLASSIC_PGP
 
 #include "mutt_crypt.h"
@@ -84,3 +87,5 @@ static inline pgp_key_t pgp_new_keyinfo(void)
 }
 
 #endif /* CRYPT_BACKEND_CLASSIC_PGP */
+
+#endif /* _MUTT_PGPLIB_H */
diff --git a/pgppacket.h b/pgppacket.h
index 8d8785b9d..ae7713d05 100644
--- a/pgppacket.h
+++ b/pgppacket.h
@@ -20,8 +20,8 @@
  * by mutt proper and the PGP public key ring lister.
  */
 
-#ifndef _PGPPACKET_H
-# define _PGPPACKET_H
+#ifndef _MUTT_PGPPACKET_H
+#define _MUTT_PGPPACKET_H 1
 
 enum packet_tags
 {
@@ -47,4 +47,4 @@ enum packet_tags
 unsigned char *pgp_read_packet(FILE *fp, size_t *len);
 void pgp_release_packet(void);
 
-#endif
+#endif /* _MUTT_PGPPACKET_H */
diff --git a/pop.h b/pop.h
index 265a86a9e..1eef3721a 100644
--- a/pop.h
+++ b/pop.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _POP_H
-#define _POP_H 1
+#ifndef _MUTT_POP_H
+#define _MUTT_POP_H 1
 
 #include "mailbox.h"
 #include "mutt_socket.h"
@@ -108,4 +108,4 @@ void pop_fetch_mail(void);
 
 extern struct mx_ops mx_pop_ops;
 
-#endif
+#endif /* _MUTT_POP_H */
diff --git a/protos.h b/protos.h
index 29672848b..7aebc7028 100644
--- a/protos.h
+++ b/protos.h
@@ -16,6 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_PROTOS_H
+#define _MUTT_PROTOS_H 1
 
 #ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
@@ -495,3 +497,4 @@ int wcscasecmp(const wchar_t *a, const wchar_t *b);
 char *strcasestr(const char *s1, const char *s2);
 #endif
 
+#endif /* _MUTT_PROTOS_H */
diff --git a/remailer.c b/remailer.c
index 61acc8721..c20710a27 100644
--- a/remailer.c
+++ b/remailer.c
@@ -38,8 +38,6 @@
 #include <sys/file.h>
 #include <fcntl.h>
 
-#ifdef MIXMASTER
-
 struct coord
 {
   short r, c;
@@ -753,5 +751,3 @@ int mix_send_message (LIST *chain, const char *tempfile)
   return i;
 }
 
-
-#endif
diff --git a/remailer.h b/remailer.h
index b65de95f5..f148d626f 100644
--- a/remailer.h
+++ b/remailer.h
@@ -1,6 +1,3 @@
-#ifndef _REMAILER_H
-#define _REMAILER_H
-
 /**
  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
  *
@@ -22,6 +19,9 @@
  * Mixmaster support for Mutt
  */
 
+#ifndef _MUTT_REMAILER_H
+#define _MUTT_REMAILER_H 1
+
 #ifdef MIXMASTER
 
 #define MIX_CAP_COMPRESS  (1 << 0)
@@ -59,4 +59,4 @@ void mix_make_chain(LIST **chainp, int *redraw);
 
 #endif /* MIXMASTER */
 
-#endif /* _REMAILER_H */
+#endif /* _MUTT_REMAILER_H */
diff --git a/rfc1524.h b/rfc1524.h
index fe9951062..c8c6fad34 100644
--- a/rfc1524.h
+++ b/rfc1524.h
@@ -15,8 +15,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _RFC1524_H
-#define _RFC1524_H
+#ifndef _MUTT_RFC1524_H
+#define _MUTT_RFC1524_H 1
 
 typedef struct rfc1524_mailcap_entry {
   char *command;
@@ -38,4 +38,4 @@ int rfc1524_expand_filename(char *nametemplate, char *oldfile, char *newfile, si
 int rfc1524_mailcap_lookup(BODY *a, char *type, rfc1524_entry *entry, int opt);
 int mutt_rename_file(char *oldfile, char *newfile);
 
-#endif /* _RFC1524_H */
+#endif /* _MUTT_RFC1524_H */
diff --git a/rfc2047.h b/rfc2047.h
index 4da6b8d0e..3806672db 100644
--- a/rfc2047.h
+++ b/rfc2047.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_RFC2047_H
+#define _MUTT_RFC2047_H 1
+
 char *mutt_choose_charset(const char *fromcode, const char *charsets, char *u,
                           size_t ulen, char **d, size_t *dlen);
 int convert_nonmime_string(char **ps);
@@ -26,3 +29,5 @@ void rfc2047_encode_adrlist(ADDRESS *addr, const char *tag);
 
 void rfc2047_decode(char **pd);
 void rfc2047_decode_adrlist(ADDRESS *a);
+
+#endif /* _MUTT_RFC2047_H */
diff --git a/rfc2231.h b/rfc2231.h
index 37bee797c..f27840968 100644
--- a/rfc2231.h
+++ b/rfc2231.h
@@ -15,6 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_RFC2231_H
+#define _MUTT_RFC2231_H 1
+
 void rfc2231_decode_parameters(PARAMETER **headp);
 int rfc2231_encode_string(char **pd);
 
+
+#endif /* _MUTT_RFC2231_H */
diff --git a/rfc3676.h b/rfc3676.h
index e7bd28313..ca323dc01 100644
--- a/rfc3676.h
+++ b/rfc3676.h
@@ -20,7 +20,7 @@
 /* This file was originally part of mutt-ng */
 
 #ifndef _MUTT_RFC3676_H
-#define _MUTT_RFC3676_H
+#define _MUTT_RFC3676_H 1
 
 #include "mutt.h"
 
@@ -30,4 +30,4 @@ int rfc3676_handler(BODY *a, STATE *s);
 /* this does the space-stuffing for RfC3676 style messages */
 void rfc3676_space_stuff(HEADER *hdr);
 
-#endif /* !_MUTT_RFC3676_H */
+#endif /* _MUTT_RFC3676_H */
diff --git a/rfc822.h b/rfc822.h
index 05a8f6435..344344f9c 100644
--- a/rfc822.h
+++ b/rfc822.h
@@ -16,8 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef rfc822_h
-#define rfc822_h
+#ifndef _MUTT_RFC822_H
+#define _MUTT_RFC822_H 1
 
 #include "lib.h"
 
@@ -70,4 +70,4 @@ static inline ADDRESS *rfc822_new_address (void)
   return safe_calloc (1, sizeof (ADDRESS));
 }
 
-#endif /* rfc822_h */
+#endif /* _MUTT_RFC822_H */
diff --git a/sha1.h b/sha1.h
index a33988f9d..b86675426 100644
--- a/sha1.h
+++ b/sha1.h
@@ -5,8 +5,8 @@
  * fit into mutt by Thomas Roessler <roessler@does-not-exist.org>.
  */
 
-#ifndef _SHA1_H
-# define _SHA1_H
+#ifndef _MUTT_SHA1_H
+#define _MUTT_SHA1_H 1
 
 #include "crypthash.h"
 
@@ -28,4 +28,4 @@ void sha1_final(unsigned char digest[20], SHA1_CTX *context);
 
 # define SHA_DIGEST_LENGTH 20
 
-#endif
+#endif /* _MUTT_SHA1_H */
diff --git a/sidebar.h b/sidebar.h
index fca5a651a..8df84a7f8 100644
--- a/sidebar.h
+++ b/sidebar.h
@@ -17,8 +17,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef SIDEBAR_H
-#define SIDEBAR_H
+#ifndef _MUTT_SIDEBAR_H
+#define _MUTT_SIDEBAR_H 1
 
 #include "mutt.h"
 #include "buffy.h"
@@ -31,4 +31,4 @@ void         mutt_sb_set_buffystats (const CONTEXT *ctx);
 void         mutt_sb_set_open_buffy (void);
 void         mutt_sb_toggle_virtual (void);
 
-#endif /* SIDEBAR_H */
+#endif /* _MUTT_SIDEBAR_H */
diff --git a/smime.c b/smime.c
index ed6b4aa01..f80a4c36a 100644
--- a/smime.c
+++ b/smime.c
@@ -47,8 +47,6 @@
 # include <sys/resource.h>
 #endif
 
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
-
 #include "mutt_crypt.h"
 
 struct smime_command_context {
@@ -2278,5 +2276,3 @@ int smime_send_menu (HEADER *msg, int *redraw)
   return (msg->security);
 }
 
-
-#endif /* CRYPT_BACKEND_CLASSIC_SMIME */
diff --git a/smime.h b/smime.h
index 10a6b9dbe..f8e618d46 100644
--- a/smime.h
+++ b/smime.h
@@ -16,6 +16,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_SMIME_H
+#define _MUTT_SMIME_H 1
 
 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
 
@@ -59,4 +61,4 @@ int smime_send_menu(HEADER *msg, int *redraw);
 
 #endif
 
-
+#endif /* _MUTT_SMIME_H */
diff --git a/sort.h b/sort.h
index 190db29e0..a87febee3 100644
--- a/sort.h
+++ b/sort.h
@@ -15,6 +15,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _MUTT_SORT_H
+#define _MUTT_SORT_H 1
+
 #define SORT_DATE	1   /* the date the mail was sent. */
 #define SORT_SIZE	2
 #define SORT_SUBJECT	3
@@ -73,3 +76,5 @@ WHERE short PgpSortKeys INITVAL (SORT_ADDRESS);
 
 #include "mapping.h"
 extern const struct mapping_t SortMethods[];
+
+#endif /* _MUTT_SORT_H */
diff --git a/url.h b/url.h
index fc15b4223..50000c232 100644
--- a/url.h
+++ b/url.h
@@ -13,8 +13,8 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _URL_H
-# define _URL_H
+#ifndef _MUTT_URL_H
+#define _MUTT_URL_H 1
 
 #include "mutt.h"
 
@@ -57,4 +57,4 @@ int url_ciss_tostring(ciss_url_t *ciss, char *dest, size_t len, int flags);
 int url_parse_mailto(ENVELOPE *e, char **body, const char *src);
 int url_pct_decode(char *s);
 
-#endif
+#endif /* _MUTT_URL_H */
diff --git a/utf8.c b/utf8.c
index f39655fe3..4c3c4ec74 100644
--- a/utf8.c
+++ b/utf8.c
@@ -15,8 +15,6 @@
 
 #include "config.h"
 
-#ifndef HAVE_WC_FUNCS
-
 #include <sys/types.h>
 #include <errno.h>
 
@@ -91,4 +89,3 @@ int mutt_wctoutf8 (char *s, unsigned int c, size_t buflen)
   return -1;
 }
 
-#endif /* !HAVE_WC_FUNCS */
diff --git a/version.c b/version.c
index 10f22d750..a88bb78ea 100644
--- a/version.c
+++ b/version.c
@@ -29,7 +29,7 @@
 #include <idn/stringprep.h>
 #endif
 #ifdef USE_SLANG_CURSES
-#include "slang.h"
+#include <slang.h>
 #endif
 
 #include "lib.h"
diff --git a/version.h b/version.h
index 040ca0fb2..1bc57cf24 100644
--- a/version.h
+++ b/version.h
@@ -15,11 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _VERSION_H_
-#define _VERSION_H_
+#ifndef _MUTT_VERSION_H
+#define _MUTT_VERSION_H 1
 
 void print_version (void);
 void print_copyright (void);
 int feature_enabled (const char *name);
 
-#endif /* _VERSION_H_ */
+#endif /* _MUTT_VERSION_H */
diff --git a/wcwidth.c b/wcwidth.c
index c23bd42be..818549fd1 100644
--- a/wcwidth.c
+++ b/wcwidth.c
@@ -22,8 +22,6 @@
 
 #include "config.h"
 
-#ifndef HAVE_WC_FUNCS
-
 #include "mutt.h"
 #include "mbyte.h"
 
@@ -165,5 +163,3 @@ int wcwidth_ucs(wchar_t ucs)
       (ucs >= 0x30000 && ucs <= 0x3fffd)));
 }
 
-#endif /* !HAVE_WC_FUNCS */
-
-- 
2.40.0