[balsa] send: Use g_strsplit_set()
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] send: Use g_strsplit_set()
- Date: Tue, 18 Aug 2020 15:19:28 +0000 (UTC)
commit 528b80548ba821a6d5d61fb0ef190f869ce29e52
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue Aug 18 11:17:40 2020 -0400
send: Use g_strsplit_set()
instead of our own parser, now that we require a new enough glib.
libbalsa/send.c | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
---
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 18b72c4da..834193034 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -1205,26 +1205,6 @@ get_mailbox_names(GList *list,
}
-/* We could have used g_strsplit_set(s, "/;", 3) but it is not
- * available in older glib. */
-static gchar **
-parse_content_type(const char *content_type)
-{
- gchar **ret = g_new0(gchar *, 3);
- char *delim, *slash = strchr(content_type, '/');
- if (!slash) {
- ret[0] = g_strdup(content_type);
- return ret;
- }
- ret[0] = g_strndup(content_type, slash - content_type);
- slash++;
- for (delim = slash; *delim && *delim != ';' && *delim != ' '; delim++) {
- }
- ret[1] = g_strndup(slash, delim - slash);
- return ret;
-}
-
-
static LibBalsaMsgCreateResult
libbalsa_message_create_mime_message(LibBalsaMessage *message,
gboolean flow,
@@ -1265,7 +1245,7 @@ libbalsa_message_create_mime_message(LibBalsaMessage *message,
gchar **mime_type;
if (body->content_type != NULL) {
- mime_type = parse_content_type(body->content_type);
+ mime_type = g_strsplit_set(body->content_type, "/;", 3);
} else {
const gchar *mt = libbalsa_vfs_get_mime_type(body->file_uri);
mime_type = g_strsplit(mt, "/", 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]