alias.c attach.c base64.c browser.c buffy.c \
charset.c color.c compress.c crypt.c cryptglue.c commands.c complete.c \
compose.c copy.c curs_lib.c curs_main.c crypt-mod.c crypt-mod.h \
- date.c \
- edit.c editmsg.c enter.c \
- flags.c filter.c from.c \
- getdomain.c \
+ date.c edit.c editmsg.c enter.c \
+ flags.c filter.c from.c getdomain.c \
handler.c hcache.c hdrline.c headers.c help.c history.c hook.c \
- init.c \
- keymap.c \
- lib.c list.c \
+ init.c keymap.c lib.c \
main.c mbox.c mbyte.c md5c.c menu.c mh.c muttlib.c mutt_idna.c mx.c \
pager.c parse.c pattern.c postpone.c \
query.c \
account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
mutt_tunnel.c smime.c pgp.c pgpinvoke.c pgpkey.c \
pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
- alias.h browser.h \
- enter.h \
- list.h \
+ alias.h browser.h enter.h \
mbyte.h remailer.h url.h state.h \
pgppacket.c mutt_idna.h mutt_libesmtp.c \
crypt-mod-pgp-classic.c crypt-mod-smime-classic.c \
EXTRA_DIST = config.rpath COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
configure acconfig.h \
account.h alias.h attach.h recvattach.h handler.h thread.h \
- buffy.h \
- charset.h compress.h copy.h crypthash.h \
+ buffy.h charset.h compress.h copy.h crypthash.h \
dotlock.h functions.h gen_defs \
enter.h recvattach.h handler.h thread.h \
- list.h \
globals.h history.h init.h keymap.h mutt_crypt.h \
mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \
for (t = strtok (scratch, " ,.:\"()<>\n"); t;
t = strtok (NULL, " ,.:\"()<>\n")) {
if (m_strlen(t) > 3)
- hints = mutt_add_list (hints, t);
+ hints = mutt_add_list(hints, t);
}
p_delete(&scratch);
noinst_LIBRARIES = liblib.a
-liblib_a_SOURCES = mem.h str.h ascii.h buffer.h hash.h \
- str.c ascii.c buffer.c hash.c
+liblib_a_SOURCES = mem.h str.h ascii.h buffer.h hash.h list.h \
+ str.c ascii.c buffer.c hash.c list.c
-noinst_HEADERS = mem.h str.h ascii.h buffer.h hash.h
+noinst_HEADERS = mem.h str.h ascii.h buffer.h hash.h list.h
--- /dev/null
+/*
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Copyright © 2006 Pierre Habouzit
+ */
+
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "mem.h"
+#include "str.h"
+#include "list.h"
+
+LIST *mutt_copy_list(LIST *p) {
+ LIST *t, *r = NULL, *l = NULL;
+
+ for (; p; p = p->next) {
+ t = p_new(LIST, 1);
+ t->data = m_strdup(p->data);
+ t->next = NULL;
+ if (l) {
+ r->next = t;
+ r = r->next;
+ } else {
+ l = r = t;
+ }
+ }
+ return l;
+}
+
+LIST *mutt_add_list_n(LIST *head, const void *data, size_t len) {
+ LIST *tmp;
+
+ for (tmp = head; tmp && tmp->next; tmp = tmp->next);
+
+ if (tmp) {
+ tmp->next = p_new(LIST, 1);
+ tmp = tmp->next;
+ } else {
+ head = tmp = p_new(LIST, 1);
+ }
+
+ tmp->data = p_dup((const char *)data, len);
+ tmp->next = NULL;
+ return head;
+}
+
+void mutt_free_list(LIST **list) {
+ LIST *p;
+
+ if (list) {
+ while (*list) {
+ p = *list;
+ *list = (*list)->next;
+ p_delete(&p->data);
+ p_delete(&p);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Copyright © 2006 Pierre Habouzit
+ */
+
+/*
+ * Copyright notice from original mutt:
+ * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ */
+
+#ifndef _MUTT_LIST_H
+#define _MUTT_LIST_H
+
+typedef struct list_t {
+ char *data;
+ struct list_t *next;
+} LIST;
+
+#define mutt_new_list() p_new(LIST, 1)
+void mutt_free_list(LIST **);
+
+LIST *mutt_copy_list(LIST *);
+
+/* add an element to a list */
+LIST *mutt_add_list_n(LIST*, const void*, size_t len);
+static inline LIST *mutt_add_list(LIST *head, const char *data) {
+ size_t len = m_strlen(data);
+ return mutt_add_list_n(head, data, len ? len + 1 : 0);
+}
+
+#endif /* !_MUTT_LIST_H */
+++ /dev/null
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <lib-lib/mem.h>
-#include <lib-lib/str.h>
-
-#include "list.h"
-
-LIST *mutt_copy_list (LIST * p) {
- LIST *t, *r = NULL, *l = NULL;
-
- for (; p; p = p->next) {
- t = p_new(LIST, 1);
- t->data = m_strdup(p->data);
- t->next = NULL;
- if (l) {
- r->next = t;
- r = r->next;
- }
- else
- l = r = t;
- }
- return (l);
-}
-
-
-LIST *mutt_add_list (LIST * head, const char *data) {
- size_t len = m_strlen(data);
- return (mutt_add_list_n (head, data, len ? len + 1 : 0));
-}
-
-LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) {
- LIST *tmp;
-
- for (tmp = head; tmp && tmp->next; tmp = tmp->next);
-
- if (tmp) {
- tmp->next = p_new(LIST, 1);
- tmp = tmp->next;
- } else
- head = tmp = p_new(LIST, 1);
-
- tmp->data = p_new(char, len);
- if (len)
- memcpy (tmp->data, data, len);
- tmp->next = NULL;
- return head;
-}
-
-void mutt_free_list (LIST ** list) {
- LIST *p;
-
- if (!list)
- return;
- while (*list) {
- p = *list;
- *list = (*list)->next;
- p_delete(&p->data);
- p_delete(&p);
- }
-}
+++ /dev/null
-/*
- * Copyright notice from original mutt:
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
- *
- * This file is part of mutt-ng, see http://www.muttng.org/.
- * It's licensed under the GNU General Public License,
- * please see the file GPL in the top level source directory.
- */
-#ifndef _MUTT_LIST_H
-#define _MUTT_LIST_H
-
-typedef struct list_t {
- char *data;
- struct list_t *next;
-} LIST;
-
-#define mutt_new_list() p_new(LIST, 1)
-void mutt_free_list (LIST **);
-
-LIST *mutt_copy_list (LIST *);
-
-/* add an element to a list */
-LIST *mutt_add_list (LIST*, const char*);
-LIST *mutt_add_list_n (LIST*, const void*, size_t len);
-
-#endif /* !_MUTT_LIST_H */
#include <lib-lib/buffer.h>
#include <lib-lib/hash.h>
+#include <lib-lib/list.h>
#include "rfc822.h"
-#include "list.h"
#include "charset.h"
#include "lib/rx.h"