]> granicus.if.org Git - neomutt/commitdiff
iwyu: tidy #includes
authorRichard Russon <rich@flatcap.org>
Tue, 16 Jul 2019 21:04:02 +0000 (22:04 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 16 Jul 2019 21:17:50 +0000 (22:17 +0100)
14 files changed:
config/address.c
config/dump.c
config/enum.c
config/regex.c
config/set.c
config/slist.c
config/subset.c
config/subset.h
conn/conn_raw.c
conn/ssl.h
core/account.c
core/mailbox.c
core/mailbox.h
email/tags.c

index 48416cbd44b01ecb59e86c875b6cef9bab57bb88..99a117dfeb384d2974f9f83cf9beb5e526cfe750 100644 (file)
@@ -34,7 +34,6 @@
 #include <stdint.h>
 #include "mutt/mutt.h"
 #include "address/lib.h"
-#include "email/lib.h"
 #include "address.h"
 #include "set.h"
 #include "types.h"
index a128682e9db5a0e14bd0faf6b593e9636c782941..7484a7cd60d8e24a5b5cc9f34cdce8d94c78f130 100644 (file)
@@ -30,7 +30,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include "mutt/mutt.h"
 #include "dump.h"
 #include "set.h"
index bd9a22d227f2e409290b6e8e876551b65f6190ea..dc7489fccbdaac4fc138927c594a0107ab8507d3 100644 (file)
 #include <stddef.h>
 #include <limits.h>
 #include <stdint.h>
-#include "mutt/buffer.h"
-#include "mutt/hash.h"
-#include "mutt/logging.h"
-#include "mutt/mapping.h"
-#include "mutt/memory.h"
-#include "mutt/string2.h"
+#include "mutt/mutt.h"
 #include "enum.h"
 #include "set.h"
 #include "types.h"
index 9b8ef045c9c539e603a7af6871be841bf98fc796..3751707c7b731f26eef56aa04ce172d89218517f 100644 (file)
 #include <stdbool.h>
 #include <stdint.h>
 #include "mutt/mutt.h"
-#include "regex2.h"
 #include "set.h"
 #include "types.h"
 
+/**
+ * regex_free - Free a Regex object
+ * @param[out] r Regex to free
+ */
+void regex_free(struct Regex **r)
+{
+  if (!r || !*r)
+    return;
+
+  FREE(&(*r)->pattern);
+  if ((*r)->regex)
+    regfree((*r)->regex);
+  FREE(&(*r)->regex);
+  FREE(r);
+}
+
 /**
  * regex_destroy - Destroy a Regex object - Implements ::cst_destroy()
  */
@@ -52,6 +67,50 @@ static void regex_destroy(const struct ConfigSet *cs, void *var, const struct Co
   regex_free(r);
 }
 
+/**
+ * regex_new - Create an Regex from a string
+ * @param str   Regular expression
+ * @param flags Type flags, e.g. #DT_REGEX_MATCH_CASE
+ * @param err   Buffer for error messages
+ * @retval ptr New Regex object
+ * @retval NULL Error
+ */
+struct Regex *regex_new(const char *str, int flags, struct Buffer *err)
+{
+  if (!str)
+    return NULL;
+
+  int rflags = 0;
+  struct Regex *reg = mutt_mem_calloc(1, sizeof(struct Regex));
+
+  reg->regex = mutt_mem_calloc(1, sizeof(regex_t));
+  reg->pattern = mutt_str_strdup(str);
+
+  /* Should we use smart case matching? */
+  if (((flags & DT_REGEX_MATCH_CASE) == 0) && mutt_mb_is_lower(str))
+    rflags |= REG_ICASE;
+
+  if ((flags & DT_REGEX_NOSUB))
+    rflags |= REG_NOSUB;
+
+  /* Is a prefix of '!' allowed? */
+  if (((flags & DT_REGEX_ALLOW_NOT) != 0) && (str[0] == '!'))
+  {
+    reg->pat_not = true;
+    str++;
+  }
+
+  int rc = REG_COMP(reg->regex, str, rflags);
+  if ((rc != 0) && err)
+  {
+    regerror(rc, reg->regex, err->data, err->dsize);
+    regex_free(&reg);
+    return NULL;
+  }
+
+  return reg;
+}
+
 /**
  * regex_string_set - Set a Regex by string - Implements ::cst_string_set()
  */
@@ -260,63 +319,3 @@ void regex_init(struct ConfigSet *cs)
   };
   cs_register_type(cs, DT_REGEX, &cst_regex);
 }
-
-/**
- * regex_new - Create an Regex from a string
- * @param str   Regular expression
- * @param flags Type flags, e.g. #DT_REGEX_MATCH_CASE
- * @param err   Buffer for error messages
- * @retval ptr New Regex object
- * @retval NULL Error
- */
-struct Regex *regex_new(const char *str, int flags, struct Buffer *err)
-{
-  if (!str)
-    return NULL;
-
-  int rflags = 0;
-  struct Regex *reg = mutt_mem_calloc(1, sizeof(struct Regex));
-
-  reg->regex = mutt_mem_calloc(1, sizeof(regex_t));
-  reg->pattern = mutt_str_strdup(str);
-
-  /* Should we use smart case matching? */
-  if (((flags & DT_REGEX_MATCH_CASE) == 0) && mutt_mb_is_lower(str))
-    rflags |= REG_ICASE;
-
-  if ((flags & DT_REGEX_NOSUB))
-    rflags |= REG_NOSUB;
-
-  /* Is a prefix of '!' allowed? */
-  if (((flags & DT_REGEX_ALLOW_NOT) != 0) && (str[0] == '!'))
-  {
-    reg->pat_not = true;
-    str++;
-  }
-
-  int rc = REG_COMP(reg->regex, str, rflags);
-  if ((rc != 0) && err)
-  {
-    regerror(rc, reg->regex, err->data, err->dsize);
-    regex_free(&reg);
-    return NULL;
-  }
-
-  return reg;
-}
-
-/**
- * regex_free - Free a Regex object
- * @param[out] r Regex to free
- */
-void regex_free(struct Regex **r)
-{
-  if (!r || !*r)
-    return;
-
-  FREE(&(*r)->pattern);
-  if ((*r)->regex)
-    regfree((*r)->regex);
-  FREE(&(*r)->regex);
-  FREE(r);
-}
index 24d236cce3c2277b585e0f73ef7b34a720b68d49..bf02d7076d01b560991e6e7bd595cbecc322b32e 100644 (file)
@@ -29,7 +29,6 @@
 #include "config.h"
 #include <limits.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include "mutt/mutt.h"
 #include "set.h"
index 57ed006ea9cb2f44cf3b0a0ec59b8079bb25109c..bbaed753db4d1d569034aac3bf4e45c154e5888d 100644 (file)
@@ -30,7 +30,6 @@
 #include <stddef.h>
 #include <limits.h>
 #include <stdint.h>
-#include <string.h>
 #include "mutt/mutt.h"
 #include "set.h"
 #include "types.h"
index 072e54c6c9605810afe6e5f248b23bf533197206..716e51cd89bf788857c17c213bbc6c4fafb78e9d 100644 (file)
  */
 
 #include "config.h"
-#include <stddef.h>
 #include <limits.h>
 #include <stdint.h>
+#include <stdio.h>
 #include "mutt/mutt.h"
-#include "config/lib.h"
 #include "subset.h"
+#include "dump.h"
 #include "set.h"
-#include "types.h"
 
 /**
  * cs_subset_free - Free a Config Subset
index 5a03adc4ccfd4638ebc35601bdbc12d8a4717d4c..b7f728ee81efa12fb64f1de0b895d05cba8f0928 100644 (file)
 #ifndef MUTT_CONFIG_SUBSET_H
 #define MUTT_CONFIG_SUBSET_H
 
-#include <stdio.h>
-#include "set.h"
+#include <stdint.h>
+
+struct Buffer;
+struct HashElem;
 
 /**
  * struct ConfigSubset - A set of inherited config items
index 9f3ebf228fa2c235d9f758e39e354eb169efd40c..05301e46f194d1ad023c44667446e77a1a8f7813 100644 (file)
@@ -45,7 +45,6 @@
 #include <unistd.h>
 #include "mutt/mutt.h"
 #include "address/lib.h"
-#include "email/lib.h"
 #include "conn/connaccount.h"
 #include "conn_globals.h"
 #include "connection.h"
index 43341cf8aab490fcb15548ca20e7fe17e614887a..4a43c5369bf3c113e1aeaac71fcb048df26448f2 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef MUTT_CONN_SSL_H
 #define MUTT_CONN_SSL_H
 
+#include "config.h"
+
 struct Connection;
 
 #ifdef USE_SSL
index e1dc7e7de9314be6148c7cfda01a4e01d2f9e46d..5e34556ecaa3c0775ebe67d7d31c7f219f8e0a11 100644 (file)
@@ -32,7 +32,6 @@
 #include "config/lib.h"
 #include "account.h"
 #include "mailbox.h"
-#include "neomutt.h"
 
 /**
  * account_new - Create a new Account
index 07edf6fd0859c77f2ca24c0f2ffd5808ffd04348..297b3880f2ad51ab93c282addc581c19a52cf5fe 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "config.h"
 #include <sys/stat.h>
-#include "config/lib.h"
 #include "email/lib.h"
 #include "mailbox.h"
 #include "neomutt.h"
index 54675c768454d6acd484e6339ad6e34b2dca7172..bb1e75cf9d16e24dabf51ab8ef41b3e862e05848 100644 (file)
@@ -31,7 +31,6 @@
 #include <time.h>
 #include "mutt/mutt.h"
 
-struct ConfigSubset;
 struct Email;
 
 #define MB_NORMAL 0
index a7ed1aad960faaa41f1acd92eadbbd321d1203ca..b6c5989ea922712d95d12245153b5cac1ccbcd20 100644 (file)
@@ -29,9 +29,7 @@
 #include "config.h"
 #include <stddef.h>
 #include <stdbool.h>
-#include <string.h>
 #include "mutt/mutt.h"
-#include "config/lib.h"
 #include "tags.h"
 
 /* These Config Variables are only used in email/tags.c */