+/*
+ * 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>
* It's licensed under the GNU General Public License,
* please see the file GPL in the top level source directory.
*/
+
#ifndef _MUTT_BUFFER_H
#define _MUTT_BUFFER_H
-#include "mutt.h"
+#include <lib-lib/str.h>
+
+typedef struct {
+ char *data; /* pointer to data */
+ char *dptr; /* current read/write position */
+ size_t dsize; /* length of data */
+ int destroy; /* destroy `data' when done? */
+} BUFFER;
+
+BUFFER *mutt_buffer_init(BUFFER *);
+void mutt_buffer_free(BUFFER **);
+
+BUFFER *mutt_buffer_from(BUFFER *, const char *);
+int mutt_extract_token(BUFFER *, BUFFER *, int);
+
+void mutt_buffer_add(BUFFER *, const char *, size_t);
+static inline void mutt_buffer_addstr(BUFFER *b, const char *s) {
+ mutt_buffer_add(b, s, m_strlen(s));
+}
-int mutt_extract_token (BUFFER *, BUFFER *, int);
-BUFFER *mutt_buffer_init (BUFFER *);
-BUFFER *mutt_buffer_from (BUFFER *, const char *);
-void mutt_buffer_free (BUFFER **);
-void mutt_buffer_add (BUFFER *, const char *, size_t);
-void mutt_buffer_addstr (BUFFER *, const char *);
-void mutt_buffer_addch (BUFFER *, char);
+static inline void mutt_buffer_addch(BUFFER *b, char c) {
+ mutt_buffer_add(b, &c, 1);
+}
#endif /* !_MUTT_BUFFER_H */