if (tags)
{
- struct ListHead hsplit = mutt_str_split(tags, ' ');
+ struct ListHead hsplit = mutt_list_str_split(tags, ' ');
struct ListNode *np = NULL;
STAILQ_FOREACH(np, &hsplit, entries)
{
return true;
}
+
+/**
+ * mutt_list_str_split - Split a string into a list using a separator char
+ * @param src String to split
+ * @param sep Word separator
+ */
+struct ListHead mutt_list_str_split(const char *src, char sep)
+{
+ struct ListHead head = STAILQ_HEAD_INITIALIZER(head);
+
+ if (!src || !*src)
+ return head;
+
+ while (true)
+ {
+ const char *start = src;
+ while (*src && (*src != sep))
+ src++;
+
+ mutt_list_insert_tail(&head, mutt_str_substr_dup(start, src));
+
+ if (!*src)
+ break;
+
+ src++;
+ }
+
+ return head;
+}
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);
+struct ListHead mutt_list_str_split(const char *src, char sep);
#endif /* MUTT_LIB_LIST_H */
#include <string.h>
#include <strings.h>
#include "exit.h"
-#include "list.h"
#include "logging.h"
#include "memory.h"
#include "message.h"
-#include "queue.h"
#include "string2.h"
#ifdef HAVE_SYSEXITS_H
#include <sysexits.h>
return NULL;
}
-/**
- * mutt_str_split - return list of the words of the strings
- * @param src String to split
- * @param sep Word separator
- */
-struct ListHead mutt_str_split(const char *src, char sep)
-{
- struct ListHead head = STAILQ_HEAD_INITIALIZER(head);
-
- if (!src || !*src)
- return head;
-
- while (true)
- {
- const char *start = src;
- while (*src && (*src != sep))
- src++;
-
- mutt_list_insert_tail(&head, mutt_str_substr_dup(start, src));
-
- if (!*src)
- break;
-
- src++;
- }
-
- return head;
-}
-
#ifdef HAVE_VASPRINTF
/**
* mutt_str_asprintf - Format a string, allocating space as necessary
const char *mutt_str_rstrnstr(const char *haystack, size_t haystack_length, const char *needle);
char * mutt_str_skip_email_wsp(const char *s);
char * mutt_str_skip_whitespace(const char *p);
-struct ListHead mutt_str_split(const char *src, char sep);
int mutt_str_strcasecmp(const char *a, const char *b);
size_t mutt_str_startswith(const char *str, const char *prefix, enum CaseSensitivity cs);
const char *mutt_str_strcasestr(const char *haystack, const char *needle);