int *ColorQuote = NULL;
int ColorQuoteUsed;
int ColorDefs[MT_COLOR_MAX];
-struct ColorLineHead ColorAttachList = STAILQ_HEAD_INITIALIZER(ColorAttachList);
-struct ColorLineHead ColorBodyList = STAILQ_HEAD_INITIALIZER(ColorBodyList);
-struct ColorLineHead ColorHdrList = STAILQ_HEAD_INITIALIZER(ColorHdrList);
-struct ColorLineHead ColorIndexAuthorList = STAILQ_HEAD_INITIALIZER(ColorIndexAuthorList);
-struct ColorLineHead ColorIndexFlagsList = STAILQ_HEAD_INITIALIZER(ColorIndexFlagsList);
-struct ColorLineHead ColorIndexList = STAILQ_HEAD_INITIALIZER(ColorIndexList);
-struct ColorLineHead ColorIndexSubjectList = STAILQ_HEAD_INITIALIZER(ColorIndexSubjectList);
-struct ColorLineHead ColorIndexTagList = STAILQ_HEAD_INITIALIZER(ColorIndexTagList);
-struct ColorLineHead ColorStatusList = STAILQ_HEAD_INITIALIZER(ColorStatusList);
+struct ColorLineList ColorAttachList = STAILQ_HEAD_INITIALIZER(ColorAttachList);
+struct ColorLineList ColorBodyList = STAILQ_HEAD_INITIALIZER(ColorBodyList);
+struct ColorLineList ColorHdrList = STAILQ_HEAD_INITIALIZER(ColorHdrList);
+struct ColorLineList ColorIndexAuthorList = STAILQ_HEAD_INITIALIZER(ColorIndexAuthorList);
+struct ColorLineList ColorIndexFlagsList = STAILQ_HEAD_INITIALIZER(ColorIndexFlagsList);
+struct ColorLineList ColorIndexList = STAILQ_HEAD_INITIALIZER(ColorIndexList);
+struct ColorLineList ColorIndexSubjectList = STAILQ_HEAD_INITIALIZER(ColorIndexSubjectList);
+struct ColorLineList ColorIndexTagList = STAILQ_HEAD_INITIALIZER(ColorIndexTagList);
+struct ColorLineList ColorStatusList = STAILQ_HEAD_INITIALIZER(ColorStatusList);
/* local to this file */
static int ColorQuoteSize;
* @param[in] parse_uncolor If true, 'uncolor', else 'unmono'
*/
static void do_uncolor(struct Buffer *buf, struct Buffer *s,
- struct ColorLineHead *cl, bool *do_cache, bool parse_uncolor)
+ struct ColorLineList *cl, bool *do_cache, bool parse_uncolor)
{
struct ColorLine *np = NULL, *tmp = NULL;
do
* @param match Number of regex subexpression to match (0 for entire pattern)
* @retval #CommandResult Result e.g. #MUTT_CMD_SUCCESS
*/
-static enum CommandResult add_pattern(struct ColorLineHead *top, const char *s,
+static enum CommandResult add_pattern(struct ColorLineList *top, const char *s,
bool sensitive, uint32_t fg, uint32_t bg, int attr,
struct Buffer *err, bool is_index, int match)
{
/**
* mutt_free_color_list - Free a list of colours
- * @param head ColorLine List
+ * @param list ColorLine List
*/
-static void mutt_free_color_list(struct ColorLineHead *head)
+static void mutt_free_color_list(struct ColorLineList *list)
{
struct ColorLine *np = NULL, *tmp = NULL;
- STAILQ_FOREACH_SAFE(np, head, entries, tmp)
+ STAILQ_FOREACH_SAFE(np, list, entries, tmp)
{
- STAILQ_REMOVE(head, np, ColorLine, entries);
+ STAILQ_REMOVE(list, np, ColorLine, entries);
free_color_line(np, true);
}
}
{
off_t vsize;
char *pattern; ///< Limit pattern string
- struct PatternHead *limit_pattern; ///< Compiled limit pattern
+ struct PatternList *limit_pattern; ///< Compiled limit pattern
struct Email *last_tag; ///< Last tagged msg (used to link threads)
struct MuttThread *tree; ///< Top of thread tree
struct Hash *thread_hash; ///< Hash table for threading
int refno; ///< Message number on server
#endif
- struct TagHead tags; ///< For drivers that support server tagging
+ struct TagList tags; ///< For drivers that support server tagging
char *maildir_flags; ///< Unknown maildir flags
*
* Return a new allocated string containing tags separated by space
*/
-static char *driver_tags_getter(struct TagHead *head, bool show_hidden,
+static char *driver_tags_getter(struct TagList *head, bool show_hidden,
bool show_transformed, const char *filter)
{
if (!head)
return NULL;
char *tags = NULL;
- struct TagNode *np = NULL;
+ struct Tag *np = NULL;
STAILQ_FOREACH(np, head, entries)
{
if (filter && (mutt_str_strcmp(np->name, filter) != 0))
/**
* driver_tags_add - Add a tag to header
- * @param[in] head List of tags
+ * @param[in] list List of tags
* @param[in] new_tag string representing the new tag
*
* Add a tag to the header tags
*/
-static void driver_tags_add(struct TagHead *head, char *new_tag)
+static void driver_tags_add(struct TagList *list, char *new_tag)
{
char *new_tag_transformed = mutt_hash_find(TagTransforms, new_tag);
- struct TagNode *tn = mutt_mem_calloc(1, sizeof(struct TagNode));
+ struct Tag *tn = mutt_mem_calloc(1, sizeof(struct Tag));
tn->name = mutt_str_strdup(new_tag);
tn->hidden = false;
if (new_tag_transformed)
if (mutt_list_find(&C_HiddenTags->head, new_tag))
tn->hidden = true;
- STAILQ_INSERT_TAIL(head, tn, entries);
+ STAILQ_INSERT_TAIL(list, tn, entries);
}
/**
* driver_tags_free - Free tags from a header
- * @param[in] head List of tags
+ * @param[in] list List of tags
*
* Free the whole tags structure
*/
-void driver_tags_free(struct TagHead *head)
+void driver_tags_free(struct TagList *list)
{
- if (!head)
+ if (!list)
return;
- struct TagNode *np = STAILQ_FIRST(head);
- struct TagNode *next = NULL;
+ struct Tag *np = STAILQ_FIRST(list);
+ struct Tag *next = NULL;
while (np)
{
next = STAILQ_NEXT(np, entries);
FREE(&np);
np = next;
}
- STAILQ_INIT(head);
+ STAILQ_INIT(list);
}
/**
* driver_tags_get_transformed - Get transformed tags
- * @param[in] head List of tags
+ * @param[in] list List of tags
* @retval ptr String list of tags
*
* Return a new allocated string containing all tags separated by space with
* transformation
*/
-char *driver_tags_get_transformed(struct TagHead *head)
+char *driver_tags_get_transformed(struct TagList *list)
{
- return driver_tags_getter(head, false, true, NULL);
+ return driver_tags_getter(list, false, true, NULL);
}
/**
* driver_tags_get - Get tags
- * @param[in] head List of tags
+ * @param[in] list List of tags
* @retval ptr String list of tags
*
* Return a new allocated string containing all tags separated by space
*/
-char *driver_tags_get(struct TagHead *head)
+char *driver_tags_get(struct TagList *list)
{
- return driver_tags_getter(head, false, false, NULL);
+ return driver_tags_getter(list, false, false, NULL);
}
/**
* driver_tags_get_with_hidden - Get tags with hiddens
- * @param[in] head List of tags
+ * @param[in] list List of tags
* @retval ptr String list of tags
*
* Return a new allocated string containing all tags separated by space even
* the hiddens.
*/
-char *driver_tags_get_with_hidden(struct TagHead *head)
+char *driver_tags_get_with_hidden(struct TagList *list)
{
- return driver_tags_getter(head, true, false, NULL);
+ return driver_tags_getter(list, true, false, NULL);
}
/**
* Return a new allocated string containing all tags separated by space even
* the hiddens.
*/
-char *driver_tags_get_transformed_for(struct TagHead *head, const char *name)
+char *driver_tags_get_transformed_for(struct TagList *head, const char *name)
{
return driver_tags_getter(head, true, true, name);
}
*
* Free current tags structures and replace it by new tags
*/
-bool driver_tags_replace(struct TagHead *head, char *tags)
+bool driver_tags_replace(struct TagList *head, char *tags)
{
if (!head)
return false;
extern struct Hash *TagTransforms;
/**
- * struct TagNode - LinkedList Tag Element
+ * struct Tag - LinkedList Tag Element
*
* Keep a linked list of header tags and their transformed values.
* Textual tags can be transformed to symbols to save space.
*/
-struct TagNode
+struct Tag
{
char *name; ///< Tag name
char *transformed; ///< Transformed name
bool hidden; ///< Tag should be hidden
- STAILQ_ENTRY(TagNode) entries; ///< Linked list
+ STAILQ_ENTRY(Tag) entries; ///< Linked list
};
-STAILQ_HEAD(TagHead, TagNode);
+STAILQ_HEAD(TagList, Tag);
-void driver_tags_free (struct TagHead *head);
-char *driver_tags_get (struct TagHead *head);
-char *driver_tags_get_transformed (struct TagHead *head);
-char *driver_tags_get_transformed_for(struct TagHead *head, const char *name);
-char *driver_tags_get_with_hidden (struct TagHead *head);
-bool driver_tags_replace (struct TagHead *head, char *tags);
+void driver_tags_free (struct TagList *list);
+char *driver_tags_get (struct TagList *list);
+char *driver_tags_get_transformed (struct TagList *list);
+char *driver_tags_get_transformed_for(struct TagList *list, const char *name);
+char *driver_tags_get_with_hidden (struct TagList *list);
+bool driver_tags_replace (struct TagList *list, char *tags);
#endif /* MUTT_EMAIL_TAGS_H */
/**
* parse_query_string - Parse a URL query string
- * @param l List to store the results
- * @param src String to parse
+ * @param list List to store the results
+ * @param src String to parse
* @retval 0 Success
* @retval -1 Error
*/
-static int parse_query_string(struct UrlQueryStringHead *l, char *src)
+static int parse_query_string(struct UrlQueryList *list, char *src)
{
- struct UrlQueryString *qs = NULL;
+ struct UrlQuery *qs = NULL;
char *k = NULL, *v = NULL;
while (src && *src)
{
- qs = mutt_mem_calloc(1, sizeof(struct UrlQueryString));
+ qs = mutt_mem_calloc(1, sizeof(struct UrlQuery));
k = strchr(src, '&');
if (k)
*k = '\0';
FREE(&qs);
return -1;
}
- STAILQ_INSERT_TAIL(l, qs, entries);
+ STAILQ_INSERT_TAIL(list, qs, entries);
if (!k)
break;
if (!u || !*u)
return;
- struct UrlQueryString *np = STAILQ_FIRST(&(*u)->query_strings);
- struct UrlQueryString *next = NULL;
+ struct UrlQuery *np = STAILQ_FIRST(&(*u)->query_strings);
+ struct UrlQuery *next = NULL;
while (np)
{
next = STAILQ_NEXT(np, entries);
#define U_PATH (1 << 1)
/**
- * struct UrlQueryString - Parsed Query String
+ * struct UrlQuery - Parsed Query String
*
* The arguments in a URL are saved in a linked list.
*/
-struct UrlQueryString
+struct UrlQuery
{
- char *name; ///< Query name
- char *value; ///< Query value
- STAILQ_ENTRY(UrlQueryString) entries; ///< Linked list
+ char *name; ///< Query name
+ char *value; ///< Query value
+ STAILQ_ENTRY(UrlQuery) entries; ///< Linked list
};
-STAILQ_HEAD(UrlQueryStringHead, UrlQueryString);
+STAILQ_HEAD(UrlQueryList, UrlQuery);
/**
* struct Url - A parsed URL `proto://user:password@host:port/path?a=1&b=2`
*/
struct Url
{
- enum UrlScheme scheme; ///< Scheme, e.g. #U_SMTPS
- char *user; ///< Username
- char *pass; ///< Password
- char *host; ///< Host
- unsigned short port; ///< Port
- char *path; ///< Path
- struct UrlQueryStringHead query_strings; ///< List of query strings
- char *src; ///< Raw URL string
+ enum UrlScheme scheme; ///< Scheme, e.g. #U_SMTPS
+ char *user; ///< Username
+ char *pass; ///< Password
+ char *host; ///< Host
+ unsigned short port; ///< Port
+ char *path; ///< Path
+ struct UrlQueryList query_strings; ///< List of query strings
+ char *src; ///< Raw URL string
};
enum UrlScheme url_check_scheme(const char *s);
mutt_md5_process_bytes(&hcachever, sizeof(hcachever), &md5ctx);
/* Mix in user's spam list */
- struct ReplaceListNode *sp = NULL;
+ struct Replace *sp = NULL;
STAILQ_FOREACH(sp, &SpamList, entries)
{
mutt_md5_process(sp->regex->pattern, &md5ctx);
}
/* Mix in user's nospam list */
- struct RegexListNode *np = NULL;
+ struct RegexNode *np = NULL;
STAILQ_FOREACH(np, &NoSpamList, entries)
{
mutt_md5_process(np->regex->pattern, &md5ctx);
HookFlags type; ///< Hook type
struct Regex regex; ///< Regular expression
char *command; ///< Filename, command or pattern to execute
- struct PatternHead *pattern; ///< Used for fcc,save,send-hook
+ struct PatternList *pattern; ///< Used for fcc,save,send-hook
TAILQ_ENTRY(Hook) entries;
};
TAILQ_HEAD(HookList, Hook);
int rc;
bool pat_not = false, warning = false;
regex_t *rx = NULL;
- struct PatternHead *pat = NULL;
+ struct PatternList *pat = NULL;
char path[PATH_MAX];
mutt_buffer_init(&pattern);
* matching. This of course is slower, but index-format-hook is commonly
* used for date ranges, and they need to be evaluated relative to "now", not
* the hook compilation time. */
- struct PatternHead *pat = mutt_pattern_comp(
+ struct PatternList *pat = mutt_pattern_comp(
mutt_b2s(pattern), MUTT_PC_FULL_MSG | MUTT_PC_PATTERN_DYNAMIC, err);
if (!pat)
goto out;
*
* Count the number of patterns that can be done by the server (are full-text).
*/
-static int do_search(const struct PatternHead *search, bool allpats)
+static int do_search(const struct PatternList *search, bool allpats)
{
int rc = 0;
const struct Pattern *pat = NULL;
* that require full-text search (neomutt already has what it needs for most
* match types, and does a better job (eg server doesn't support regexes).
*/
-static int compile_search(struct Mailbox *m, const struct PatternHead *pat, struct Buffer *buf)
+static int compile_search(struct Mailbox *m, const struct PatternList *pat, struct Buffer *buf)
{
struct Pattern *firstpat = SLIST_FIRST(pat);
* @retval 0 Success
* @retval -1 Failure
*/
-int imap_search(struct Mailbox *m, const struct PatternHead *pat)
+int imap_search(struct Mailbox *m, const struct PatternList *pat)
{
struct Buffer buf;
struct ImapAccountData *adata = imap_adata_get(m);
struct Buffer;
struct ConnAccount;
struct EmailList;
-struct PatternHead;
+struct PatternList;
struct stat;
/* These Config Variables are only used in imap/auth.c */
int imap_sync_mailbox(struct Mailbox *m, bool expunge, bool close);
int imap_path_status(const char *path, bool queue);
int imap_mailbox_status(struct Mailbox *m, bool queue);
-int imap_search(struct Mailbox *m, const struct PatternHead *pat);
+int imap_search(struct Mailbox *m, const struct PatternList *pat);
int imap_subscribe(char *path, bool subscribe);
int imap_complete(char *buf, size_t buflen, char *path);
int imap_fast_trash(struct Mailbox *m, char *dest);
*/
static int get_color(int index, unsigned char *s)
{
- struct ColorLineHead *color = NULL;
+ struct ColorLineList *color = NULL;
struct ColorLine *np = NULL;
struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[index]];
int type = *s;
char *replacement; /**< Alternative charset to use */
TAILQ_ENTRY(Lookup) entries;
};
-static TAILQ_HEAD(, Lookup) Lookups = TAILQ_HEAD_INITIALIZER(Lookups);
+TAILQ_HEAD(LookupList, Lookup);
+
+static struct LookupList Lookups = TAILQ_HEAD_INITIALIZER(Lookups);
// clang-format off
/**
/**
* LogQueue - In-memory list of log lines
*/
-static struct LogList LogQueue = STAILQ_HEAD_INITIALIZER(LogQueue);
+static struct LogLineList LogQueue = STAILQ_HEAD_INITIALIZER(LogQueue);
int LogQueueCount = 0; /**< Number of entries currently in the log queue */
int LogQueueMax = 0; /**< Maximum number of entries in the log queue */
char *message;
STAILQ_ENTRY(LogLine) entries;
};
-STAILQ_HEAD(LogList, LogLine);
+STAILQ_HEAD(LogLineList, LogLine);
#define mutt_debug(LEVEL, ...) MuttLogger(0, __FILE__, __LINE__, __func__, LEVEL, __VA_ARGS__)
#define mutt_warning(...) MuttLogger(0, __FILE__, __LINE__, __func__, LL_WARNING, __VA_ARGS__)
void *obj;
enum NotifyType obj_type;
struct Notify *parent;
- struct ObserverHead observers;
+ struct ObserverList observers;
};
/**
struct Observer *observer;
STAILQ_ENTRY(ObserverNode) entries;
};
-STAILQ_HEAD(ObserverHead, ObserverNode);
+STAILQ_HEAD(ObserverList, ObserverNode);
#endif /* MUTT_LIB_OBSERVER_H */
}
/* check to make sure the item is not already on this rl */
- struct RegexListNode *np = NULL;
+ struct RegexNode *np = NULL;
STAILQ_FOREACH(np, rl, entries)
{
if (mutt_str_strcasecmp(rx->pattern, np->regex->pattern) == 0)
if (!rl)
return;
- struct RegexListNode *np = NULL, *tmp = NULL;
+ struct RegexNode *np = NULL, *tmp = NULL;
STAILQ_FOREACH_SAFE(np, rl, entries, tmp)
{
- STAILQ_REMOVE(rl, np, RegexListNode, entries);
+ STAILQ_REMOVE(rl, np, RegexNode, entries);
mutt_regex_free(&np->regex);
FREE(&np);
}
{
if (!rl || !str)
return false;
- struct RegexListNode *np = NULL;
+ struct RegexNode *np = NULL;
STAILQ_FOREACH(np, rl, entries)
{
if (mutt_regex_match(np->regex, str))
* mutt_regexlist_new - Create a new RegexList
* @retval ptr New RegexList object
*/
-struct RegexListNode *mutt_regexlist_new(void)
+struct RegexNode *mutt_regexlist_new(void)
{
- return mutt_mem_calloc(1, sizeof(struct RegexListNode));
+ return mutt_mem_calloc(1, sizeof(struct RegexNode));
}
/**
}
int rc = -1;
- struct RegexListNode *np = NULL, *tmp = NULL;
+ struct RegexNode *np = NULL, *tmp = NULL;
STAILQ_FOREACH_SAFE(np, rl, entries, tmp)
{
if (mutt_str_strcasecmp(str, np->regex->pattern) == 0)
{
- STAILQ_REMOVE(rl, np, RegexListNode, entries);
+ STAILQ_REMOVE(rl, np, RegexNode, entries);
mutt_regex_free(&np->regex);
FREE(&np);
rc = 0;
}
/* check to make sure the item is not already on this rl */
- struct ReplaceListNode *np = NULL;
+ struct Replace *np = NULL;
STAILQ_FOREACH(np, rl, entries)
{
if (mutt_str_strcasecmp(rx->pattern, np->regex->pattern) == 0)
STAILQ_INSERT_TAIL(rl, np, entries);
}
- /* Now np is the ReplaceListNode that we want to modify. It is prepared. */
+ /* Now np is the Replace that we want to modify. It is prepared. */
np->templ = mutt_str_strdup(templ);
/* Find highest match number in template string */
mutt_str_strfcpy(src, str, 1024);
- struct ReplaceListNode *np = NULL;
+ struct Replace *np = NULL;
STAILQ_FOREACH(np, rl, entries)
{
/* If this pattern needs more matches, expand pmatch. */
if (!rl)
return;
- struct ReplaceListNode *np = NULL, *tmp = NULL;
+ struct Replace *np = NULL, *tmp = NULL;
STAILQ_FOREACH_SAFE(np, rl, entries, tmp)
{
- STAILQ_REMOVE(rl, np, ReplaceListNode, entries);
+ STAILQ_REMOVE(rl, np, Replace, entries);
mutt_regex_free(&np->regex);
FREE(&np->templ);
FREE(&np);
int tlen = 0;
char *p = NULL;
- struct ReplaceListNode *np = NULL;
+ struct Replace *np = NULL;
STAILQ_FOREACH(np, rl, entries)
{
/* If this pattern needs more matches, expand pmatch. */
* mutt_replacelist_new - Create a new ReplaceList
* @retval ptr New ReplaceList
*/
-struct ReplaceListNode *mutt_replacelist_new(void)
+struct Replace *mutt_replacelist_new(void)
{
- return mutt_mem_calloc(1, sizeof(struct ReplaceListNode));
+ return mutt_mem_calloc(1, sizeof(struct Replace));
}
/**
return 0;
int nremoved = 0;
- struct ReplaceListNode *np = NULL, *tmp = NULL;
+ struct Replace *np = NULL, *tmp = NULL;
STAILQ_FOREACH_SAFE(np, rl, entries, tmp)
{
if (mutt_str_strcmp(np->regex->pattern, pat) == 0)
{
- STAILQ_REMOVE(rl, np, ReplaceListNode, entries);
+ STAILQ_REMOVE(rl, np, Replace, entries);
mutt_regex_free(&np->regex);
FREE(&np->templ);
FREE(&np);
};
/**
- * struct RegexListNode - List of regular expressions
+ * struct RegexNode - List of regular expressions
*/
-struct RegexListNode
+struct RegexNode
{
struct Regex *regex; /**< Regex containing a regular expression */
- STAILQ_ENTRY(RegexListNode) entries; /**< Next item in list */
+ STAILQ_ENTRY(RegexNode) entries; /**< Next item in list */
};
-STAILQ_HEAD(RegexList, RegexListNode);
+STAILQ_HEAD(RegexList, RegexNode);
/**
- * struct ReplaceListNode - List of regular expressions
+ * struct Replace - List of regular expressions
*/
-struct ReplaceListNode
+struct Replace
{
struct Regex *regex; /**< Regex containing a regular expression */
size_t nmatch; /**< Match the 'nth' occurrence (0 means the whole expression) */
char *templ; /**< Template to match */
- STAILQ_ENTRY(ReplaceListNode) entries; /**< Next item in list */
+ STAILQ_ENTRY(Replace) entries; /**< Next item in list */
};
-STAILQ_HEAD(ReplaceList, ReplaceListNode);
+STAILQ_HEAD(ReplaceList, Replace);
struct Regex *mutt_regex_compile(const char *str, int flags);
struct Regex *mutt_regex_new(const char *str, int flags, struct Buffer *err);
void mutt_regex_free(struct Regex **r);
-int mutt_regexlist_add(struct RegexList *rl, const char *str, int flags, struct Buffer *err);
-void mutt_regexlist_free(struct RegexList *rl);
-bool mutt_regexlist_match(struct RegexList *rl, const char *str);
-struct RegexListNode *mutt_regexlist_new(void);
-int mutt_regexlist_remove(struct RegexList *rl, const char *str);
+int mutt_regexlist_add (struct RegexList *rl, const char *str, int flags, struct Buffer *err);
+void mutt_regexlist_free (struct RegexList *rl);
+bool mutt_regexlist_match (struct RegexList *rl, const char *str);
+struct RegexNode *mutt_regexlist_new (void);
+int mutt_regexlist_remove(struct RegexList *rl, const char *str);
-int mutt_replacelist_add(struct ReplaceList *rl, const char *pat, const char *templ, struct Buffer *err);
-char * mutt_replacelist_apply(struct ReplaceList *rl, char *buf, size_t buflen, const char *str);
-void mutt_replacelist_free(struct ReplaceList *rl);
-bool mutt_replacelist_match(struct ReplaceList *rl, char *buf, size_t buflen, const char *str);
-struct ReplaceListNode *mutt_replacelist_new(void);
-int mutt_replacelist_remove(struct ReplaceList *rl, const char *pat);
+int mutt_replacelist_add (struct ReplaceList *rl, const char *pat, const char *templ, struct Buffer *err);
+char * mutt_replacelist_apply (struct ReplaceList *rl, char *buf, size_t buflen, const char *str);
+void mutt_replacelist_free (struct ReplaceList *rl);
+bool mutt_replacelist_match (struct ReplaceList *rl, char *buf, size_t buflen, const char *str);
+struct Replace *mutt_replacelist_new (void);
+int mutt_replacelist_remove(struct ReplaceList *rl, const char *pat);
bool mutt_regex_match (const struct Regex *regex, const char *str);
bool mutt_regex_capture(const struct Regex *regex, const char *str, size_t num, regmatch_t matches[]);
regex_t regex;
int match; /**< which substringmap 0 for old behaviour */
char *pattern;
- struct PatternHead *color_pattern; /**< compiled pattern to speed up index color
+ struct PatternList *color_pattern; /**< compiled pattern to speed up index color
calculation */
uint32_t fg;
uint32_t bg;
int pair;
- STAILQ_ENTRY(ColorLine) entries;
bool stop_matching : 1; ///< used by the pager for body patterns, to prevent the color from being retried once it fails
+
+ STAILQ_ENTRY(ColorLine) entries;
};
-STAILQ_HEAD(ColorLineHead, ColorLine);
+STAILQ_HEAD(ColorLineList, ColorLine);
extern int *ColorQuote; ///< Array of colours for quoted email text
extern int ColorQuoteUsed; ///< Number of colours for quoted email text
extern int ColorDefs[]; ///< Array of all fixed colours, see enum ColorId
-extern struct ColorLineHead ColorHdrList; ///< List of colours applied to the email headers
-extern struct ColorLineHead ColorBodyList; ///< List of colours applied to the email body
-extern struct ColorLineHead ColorAttachList; ///< List of colours applied to the attachment headers
-extern struct ColorLineHead ColorStatusList; ///< List of colours applied to the status bar
-extern struct ColorLineHead ColorIndexList; ///< List of default colours applied to the index
-extern struct ColorLineHead ColorIndexAuthorList; ///< List of colours applied to the author in the index
-extern struct ColorLineHead ColorIndexFlagsList; ///< List of colours applied to the flags in the index
-extern struct ColorLineHead ColorIndexSubjectList; ///< List of colours applied to the subject in the index
-extern struct ColorLineHead ColorIndexTagList; ///< List of colours applied to tags in the index
+extern struct ColorLineList ColorHdrList; ///< List of colours applied to the email headers
+extern struct ColorLineList ColorBodyList; ///< List of colours applied to the email body
+extern struct ColorLineList ColorAttachList; ///< List of colours applied to the attachment headers
+extern struct ColorLineList ColorStatusList; ///< List of colours applied to the status bar
+extern struct ColorLineList ColorIndexList; ///< List of default colours applied to the index
+extern struct ColorLineList ColorIndexAuthorList; ///< List of colours applied to the author in the index
+extern struct ColorLineList ColorIndexFlagsList; ///< List of colours applied to the flags in the index
+extern struct ColorLineList ColorIndexSubjectList; ///< List of colours applied to the subject in the index
+extern struct ColorLineList ColorIndexTagList; ///< List of colours applied to tags in the index
/* If the system has bkgdset() use it rather than attrset() so that the clr*()
* functions will properly set the background attributes all the way to the
#include "mutt/mutt.h"
#include "myvar.h"
-struct MyVarHead MyVars = TAILQ_HEAD_INITIALIZER(MyVars);
+struct MyVarList MyVars = TAILQ_HEAD_INITIALIZER(MyVars);
/**
* myvar_get - Get the value of a "my_" variable
char *value;
TAILQ_ENTRY(MyVar) entries;
};
-TAILQ_HEAD(MyVarHead, MyVar);
+TAILQ_HEAD(MyVarList, MyVar);
-extern struct MyVarHead MyVars; ///< List of all the user's custom config variables
+extern struct MyVarList MyVars; ///< List of all the user's custom config variables
void myvar_del(const char *var);
const char *myvar_get(const char *var);
*
* A type of a variable to keep track of registered crypto modules.
*/
-static STAILQ_HEAD(CryptModuleHead,
- CryptModule) CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules);
struct CryptModule
{
struct CryptModuleSpecs *specs;
STAILQ_ENTRY(CryptModule) entries;
};
+STAILQ_HEAD(CryptModuleList, CryptModule);
+
+static struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules);
/**
* crypto_module_register - Register a new crypto module
mdata->query_type = string_to_query_type(C_NmQueryType); /* user's default */
- struct UrlQueryString *item = NULL;
+ struct UrlQuery *item = NULL;
STAILQ_FOREACH(item, &mdata->db_url->query_strings, entries)
{
if (!item->value || !item->name)
*/
static int nm_mbox_check_stats(struct Mailbox *m, int flags)
{
- struct UrlQueryString *item = NULL;
+ struct UrlQuery *item = NULL;
struct Url *url = NULL;
char *db_filename = NULL, *db_query = NULL;
notmuch_database_t *db = NULL;
bool *force_redraw, bool q_classify)
{
struct ColorLine *color_line = NULL;
- struct ColorLineHead *head = NULL;
+ struct ColorLineList *head = NULL;
regmatch_t pmatch[1];
bool found;
bool null_rx;
};
// clang-format on
-static struct PatternHead *SearchPattern = NULL; /**< current search pattern */
+static struct PatternList *SearchPattern = NULL; /**< current search pattern */
static char LastSearch[256] = { 0 }; /**< last pattern searched for */
static char LastSearchExpn[1024] = { 0 }; /**< expanded version of LastSearch */
* mutt_pattern_free - Free a Pattern
* @param[out] pat Pattern to free
*/
-void mutt_pattern_free(struct PatternHead **pat)
+void mutt_pattern_free(struct PatternList **pat)
{
if (!pat || !*pat)
return;
* mutt_pattern_node_new - Create a new list containing a Pattern
* @retval ptr Newly created list containing a single node with a Pattern
*/
-static struct PatternHead *mutt_pattern_node_new(void)
+static struct PatternList *mutt_pattern_node_new(void)
{
- struct PatternHead *h = mutt_mem_calloc(1, sizeof(struct PatternHead));
+ struct PatternList *h = mutt_mem_calloc(1, sizeof(struct PatternList));
SLIST_INIT(h);
struct Pattern *p = mutt_mem_calloc(1, sizeof(struct Pattern));
SLIST_INSERT_HEAD(h, p, entries);
* @param err Buffer for error messages
* @retval ptr Newly allocated Pattern
*/
-struct PatternHead *mutt_pattern_comp(const char *s, PatternCompFlags flags, struct Buffer *err)
+struct PatternList *mutt_pattern_comp(const char *s, PatternCompFlags flags, struct Buffer *err)
{
/* curlist when assigned will always point to a list containing at least one node
* with a Pattern value. */
- struct PatternHead *curlist = NULL;
- struct PatternHead *tmp = NULL, *tmp2 = NULL;
- struct PatternHead *last = NULL;
+ struct PatternList *curlist = NULL;
+ struct PatternList *tmp = NULL, *tmp2 = NULL;
+ struct PatternList *last = NULL;
bool pat_not = false;
bool alladdr = false;
bool pat_or = false;
* @param cache Cached Patterns
* @retval true If ALL of the Patterns evaluates to true
*/
-static bool perform_and(struct PatternHead *pat, PatternExecFlags flags,
+static bool perform_and(struct PatternList *pat, PatternExecFlags flags,
struct Mailbox *m, struct Email *e, struct PatternCache *cache)
{
struct Pattern *p = NULL;
* @param cache Cached Patterns
* @retval true If ONE (or more) of the Patterns evaluates to true
*/
-static int perform_or(struct PatternHead *pat, PatternExecFlags flags,
+static int perform_or(struct PatternList *pat, PatternExecFlags flags,
struct Mailbox *m, struct Email *e, struct PatternCache *cache)
{
struct Pattern *p = NULL;
* @retval 1 Success, match found
* @retval 0 No match
*/
-static int match_threadcomplete(struct PatternHead *pat, PatternExecFlags flags,
+static int match_threadcomplete(struct PatternList *pat, PatternExecFlags flags,
struct Mailbox *m, struct MuttThread *t,
int left, int up, int right, int down)
{
* @retval 0 Pattern did not match
* @retval -1 Error
*/
-static int match_threadparent(struct PatternHead *pat, PatternExecFlags flags,
+static int match_threadparent(struct PatternList *pat, PatternExecFlags flags,
struct Mailbox *m, struct MuttThread *t)
{
if (!t || !t->parent || !t->parent->message)
* @retval 0 Pattern did not match
* @retval -1 Error
*/
-static int match_threadchildren(struct PatternHead *pat, PatternExecFlags flags,
+static int match_threadchildren(struct PatternList *pat, PatternExecFlags flags,
struct Mailbox *m, struct MuttThread *t)
{
if (!t || !t->child)
mutt_buffer_init(&err);
err.dsize = 256;
err.data = mutt_mem_malloc(err.dsize);
- struct PatternHead *pat = mutt_pattern_comp(buf->data, MUTT_PC_FULL_MSG, &err);
+ struct PatternList *pat = mutt_pattern_comp(buf->data, MUTT_PC_FULL_MSG, &err);
if (!pat)
{
mutt_error("%s", err.data);
bool ismulti : 1; /**< multiple case (only for I pattern now) */
int min;
int max;
- SLIST_ENTRY(Pattern) entries;
- struct PatternHead *child; /**< arguments to logical op */
+ struct PatternList *child; /**< arguments to logical op */
union {
regex_t *regex;
struct Group *group;
char *str;
struct ListHead multi_cases;
} p;
+ SLIST_ENTRY(Pattern) entries;
};
-SLIST_HEAD(PatternHead, Pattern);
+SLIST_HEAD(PatternList, Pattern);
typedef uint8_t PatternExecFlags; ///< Flags for mutt_pattern_exec(), e.g. #MUTT_MATCH_FULL_ADDRESS
#define MUTT_PAT_EXEC_NO_FLAGS 0 ///< No flags are set
int mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags,
struct Mailbox *m, struct Email *e, struct PatternCache *cache);
-struct PatternHead *mutt_pattern_comp(const char *s, PatternCompFlags flags, struct Buffer *err);
+struct PatternList *mutt_pattern_comp(const char *s, PatternCompFlags flags, struct Buffer *err);
void mutt_check_simple(struct Buffer *s, const char *simple);
-void mutt_pattern_free(struct PatternHead **pat);
+void mutt_pattern_free(struct PatternList **pat);
int mutt_which_case(const char *s);
int mutt_is_list_recipient(bool alladdr, struct Envelope *e);
struct Score
{
char *str;
- struct PatternHead *pat;
+ struct PatternList *pat;
int val;
bool exact; /**< if this rule matches, don't evaluate any more */
struct Score *next;
break;
if (!ptr)
{
- struct PatternHead *pat = mutt_pattern_comp(pattern, MUTT_PC_NO_FLAGS, err);
+ struct PatternList *pat = mutt_pattern_comp(pattern, MUTT_PC_NO_FLAGS, err);
if (!pat)
{
FREE(&pattern);
#include <string.h>
#include "mutt/mutt.h"
#include "config/lib.h"
-#include "common.h"
#include "core/lib.h"
+#include "common.h"
const char *line = "----------------------------------------"
"----------------------------------------";
*
* In the representation {a} is expanded to all the pattern fields.
*/
-static int canonical_pattern(char *s, struct PatternHead *pat, int indent)
+static int canonical_pattern(char *s, struct PatternList *pat, int indent)
{
if (!pat || !s)
return 0;
}
/* best-effort pattern tree compare, returns 0 if equal otherwise 1 */
-static int cmp_pattern(struct PatternHead *p1, struct PatternHead *p2)
+static int cmp_pattern(struct PatternList *p1, struct PatternList *p2)
{
if (!p1 || !p2)
return !(!p1 && !p2);
- struct PatternHead p1_tmp = *p1;
- struct PatternHead p2_tmp = *p2;
+ struct PatternList p1_tmp = *p1;
+ struct PatternList p2_tmp = *p2;
while (!SLIST_EMPTY(&p1_tmp))
{
char *s = "";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(!pat))
{
char *s = "x";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(!pat))
{
char *s = "=s";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(!pat))
{
char *s = "| =s foo";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(!pat))
{
char *s = "=s foobar";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
SLIST_INIT(&expected);
struct Pattern e = { .op = MUTT_PAT_SUBJECT,
.pat_not = false,
char *s = "! =s foobar";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
SLIST_INIT(&expected);
struct Pattern e = { .op = MUTT_PAT_SUBJECT,
.pat_not = true,
char *s = "=s foo =s bar";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
struct Pattern e[3] = { /* root */
{ .op = MUTT_PAT_AND,
SLIST_INIT(&expected);
SLIST_INSERT_HEAD(&expected, &e[0], entries);
- struct PatternHead child;
+ struct PatternList child;
SLIST_INIT(&child);
e[0].child = &child;
SLIST_INSERT_HEAD(e[0].child, &e[1], entries);
char *s = "(=s foo =s bar)";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
struct Pattern e[3] = { /* root */
{ .op = MUTT_PAT_AND,
SLIST_INIT(&expected);
SLIST_INSERT_HEAD(&expected, &e[0], entries);
- struct PatternHead child;
+ struct PatternList child;
SLIST_INIT(&child);
e[0].child = &child;
SLIST_INSERT_HEAD(e[0].child, &e[1], entries);
char *s = "! (=s foo =s bar)";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
struct Pattern e[3] = { /* root */
{ .op = MUTT_PAT_AND,
SLIST_INIT(&expected);
SLIST_INSERT_HEAD(&expected, &e[0], entries);
- struct PatternHead child;
+ struct PatternList child;
SLIST_INIT(&child);
e[0].child = &child;
SLIST_INSERT_HEAD(e[0].child, &e[1], entries);
char *s = "=s foo =s bar =s quux";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
struct Pattern e[4] = { /* root */
{ .op = MUTT_PAT_AND,
SLIST_INIT(&expected);
SLIST_INSERT_HEAD(&expected, &e[0], entries);
- struct PatternHead child;
+ struct PatternList child;
e[0].child = &child;
SLIST_INSERT_HEAD(e[0].child, &e[1], entries);
SLIST_INSERT_AFTER(&e[1], &e[2], entries);
char *s = "!(=s foo|=s bar) =s quux";
mutt_buffer_reset(err);
- struct PatternHead *pat = mutt_pattern_comp(s, 0, err);
+ struct PatternList *pat = mutt_pattern_comp(s, 0, err);
if (!TEST_CHECK(pat != NULL))
{
TEST_MSG("Actual : pat == NULL");
}
- struct PatternHead expected;
+ struct PatternList expected;
struct Pattern e[5] = { /* root */
{ .op = MUTT_PAT_AND,
SLIST_INIT(&expected);
SLIST_INSERT_HEAD(&expected, &e[0], entries);
- struct PatternHead child1, child2;
+ struct PatternList child1, child2;
SLIST_INIT(&child1);
e[0].child = &child1;
SLIST_INSERT_HEAD(e[0].child, &e[1], entries);
{ /* handle edge cases */
struct Regex *rx = regex_new("hello bob", 0, buf);
- const bool failed =
- !TEST_CHECK(mutt_regex_match(NULL, NULL) == false) ||
- !TEST_CHECK(mutt_regex_match(NULL, "bob the string") == false) ||
- !TEST_CHECK(mutt_regex_match(rx, NULL) == false);
+ const bool failed = !TEST_CHECK(mutt_regex_match(NULL, NULL) == false) ||
+ !TEST_CHECK(mutt_regex_match(NULL, "bob the string") == false) ||
+ !TEST_CHECK(mutt_regex_match(rx, NULL) == false);
regex_free(&rx);
if (failed)
// !((regexec(C_Mask->regex, mdata->group, 0, NULL, 0) == 0) ^ C_Mask->pat_not))
// to: if (!mutt_regex_match(C_Mask, mdata->group))
struct Regex *rx = regex_new("!bob", DT_REGEX_ALLOW_NOT, buf);
- const bool old =
- (rx && rx->regex) && !((regexec(rx->regex, line, 0, NULL, 0) == 0) ^ rx->pat_not);
+ const bool old = (rx && rx->regex) &&
+ !((regexec(rx->regex, line, 0, NULL, 0) == 0) ^ rx->pat_not);
const bool new = !mutt_regex_match(rx, line);
regex_free(&rx);
void test_mutt_regexlist_new(void)
{
- // struct RegexListNode *mutt_regexlist_new(void);
+ // struct RegexNode *mutt_regexlist_new(void);
}
void test_mutt_replacelist_new(void)
{
- // struct ReplaceListNode *mutt_replacelist_new(void);
+ // struct Replace *mutt_replacelist_new(void);
}
void test_driver_tags_free(void)
{
- // void driver_tags_free(struct TagHead *head);
+ // void driver_tags_free(struct TagList *list);
{
driver_tags_free(NULL);
void test_driver_tags_get(void)
{
- // char *driver_tags_get(struct TagHead *head);
+ // char *driver_tags_get(struct TagList *list);
{
TEST_CHECK(!driver_tags_get(NULL));
void test_driver_tags_get_transformed(void)
{
- // char *driver_tags_get_transformed(struct TagHead *head);
+ // char *driver_tags_get_transformed(struct TagList *list);
{
TEST_CHECK(!driver_tags_get_transformed(NULL));
void test_driver_tags_get_transformed_for(void)
{
- // char *driver_tags_get_transformed_for(struct TagHead *head, const char *name);
+ // char *driver_tags_get_transformed_for(struct TagList *list, const char *name);
{
- struct TagHead taghead = { 0 };
+ struct TagList taghead = { 0 };
TEST_CHECK(!driver_tags_get_transformed_for(&taghead, NULL));
}
void test_driver_tags_get_with_hidden(void)
{
- // char *driver_tags_get_with_hidden(struct TagHead *head);
+ // char *driver_tags_get_with_hidden(struct TagList *list);
{
TEST_CHECK(!driver_tags_get_with_hidden(NULL));
void test_driver_tags_replace(void)
{
- // bool driver_tags_replace(struct TagHead *head, char *tags);
+ // bool driver_tags_replace(struct TagList *list, char *tags);
{
TEST_CHECK(!driver_tags_replace(NULL, "apple"));
}
{
- struct TagHead taghead = { 0 };
+ struct TagList taghead = { 0 };
TEST_CHECK(driver_tags_replace(&taghead, NULL));
}
}
};
// clang-format on
-void check_query_string(const char *exp, const struct UrlQueryStringHead *act)
+void check_query_string(const char *exp, const struct UrlQueryList *act)
{
char *next = NULL;
char tmp[64] = { 0 };
- const struct UrlQueryString *np = STAILQ_FIRST(act);
+ const struct UrlQuery *np = STAILQ_FIRST(act);
while (exp && *exp)
{
next = strchr(exp, '|');