From: Jameson Graef Rollins Date: Mon, 20 Aug 2012 01:52:43 +0000 (+1700) Subject: [PATCH 04/11] lib: remove no longer needed author-specific thread functions X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=00a1e6121b4b091661b7bb982cc6fdefb6686518;p=notmuch-archives.git [PATCH 04/11] lib: remove no longer needed author-specific thread functions --- diff --git a/ac/b7d056e521530994a3f6a8efda181cf544670a b/ac/b7d056e521530994a3f6a8efda181cf544670a new file mode 100644 index 000000000..c9c4e71e6 --- /dev/null +++ b/ac/b7d056e521530994a3f6a8efda181cf544670a @@ -0,0 +1,169 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id D4159431FCF + for ; Sun, 19 Aug 2012 18:53:08 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 4wgZRT-EVDdG for ; + Sun, 19 Aug 2012 18:53:06 -0700 (PDT) +Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu + [131.215.239.19]) + by olra.theworths.org (Postfix) with ESMTP id B5FB2431FAE + for ; Sun, 19 Aug 2012 18:53:06 -0700 (PDT) +Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) + by earth-doxen-postvirus (Postfix) with ESMTP id 57BE666E00DF + for ; Sun, 19 Aug 2012 18:53:06 -0700 (PDT) +X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new +Received: from finestructure.net (unknown [76.89.192.57]) + (Authenticated sender: jrollins) + by earth-doxen-submit (Postfix) with ESMTP id 516EF66E00DE + for ; Sun, 19 Aug 2012 18:53:04 -0700 (PDT) +Received: by finestructure.net (Postfix, from userid 1000) + id D14928E6; Sun, 19 Aug 2012 18:53:03 -0700 (PDT) +From: Jameson Graef Rollins +To: Notmuch Mail +Subject: [PATCH 04/11] lib: remove no longer needed author-specific thread + functions +Date: Sun, 19 Aug 2012 18:52:43 -0700 +Message-Id: <1345427570-26518-5-git-send-email-jrollins@finestructure.net> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1345427570-26518-4-git-send-email-jrollins@finestructure.net> +References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net> + <1345427570-26518-2-git-send-email-jrollins@finestructure.net> + <1345427570-26518-3-git-send-email-jrollins@finestructure.net> + <1345427570-26518-4-git-send-email-jrollins@finestructure.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 20 Aug 2012 01:53:09 -0000 + +The _add_author, _add_matched_author, and +_resolve_thread_authors_string functions have been replaced by the +more generic _address functions that utilize the new +notmuch_thread_addresses_t. +--- + lib/thread.cc | 91 --------------------------------------------------------- + 1 file changed, 91 deletions(-) + +diff --git a/lib/thread.cc b/lib/thread.cc +index b53ccb0..757e143 100644 +--- a/lib/thread.cc ++++ b/lib/thread.cc +@@ -143,97 +143,6 @@ _resolve_thread_addresses_string (notmuch_thread_addresses_t *addresses) + } + } + +-/* Add each author of the thread to the thread's authors_hash and to +- * the thread's authors_array. */ +-static void +-_thread_add_author (notmuch_thread_t *thread, +- const char *author) +-{ +- char *author_copy; +- +- if (author == NULL) +- return; +- +- if (g_hash_table_lookup_extended (thread->authors_hash, +- author, NULL, NULL)) +- return; +- +- author_copy = talloc_strdup (thread, author); +- +- g_hash_table_insert (thread->authors_hash, author_copy, NULL); +- +- g_ptr_array_add (thread->authors_array, author_copy); +-} +- +-/* Add each matched author of the thread to the thread's +- * matched_authors_hash and to the thread's matched_authors_array. */ +-static void +-_thread_add_matched_author (notmuch_thread_t *thread, +- const char *author) +-{ +- char *author_copy; +- +- if (author == NULL) +- return; +- +- if (g_hash_table_lookup_extended (thread->matched_authors_hash, +- author, NULL, NULL)) +- return; +- +- author_copy = talloc_strdup (thread, author); +- +- g_hash_table_insert (thread->matched_authors_hash, author_copy, NULL); +- +- g_ptr_array_add (thread->matched_authors_array, author_copy); +-} +- +-/* Construct an authors string from matched_authors_array and +- * authors_array. The string contains matched authors first, then +- * non-matched authors (with the two groups separated by '|'). Within +- * each group, authors are listed in date order. */ +-static void +-_resolve_thread_authors_string (notmuch_thread_t *thread) +-{ +- unsigned int i; +- char *author; +- int first_non_matched_author = 1; +- +- /* First, list all matched authors in date order. */ +- for (i = 0; i < thread->matched_authors_array->len; i++) { +- author = (char *) g_ptr_array_index (thread->matched_authors_array, i); +- if (thread->authors) +- thread->authors = talloc_asprintf (thread, "%s, %s", +- thread->authors, +- author); +- else +- thread->authors = author; +- } +- +- /* Next, append any non-matched authors that haven't already appeared. */ +- for (i = 0; i < thread->authors_array->len; i++) { +- author = (char *) g_ptr_array_index (thread->authors_array, i); +- if (g_hash_table_lookup_extended (thread->matched_authors_hash, +- author, NULL, NULL)) +- continue; +- if (first_non_matched_author) { +- thread->authors = talloc_asprintf (thread, "%s| %s", +- thread->authors, +- author); +- } else { +- thread->authors = talloc_asprintf (thread, "%s, %s", +- thread->authors, +- author); +- } +- +- first_non_matched_author = 0; +- } +- +- g_ptr_array_free (thread->authors_array, TRUE); +- thread->authors_array = NULL; +- g_ptr_array_free (thread->matched_authors_array, TRUE); +- thread->matched_authors_array = NULL; +-} +- + /* clean up the ugly "Lastname, Firstname" format that some mail systems + * (most notably, Exchange) are creating to be "Firstname Lastname" + * To make sure that we don't change other potential situations where a +-- +1.7.10.4 +