[PATCH 2/3] Made notmuch_config_get_new_tags() use notmuch_talloc_g_key_file_get_string_list().

Subject:[PATCH 2/3] Made notmuch_config_get_new_tags() use notmuch_talloc_g_key_file_get_string_list().

Date:Wed, 14 Sep 2011 00:32:03 +0300

To:notmuch@notmuchmail.org

Cc:Tomi Ollila

From:tomi.ollila@iki.fi


From: Tomi Ollila <tomi.ollila@iki.fi>

---
 notmuch-config.c |   26 +++++---------------------
 1 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/notmuch-config.c b/notmuch-config.c
index 706f481..648639b 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -606,29 +606,13 @@ const char **
 notmuch_config_get_new_tags (notmuch_config_t *config,
 			     size_t *length)
 {
-    char **tags;
-    size_t tags_length;
-    unsigned int i;
-
     if (config->new_tags == NULL) {
-	tags = g_key_file_get_string_list (config->key_file,
-					   "new", "tags",
-					   &tags_length, NULL);
-	if (tags) {
-	    config->new_tags = talloc_size (config,
-					    sizeof (char *) *
-					    (tags_length + 1));
-	    for (i = 0; i < tags_length; i++)
-		config->new_tags[i] = talloc_strdup (config->new_tags,
-						     tags[i]);
-	    config->new_tags[i] = NULL;
-
-	    g_strfreev (tags);
-
-	    config->new_tags_length = tags_length;
-	}
+	config->new_tags = notmuch_talloc_g_key_file_get_string_list(
+	    config,
+	    config->key_file,
+	    "new", "tags",
+	    &config->new_tags_length, NULL);
     }
-
     *length = config->new_tags_length;
     return config->new_tags;
 }
-- 
1.7.3.4


Thread: