From 650fa84cf079b3d177a0fde6c2cd19338379f9b2 Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Thu, 16 Feb 2012 17:01:59 +1900 Subject: [PATCH] [RFC PATCH 06/13] Pass mailstore to _notmuch_message_index_file --- a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 | 142 ++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 diff --git a/a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 b/a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 new file mode 100644 index 000000000..f4119b2ea --- /dev/null +++ b/a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 @@ -0,0 +1,142 @@ +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 BC12F429E43 + for ; Wed, 15 Feb 2012 14:09:03 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.54 +X-Spam-Level: +X-Spam-Status: No, score=-0.54 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_MED=-2.3, + RCVD_IN_SORBS_WEB=0.614] 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 zTEYsFfCblKZ for ; + Wed, 15 Feb 2012 14:09:00 -0800 (PST) +Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu + [128.113.126.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS + id 18D69431E62 for ; Wed, 15 Feb 2012 14:09:00 -0800 + (PST) +X-Hash: + S|aae69e273e498d5de66d9e3bf68ac0c0606b5478|d4c21c0d0b80a5462346b7b26b45ba37 +X-Countries: Cameroon, United States +X-SMTP-From: accepted [195.24.209.20] [195.24.209.20] + (localhost) {Cameroon} +DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=from + :to:cc:subject:date:message-id:in-reply-to:references; s= + default; i=glasse@cs.rpi.edu; t=1329343738; x=1329948538; l=2068; + bh=0k/K3RQun05tWxgXhC3iFXolbX4=; b=myzeyUcltgZD6sw3FXw8s8j + DWkQwAll8BNvVzPp5Tkpgn3hkUoxWV1b/U+sDm8ei2FpD/KyYz2VugaZJmED3lZk + F8XBtv1HMACSDhfJma6URSSgBmPbMDjkNQXJz0OvI2TEZAax//afm0m9LbSiefo1 + 0+dsYU3VF98FQhyeg6Gg= +DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=from:to:cc + :subject:date:message-id:in-reply-to:references; q=dns; s= + default; b=nVT88z7gJqsDfxH/kAE1glE5gD9mn3G7+QcOqNh3KdYZ0/i4upbbQ + ZFCBdDtoppRpE4wtv46ZY0DOv9TPJdXlVMChrPidmwCWqiqhslBkdIT93x+Zos3L + Jvub5o88Uvv/62EikywOSrXNGGos1JhEiDPKm8iERtQrs+99yATEzg= +X-Spam-Info: -2.7; ALL_TRUSTED,AWL,BAYES_00 +X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5 (hard limit + 15) +Authentication-Results: cliffclavin.cs.rpi.edu; + DKIM=neutral (none) header.from=glasse@cs.rpi.edu; + SPF=neutral (mfrom; + Mechanism '?all' matched) smtp.mail=glasse@cs.rpi.edu +X-Auth-Passed: cliffclavin.cs.rpi.edu:q1FM8PIt008817 Auth:glasse +X-Virus-Scanned-By: cliffclavin.cs.rpi.edu +Received: from localhost ([195.24.209.20]) (authenticated bits=0) + by cliffclavin.cs.rpi.edu (8.14.3/8.14.3) with ESMTP id q1FM8PIt008817 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); + Wed, 15 Feb 2012 17:08:44 -0500 (EST) + (envelope-from glasse@cs.rpi.edu) +From: Ethan Glasser-Camp +To: notmuch@notmuchmail.org +Subject: [RFC PATCH 06/13] Pass mailstore to _notmuch_message_index_file +Date: Wed, 15 Feb 2012 17:01:59 -0500 +Message-Id: <1329343326-16410-7-git-send-email-glasse@cs.rpi.edu> +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu> +References: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu> +X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25 +Cc: Ethan Glasser-Camp +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: Wed, 15 Feb 2012 22:09:03 -0000 + +From: Ethan Glasser-Camp + +This is the last place where fopen(2) was used and had to be replaced. + +Signed-off-by: Ethan Glasser-Camp +--- + lib/database.cc | 2 +- + lib/index.cc | 5 +++-- + lib/notmuch-private.h | 3 ++- + 3 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/lib/database.cc b/lib/database.cc +index ff44e76..0ed4412 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -1743,7 +1743,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch, + date = notmuch_message_file_get_header (message_file, "date"); + _notmuch_message_set_header_values (message, date, from, subject); + +- _notmuch_message_index_file (message, filename); ++ _notmuch_message_index_file (notmuch->mailstore, message, filename); + } else { + ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; + } +diff --git a/lib/index.cc b/lib/index.cc +index d8f8b2b..54b8f73 100644 +--- a/lib/index.cc ++++ b/lib/index.cc +@@ -409,7 +409,8 @@ _index_mime_part (notmuch_message_t *message, + } + + notmuch_status_t +-_notmuch_message_index_file (notmuch_message_t *message, ++_notmuch_message_index_file (notmuch_mailstore_t *mailstore, ++ notmuch_message_t *message, + const char *filename) + { + GMimeStream *stream = NULL; +@@ -426,7 +427,7 @@ _notmuch_message_index_file (notmuch_message_t *message, + initialized = 1; + } + +- file = fopen (filename, "r"); ++ file = notmuch_mailstore_open (mailstore, filename); + if (! file) { + fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno)); + ret = NOTMUCH_STATUS_FILE_ERROR; +diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h +index 2589928..d93891e 100644 +--- a/lib/notmuch-private.h ++++ b/lib/notmuch-private.h +@@ -313,7 +313,8 @@ notmuch_message_get_author (notmuch_message_t *message); + /* index.cc */ + + notmuch_status_t +-_notmuch_message_index_file (notmuch_message_t *message, ++_notmuch_message_index_file (notmuch_mailstore_t *mailstore, ++ notmuch_message_t *message, + const char *filename); + + /* message-file.c */ +-- +1.7.5.4 + -- 2.26.2