From 974bac914891f1e61ca64345d87d9db1986d2091 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 21 Oct 2017 01:08:24 +0100 Subject: [PATCH] lib: move List and Queue into library --- Makefile.am | 4 +- Makefile.autosetup | 8 +- alias.c | 1 - attach.c | 1 - compose.c | 1 - copy.c | 1 - curs_main.c | 1 - envelope.c | 2 +- envelope.h | 2 +- globals.h | 1 - group.c | 1 - handler.c | 1 - hcache/Makefile.am | 4 +- hcache/hcache.c | 1 - header.h | 1 - headers.c | 1 - hook.c | 1 - imap/imap.c | 1 - imap/imap_private.h | 2 +- imap/message.c | 1 - imap/message.h | 2 +- imap/util.c | 1 - init.c | 1 - lib/Makefile.am | 4 +- lib/lib.h | 2 + lib/list.c | 165 +++++++++++++++++++++++++++++++++++++++++ lib/list.h | 56 ++++++++++++++ queue.h => lib/queue.h | 0 list.h | 127 ------------------------------- main.c | 1 - mbox.c | 1 - mutt_curses.h | 2 +- mutt_socket.h | 1 - mutt_tags.c | 2 +- mutt_tags.h | 2 +- muttlib.c | 1 - ncrypt/crypt_gpgme.c | 1 - ncrypt/crypt_mod.c | 2 +- ncrypt/pgp.c | 1 - ncrypt/pgpinvoke.c | 1 - ncrypt/pgpkey.c | 1 - parse.c | 1 - pattern.c | 1 - po/POTFILES.in | 1 + postpone.c | 1 - remailer.c | 1 - send.c | 1 - sendlib.c | 1 - thread.c | 1 - 49 files changed, 242 insertions(+), 176 deletions(-) create mode 100644 lib/list.c create mode 100644 lib/list.h rename queue.h => lib/queue.h (100%) delete mode 100644 list.h diff --git a/Makefile.am b/Makefile.am index d3e125b41..ee8c5975e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,7 @@ neomutt_SOURCES = account.c addrbook.c address.h alias.c alias.h attach.c \ curs_lib.c curs_main.c edit.c editmsg.c enter.c enter_state.h \ envelope.c envelope.h filter.c flags.c format_flags.h from.c getdomain.c group.c \ handler.c hdrline.c header.h headers.c help.c history.c hook.c \ - init.c keymap.c list.h main.c mbox.c mbyte.c mbtable.h \ + init.c keymap.c main.c mbox.c mbyte.c mbtable.h \ menu.c mh.c muttlib.c mutt_idna.c mutt_sasl_plain.c mutt_socket.c \ mutt_tunnel.c mx.c newsrc.c nntp.c options.h pager.c parameter.c parameter.h \ parse.c pattern.c pattern.h pop.c pop_auth.c pop_lib.c postpone.c \ @@ -88,7 +88,7 @@ EXTRA_DIST = account.h attach.h bcache.h browser.h buffy.h \ mutt_curses.h mutt_idna.h mutt_lua.h mutt_menu.h mutt_notmuch.h \ mutt_options.h mutt_regex.h mutt_sasl.h mutt_sasl_plain.h \ mutt_socket.h mutt_ssl.h mutt_tunnel.h mx.h myvar.h nntp.h opcodes.h pager.h \ - pgpewrap.c pop.h protos.h queue.h README.md README.SSL remailer.c remailer.h \ + pgpewrap.c pop.h protos.h README.md README.SSL remailer.c remailer.h \ rfc1524.h rfc2047.h rfc2231.h rfc3676.h rfc822.h sidebar.h \ sort.h txt2c.c txt2c.sh version.h mutt_tags.h diff --git a/Makefile.autosetup b/Makefile.autosetup index e25eaab13..f017c3f75 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -100,8 +100,8 @@ ALLOBJS+= $(NEOMUTTOBJS) # libmutt LIBMUTT= libmutt.a LIBMUTTOBJS= lib/base64.o lib/buffer.o lib/date.o lib/debug.o lib/exit.o \ - lib/file.o lib/hash.o lib/mapping.o lib/md5.o lib/memory.o \ - lib/message.o lib/sha1.o lib/string.o + lib/file.o lib/hash.o lib/list.o lib/mapping.o lib/md5.o \ + lib/memory.o lib/message.o lib/sha1.o lib/string.o CLEANFILES+= $(LIBMUTT) $(LIBMUTTOBJS) MUTTLIBS+= $(LIBMUTT) ALLOBJS+= $(LIBMUTTOBJS) @@ -248,13 +248,13 @@ git_ver.h: $(ALL_FILES) rm -f git_ver.h.tmp hcache/hcversion.h: $(SRCDIR)/mutt.h $(SRCDIR)/address.h \ - $(SRCDIR)/list.h $(SRCDIR)/lib/buffer.h \ + $(SRCDIR)/lib/list.h $(SRCDIR)/lib/buffer.h \ $(SRCDIR)/parameter.h $(SRCDIR)/body.h \ $(SRCDIR)/envelope.h $(SRCDIR)/header.h \ $(SRCDIR)/hcache/hcachever.sh \ $(PWD)/hcache ( echo '#include "config.h"'; echo '#include "mutt.h"'; \ - echo '#include "address.h"'; echo '#include "list.h"'; \ + echo '#include "address.h"'; echo '#include "lib/list.h"'; \ echo '#include "lib/buffer.h"'; echo '#include "parameter.h"'; \ echo '#include "body.h"'; echo '#include "envelope.h"'; \ echo '#include "header.h"';) | $(CPP) $(CFLAGS) - | \ diff --git a/alias.c b/alias.c index af6dd7391..39bf69555 100644 --- a/alias.c +++ b/alias.c @@ -39,7 +39,6 @@ #include "charset.h" #include "envelope.h" #include "globals.h" -#include "list.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "options.h" diff --git a/attach.c b/attach.c index 47065f8e6..19a37ef93 100644 --- a/attach.c +++ b/attach.c @@ -37,7 +37,6 @@ #include "filter.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_curses.h" diff --git a/compose.c b/compose.c index 07d5acc51..4ac7c4e5a 100644 --- a/compose.c +++ b/compose.c @@ -44,7 +44,6 @@ #include "globals.h" #include "header.h" #include "keymap.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_curses.h" diff --git a/copy.c b/copy.c index b59c957ed..e110f3e38 100644 --- a/copy.c +++ b/copy.c @@ -34,7 +34,6 @@ #include "envelope.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_curses.h" diff --git a/curs_main.c b/curs_main.c index a0aba8f56..eb34ffb0e 100644 --- a/curs_main.c +++ b/curs_main.c @@ -42,7 +42,6 @@ #include "globals.h" #include "header.h" #include "keymap.h" -#include "list.h" #include "mailbox.h" #include "mutt_curses.h" #include "mutt_menu.h" diff --git a/envelope.c b/envelope.c index 7001bcb80..aa4c9539d 100644 --- a/envelope.c +++ b/envelope.c @@ -25,7 +25,7 @@ #include "lib/buffer.h" #include "lib/memory.h" #include "envelope.h" -#include "queue.h" +#include "lib/queue.h" #include "rfc822.h" struct Envelope *mutt_new_envelope(void) diff --git a/envelope.h b/envelope.h index e882f197d..e13f269cf 100644 --- a/envelope.h +++ b/envelope.h @@ -24,7 +24,7 @@ #define _MUTT_ENVELOPE_H #include -#include "list.h" +#include "lib/list.h" /** * struct Envelope - The header of an email diff --git a/globals.h b/globals.h index c032afb90..23421a15f 100644 --- a/globals.h +++ b/globals.h @@ -25,7 +25,6 @@ #include #include "lib/lib.h" -#include "list.h" #include "where.h" #include "mutt_regex.h" diff --git a/group.c b/group.c index 462007c6e..de83ae474 100644 --- a/group.c +++ b/group.c @@ -28,7 +28,6 @@ #include "group.h" #include "address.h" #include "globals.h" -#include "list.h" #include "protos.h" #include "rfc822.h" diff --git a/handler.c b/handler.c index 91d940985..f665e4873 100644 --- a/handler.c +++ b/handler.c @@ -45,7 +45,6 @@ #include "filter.h" #include "globals.h" #include "keymap.h" -#include "list.h" #include "mime.h" #include "mutt_curses.h" #include "ncrypt/ncrypt.h" diff --git a/hcache/Makefile.am b/hcache/Makefile.am index 4700d0e88..ac3aefd20 100644 --- a/hcache/Makefile.am +++ b/hcache/Makefile.am @@ -44,12 +44,12 @@ BUILT_SOURCES = $(HCVERSION) $(top_srcdir)/keymap_defs.h: +$(MAKE) -C $(top_srcdir) keymap_defs.h -hcversion.h: $(top_srcdir)/mutt.h $(top_srcdir)/address.h $(top_srcdir)/list.h \ +hcversion.h: $(top_srcdir)/mutt.h $(top_srcdir)/address.h $(top_srcdir)/lib/list.h \ $(top_srcdir)/lib/buffer.h $(top_srcdir)/parameter.h \ $(top_srcdir)/body.h $(top_srcdir)/envelope.h \ $(top_srcdir)/header.h $(srcdir)/hcachever.sh ( echo '#include "config.h"'; echo '#include "mutt.h"'; \ - echo '#include "address.h"'; echo '#include "list.h"'; \ + echo '#include "address.h"'; echo '#include "lib/list.h"'; \ echo '#include "lib/buffer.h"'; echo '#include "parameter.h"'; \ echo '#include "body.h"'; echo '#include "envelope.h"'; \ echo '#include "header.h"'; \ diff --git a/hcache/hcache.c b/hcache/hcache.c index 643759fc0..098150406 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -57,7 +57,6 @@ #include "hcache.h" #include "hcache/hcversion.h" #include "header.h" -#include "list.h" #include "mbyte.h" #include "mutt_regex.h" #include "mutt_tags.h" diff --git a/header.h b/header.h index 75c2df138..981975d62 100644 --- a/header.h +++ b/header.h @@ -27,7 +27,6 @@ #include #include #include "lib/lib.h" -#include "list.h" #include "mutt_tags.h" /** diff --git a/headers.c b/headers.c index b315a0ebc..2418c3cd2 100644 --- a/headers.c +++ b/headers.c @@ -36,7 +36,6 @@ #include "envelope.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mutt_idna.h" #include "ncrypt/ncrypt.h" #include "options.h" diff --git a/hook.c b/hook.c index bd68bace5..a4f4c8f6c 100644 --- a/hook.c +++ b/hook.c @@ -35,7 +35,6 @@ #include "envelope.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mutt_regex.h" #include "ncrypt/ncrypt.h" diff --git a/imap/imap.c b/imap/imap.c index 6f5249a6d..c17bd6076 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -46,7 +46,6 @@ #include "globals.h" #include "header.h" #include "imap/imap.h" -#include "list.h" #include "mailbox.h" #include "message.h" #include "mutt_curses.h" diff --git a/imap/imap_private.h b/imap/imap_private.h index ad4bf0bc1..7a01ba43d 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -27,10 +27,10 @@ #include #include #include +#include "lib/list.h" #ifdef USE_HCACHE #include "hcache/hcache.h" #endif -#include "list.h" struct Account; struct Buffer; diff --git a/imap/message.c b/imap/message.c index b27de4199..1b35fa8f9 100644 --- a/imap/message.c +++ b/imap/message.c @@ -42,7 +42,6 @@ #include "globals.h" #include "header.h" #include "imap/imap.h" -#include "list.h" #include "mailbox.h" #include "mutt_curses.h" #include "mutt_socket.h" diff --git a/imap/message.h b/imap/message.h index 231cab289..e6c963668 100644 --- a/imap/message.h +++ b/imap/message.h @@ -26,7 +26,7 @@ #include #include -#include "list.h" +#include "lib/list.h" /** * struct ImapHeaderData - IMAP-specific header data diff --git a/imap/util.c b/imap/util.c index edfde0ed0..005902671 100644 --- a/imap/util.c +++ b/imap/util.c @@ -45,7 +45,6 @@ #include "globals.h" #include "header.h" #include "imap/imap.h" -#include "list.h" #include "mailbox.h" #include "message.h" #include "mutt_socket.h" diff --git a/init.c b/init.c index 66355e58b..3f5a166e5 100644 --- a/init.c +++ b/init.c @@ -51,7 +51,6 @@ #include "header.h" #include "history.h" #include "keymap.h" -#include "list.h" #include "mailbox.h" #include "mbtable.h" #include "mbyte.h" diff --git a/lib/Makefile.am b/lib/Makefile.am index ac7658a9c..e6522cdeb 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,11 +3,11 @@ include $(top_srcdir)/flymake.am AUTOMAKE_OPTIONS = 1.6 foreign -EXTRA_DIST = lib.h base64.h buffer.h date.h debug.h exit.h file.h hash.h mapping.h md5.h memory.h message.h sha1.h string2.h +EXTRA_DIST = lib.h base64.h buffer.h date.h debug.h exit.h file.h hash.h list.h mapping.h md5.h memory.h message.h queue.h sha1.h string2.h AM_CPPFLAGS = -I$(top_srcdir) noinst_LIBRARIES = libmutt.a -libmutt_a_SOURCES = base64.c buffer.c date.c debug.c exit.c file.c hash.c mapping.c md5.c memory.c message.c sha1.c string.c +libmutt_a_SOURCES = base64.c buffer.c date.c debug.c exit.c file.c hash.c list.c mapping.c md5.c memory.c message.c sha1.c string.c diff --git a/lib/lib.h b/lib/lib.h index 4f47709f3..e6e32f025 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -35,6 +35,7 @@ * -# @subpage exit * -# @subpage file * -# @subpage hash + * -# @subpage list * -# @subpage mapping * -# @subpage md5 * -# @subpage memory @@ -53,6 +54,7 @@ #include "exit.h" #include "file.h" #include "hash.h" +#include "list.h" #include "mapping.h" #include "md5.h" #include "memory.h" diff --git a/lib/list.c b/lib/list.c new file mode 100644 index 000000000..b1c5f3dd7 --- /dev/null +++ b/lib/list.c @@ -0,0 +1,165 @@ +/** + * @file + * Singly-linked list type + * + * @authors + * Copyright (C) 2017 Richard Russon + * Copyright (C) 2017 Pietro Cerutti + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +/** + * @page list Singly-linked list type + * + * Singly-linked list of strings. + * + * | Function | Description + * | :----------------------- | :----------------------------------------- + * | mutt_list_clear() | Free a list, but NOT its strings + * | mutt_list_find() | Find a string in a List + * | mutt_list_free() | Free a List AND its strings + * | mutt_list_insert_after() | Insert a string after a given ListNode + * | mutt_list_insert_head() | Insert a string at the beginning of a List + * | mutt_list_insert_tail() | Append a string to the end of a List + * | mutt_list_match() | Is the string in the list (see notes) + */ + +#include "config.h" +#include "list.h" +#include "memory.h" +#include "string2.h" + +/** + * mutt_list_insert_head - Insert a string at the beginning of a List + * @param h Head of the List + * @param s String to insert + * @retval ptr Newly inserted ListNode containing the string + */ +struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s) +{ + struct ListNode *np = safe_calloc(1, sizeof(struct ListNode)); + np->data = s; + STAILQ_INSERT_HEAD(h, np, entries); + return np; +} + +/** + * mutt_list_insert_tail - Append a string to the end of a List + * @param h Head of the List + * @param s String to insert + * @retval ptr Newly appended ListNode containing the string + */ +struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s) +{ + struct ListNode *np = safe_calloc(1, sizeof(struct ListNode)); + np->data = s; + STAILQ_INSERT_TAIL(h, np, entries); + return np; +} + +/** + * mutt_list_insert_after - Insert a string after a given ListNode + * @param h Head of the List + * @parem n ListNode after which the string will be inserted + * @param s String to insert + * @retval ptr Newly created ListNode containing the string + */ +struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s) +{ + struct ListNode *np = safe_calloc(1, sizeof(struct ListNode)); + np->data = s; + STAILQ_INSERT_AFTER(h, n, np, entries); + return np; +} + +/** + * mutt_list_find - Find a string in a List + * @param h Head of the List + * @param s String to find + * @retval ptr ListNode containing the string + * @retval NULL if the string isn't found + */ +struct ListNode *mutt_list_find(struct ListHead *h, const char *data) +{ + struct ListNode *np; + STAILQ_FOREACH(np, h, entries) + { + if (np->data == data || mutt_strcmp(np->data, data) == 0) + { + return np; + } + } + return NULL; +} + +/** + * mutt_list_free - Free a List AND its strings + * @param h Head of the List + */ +void mutt_list_free(struct ListHead *h) +{ + struct ListNode *np = STAILQ_FIRST(h), *next = NULL; + while (np) + { + next = STAILQ_NEXT(np, entries); + FREE(&np->data); + FREE(&np); + np = next; + } + STAILQ_INIT(h); +} + +/** + * mutt_list_clear - Free a list, but NOT its strings + * @param h Head of the List + * + * This can be used when the strings have a different lifetime to the List. + */ +void mutt_list_clear(struct ListHead *h) +{ + struct ListNode *np = STAILQ_FIRST(h), *next = NULL; + while (np) + { + next = STAILQ_NEXT(np, entries); + FREE(&np); + np = next; + } + STAILQ_INIT(h); +} + +/** + * mutt_list_match - Is the string in the list (see notes) + * @param s String to match + * @param h Head of the List + * @return true String matches a List item (or List contains "*") + * + * This is a very specific function. It searches a List of strings looking for + * a match. If the list contains a string "*", then it match any input string. + * + * @note The strings are compared to the length of the List item, e.g. + * List: "Red" matches Param: "Redwood", but not the other way around. + * @note The case of the strings is ignored. + */ +bool mutt_list_match(const char *s, struct ListHead *h) +{ + struct ListNode *np; + STAILQ_FOREACH(np, h, entries) + { + if ((*np->data == '*') || (mutt_strncasecmp(s, np->data, strlen(np->data)) == 0)) + return true; + } + return false; +} diff --git a/lib/list.h b/lib/list.h new file mode 100644 index 000000000..c566538c9 --- /dev/null +++ b/lib/list.h @@ -0,0 +1,56 @@ +/** + * @file + * Singly-linked list type + * + * @authors + * Copyright (C) 2017 Richard Russon + * Copyright (C) 2017 Pietro Cerutti + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef _LIB_LIST_H +#define _LIB_LIST_H + +#include +#include +#include "lib/queue.h" + +/** + * struct ListNode - A List node for strings + */ +struct ListNode +{ + char *data; + STAILQ_ENTRY(ListNode) entries; +}; + +/** + * struct ListHead - A generic list of strings + * + * The List is stored as a STAILQ. + * This means that insertions are quick at the head and tail of the list. + */ +STAILQ_HEAD(ListHead, ListNode); + +void mutt_list_clear(struct ListHead *h); +struct ListNode *mutt_list_find(struct ListHead *h, const char *data); +void mutt_list_free(struct ListHead *h); +struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, char *s); +struct ListNode *mutt_list_insert_head(struct ListHead *h, char *s); +struct ListNode *mutt_list_insert_tail(struct ListHead *h, char *s); +bool mutt_list_match(const char *s, struct ListHead *h); + +#endif /* _LIB_LIST_H */ diff --git a/queue.h b/lib/queue.h similarity index 100% rename from queue.h rename to lib/queue.h diff --git a/list.h b/list.h deleted file mode 100644 index 774f3b0fa..000000000 --- a/list.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @file - * Singly-linked list type - * - * @authors - * Copyright (C) 2017 Richard Russon - * - * @copyright - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 2 of the License, or (at your option) any later - * version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#ifndef _MUTT_LIST_H -#define _MUTT_LIST_H - -#include -#include "lib/lib.h" - -/** - * New implementation using macros from queue.h - */ - -#include "queue.h" - -/** - * struct ListNode - A generic List node - */ -struct ListNode -{ - char *data; - STAILQ_ENTRY(ListNode) entries; -}; -STAILQ_HEAD(ListHead, ListNode); - -static inline struct ListNode* mutt_list_insert_head(struct ListHead *h, - char *s) -{ - struct ListNode *np = safe_calloc(1, sizeof(struct ListNode)); - np->data = s; - STAILQ_INSERT_HEAD(h, np, entries); - return np; -} - -static inline struct ListNode* mutt_list_insert_tail(struct ListHead *h, - char *s) -{ - struct ListNode *np = safe_calloc(1, sizeof(struct ListNode)); - np->data = s; - STAILQ_INSERT_TAIL(h, np, entries); - return np; -} - -static inline struct ListNode* mutt_list_insert_after(struct ListHead *h, - struct ListNode *n, - char *s) -{ - struct ListNode *np = safe_calloc(1, sizeof(struct ListNode)); - np->data = s; - STAILQ_INSERT_AFTER(h, n, np, entries); - return np; -} - -static inline struct ListNode *mutt_list_find(struct ListHead *h, - const char *data) -{ - struct ListNode *np; - STAILQ_FOREACH(np, h, entries) - { - if (np->data == data || mutt_strcmp(np->data, data) == 0) - { - return np; - } - } - return NULL; -} - -static inline void mutt_list_free(struct ListHead *h) -{ - struct ListNode *np = STAILQ_FIRST(h), *next = NULL; - while (np) - { - next = STAILQ_NEXT(np, entries); - FREE(&np->data); - FREE(&np); - np = next; - } - STAILQ_INIT(h); -} - -static inline void mutt_list_clear(struct ListHead *h) -{ - struct ListNode *np = STAILQ_FIRST(h), *next = NULL; - while (np) - { - next = STAILQ_NEXT(np, entries); - FREE(&np); - np = next; - } - STAILQ_INIT(h); -} - -/** - * mutt_list_match - Is the string in the list - * @return true if the header contained in "s" is in list "h" - */ -static inline bool mutt_list_match(const char *s, struct ListHead *h) -{ - struct ListNode *np; - STAILQ_FOREACH(np, h, entries) - { - if (*np->data == '*' || mutt_strncasecmp(s, np->data, strlen(np->data)) == 0) - return true; - } - return false; -} - -#endif /* _MUTT_LIST_H */ diff --git a/main.c b/main.c index d3426414b..fc8e6a011 100644 --- a/main.c +++ b/main.c @@ -47,7 +47,6 @@ #include "globals.h" #include "header.h" #include "keymap.h" -#include "list.h" #include "mailbox.h" #include "mutt_curses.h" #include "mutt_idna.h" diff --git a/mbox.c b/mbox.c index ca1ae5694..40245b7fc 100644 --- a/mbox.c +++ b/mbox.c @@ -42,7 +42,6 @@ #include "envelope.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mutt_curses.h" #include "mx.h" diff --git a/mutt_curses.h b/mutt_curses.h index 545f037fb..b0bb13d65 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -27,7 +27,7 @@ #include #include "lib/lib.h" #include "options.h" -#include "queue.h" +#include "lib/queue.h" #ifdef USE_SLANG_CURSES diff --git a/mutt_socket.h b/mutt_socket.h index c770a9bfb..e766f5eb7 100644 --- a/mutt_socket.h +++ b/mutt_socket.h @@ -26,7 +26,6 @@ #include #include "account.h" -#include "list.h" #include "lib/lib.h" /* logging levels */ diff --git a/mutt_tags.c b/mutt_tags.c index 2a61417be..29cc4386a 100644 --- a/mutt_tags.c +++ b/mutt_tags.c @@ -27,7 +27,7 @@ #include "lib/string2.h" #include "globals.h" #include "mutt_tags.h" -#include "queue.h" +#include "lib/queue.h" /** * driver_tags_free - Free tags from a header diff --git a/mutt_tags.h b/mutt_tags.h index ef840364b..02d483fd4 100644 --- a/mutt_tags.h +++ b/mutt_tags.h @@ -25,7 +25,7 @@ #include #include -#include "queue.h" +#include "lib/queue.h" /** * struct TagNode - LinkedList Tag Element diff --git a/muttlib.c b/muttlib.c index 863352a24..2a1e4c79e 100644 --- a/muttlib.c +++ b/muttlib.c @@ -55,7 +55,6 @@ #include "format_flags.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_curses.h" diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 4511065e8..f0d2f289d 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -57,7 +57,6 @@ #include "globals.h" #include "header.h" #include "keymap.h" -#include "list.h" #include "mime.h" #include "mutt_curses.h" #include "mutt_menu.h" diff --git a/ncrypt/crypt_mod.c b/ncrypt/crypt_mod.c index 0ad9c2aaa..d59133c30 100644 --- a/ncrypt/crypt_mod.c +++ b/ncrypt/crypt_mod.c @@ -23,7 +23,7 @@ #include "config.h" #include "lib/lib.h" #include "crypt_mod.h" -#include "queue.h" +#include "lib/queue.h" /** * struct CryptModule - A crypto plugin module diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 4900d5287..5720830f8 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -53,7 +53,6 @@ #include "filter.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mime.h" #include "mutt_curses.h" #include "mutt_regex.h" diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index f03bb3349..0ab8f6b38 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -35,7 +35,6 @@ #include "filter.h" #include "format_flags.h" #include "globals.h" -#include "list.h" #include "mutt_curses.h" #include "mutt_idna.h" #include "ncrypt.h" diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index c7a3d45c3..8aeebc386 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -43,7 +43,6 @@ #include "globals.h" #include "gnupgparse.h" #include "keymap.h" -#include "list.h" #include "mime.h" #include "mutt_curses.h" #include "mutt_menu.h" diff --git a/parse.c b/parse.c index 4a0d31859..f2de88495 100644 --- a/parse.c +++ b/parse.c @@ -35,7 +35,6 @@ #include "envelope.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_regex.h" diff --git a/pattern.c b/pattern.c index 4f24abbf5..dbf6c028c 100644 --- a/pattern.c +++ b/pattern.c @@ -48,7 +48,6 @@ #include "globals.h" #include "group.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mutt_curses.h" #include "mutt_menu.h" diff --git a/po/POTFILES.in b/po/POTFILES.in index 73ea469b8..93362aad3 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -63,6 +63,7 @@ lib/debug.c lib/exit.c lib/file.c lib/hash.c +lib/list.c lib/md5.c lib/memory.c lib/message.c diff --git a/postpone.c b/postpone.c index 43be8d68c..8be27c2e7 100644 --- a/postpone.c +++ b/postpone.c @@ -38,7 +38,6 @@ #include "globals.h" #include "header.h" #include "keymap.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_menu.h" diff --git a/remailer.c b/remailer.c index e55420237..c366d4277 100644 --- a/remailer.c +++ b/remailer.c @@ -40,7 +40,6 @@ #include "globals.h" #include "header.h" #include "keymap.h" -#include "list.h" #include "mutt_curses.h" #include "mutt_menu.h" #include "opcodes.h" diff --git a/send.c b/send.c index 17355e73e..41bd0ec00 100644 --- a/send.c +++ b/send.c @@ -43,7 +43,6 @@ #include "filter.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_curses.h" diff --git a/sendlib.c b/sendlib.c index 75470972a..ab0d8c116 100644 --- a/sendlib.c +++ b/sendlib.c @@ -52,7 +52,6 @@ #include "format_flags.h" #include "globals.h" #include "header.h" -#include "list.h" #include "mailbox.h" #include "mime.h" #include "mutt_curses.h" diff --git a/thread.c b/thread.c index 66a8b3693..ac41fc673 100644 --- a/thread.c +++ b/thread.c @@ -33,7 +33,6 @@ #include "envelope.h" #include "globals.h" #include "header.h" -#include "list.h" #include "options.h" #include "protos.h" #include "sort.h" -- 2.40.0