1 Return-Path: <glasse@cs.rpi.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id B478F431E82
\r
6 for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:12:36 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.54 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_MED=-2.3,
\r
14 RCVD_IN_SORBS_WEB=0.614] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id YiUerY5Aj4f0 for <notmuch@notmuchmail.org>;
\r
18 Wed, 15 Feb 2012 14:12:35 -0800 (PST)
\r
19 Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu
\r
20 [128.113.126.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
21 (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS
\r
22 id 29B33431E62 for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:12:35 -0800
\r
25 S|91de1c178376ed50903de0e611ee3c2e43cd0ccf|2c8ecd09f629f4b4d3170c072856d3da
\r
26 X-Countries: Cameroon, United States
\r
27 X-SMTP-From: accepted <glasse@cs.rpi.edu> [195.24.209.20] [195.24.209.20]
\r
28 (localhost) {Cameroon}
\r
29 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=from
\r
30 :to:cc:subject:date:message-id:in-reply-to:references; s=
\r
31 default; i=glasse@cs.rpi.edu; t=1329343952; x=1329948752; l=2737;
\r
32 bh=Uq4pkiIyt5pJMHHl0sUA9WUPngU=; b=VPZk8SIWjcxsYrmJE9nWdS7
\r
33 Cl5iR+g5lXObJpZiOu7KnMhdfVJIsryzceuAK/PO1xUQ8rdrUQVP8QIpxwxWhe4x
\r
34 Xf/Fj1GvrMP4hnY6bDAIcDoR4gNDRxiE56TbMZ6zHQ1DQhSYU1Du9dy229wESEMq
\r
35 UB1roaWCWj1y2b6/JvIA=
\r
36 DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=from:to:cc
\r
37 :subject:date:message-id:in-reply-to:references; q=dns; s=
\r
38 default; b=oYB+8Flt9fGRaFPrt62cIbDsbmPG/HPHODwp/wrKtYAUkCKGhRAnp
\r
39 tyyfHHisw9y3PkOM8L6TvYm0B0iQdxFUSeX8vB2GFlfoYFynIIOKOcZMEvFtoY09
\r
40 HuFB6vc6w+TVEpm++2LOYWx7lx1Mri9HdOISVa6dao8FnECwuOoVOs=
\r
41 X-Spam-Info: -2.7; ALL_TRUSTED,AWL,BAYES_00
\r
42 X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5 (hard limit
\r
44 Authentication-Results: cliffclavin.cs.rpi.edu;
\r
45 DKIM=neutral (none) header.from=glasse@cs.rpi.edu;
\r
47 Mechanism '?all' matched) smtp.mail=glasse@cs.rpi.edu
\r
48 X-Auth-Passed: cliffclavin.cs.rpi.edu:q1FMCBqp008866 Auth:glasse
\r
49 X-Virus-Scanned-By: cliffclavin.cs.rpi.edu
\r
50 Received: from localhost ([195.24.209.20]) (authenticated bits=0)
\r
51 by cliffclavin.cs.rpi.edu (8.14.3/8.14.3) with ESMTP id q1FMCBqp008866
\r
52 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);
\r
53 Wed, 15 Feb 2012 17:12:24 -0500 (EST)
\r
54 (envelope-from glasse@cs.rpi.edu)
\r
55 From: Ethan Glasser-Camp <glasse@cs.rpi.edu>
\r
56 To: notmuch@notmuchmail.org
\r
57 Subject: [RFC PATCH 11/13] Add a close function to mailstore
\r
58 Date: Wed, 15 Feb 2012 17:02:04 -0500
\r
59 Message-Id: <1329343326-16410-12-git-send-email-glasse@cs.rpi.edu>
\r
60 X-Mailer: git-send-email 1.7.5.4
\r
61 In-Reply-To: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>
\r
62 References: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>
\r
63 X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25
\r
64 Cc: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Wed, 15 Feb 2012 22:12:36 -0000
\r
79 From: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
81 This is a useful way to signal to mailstores that the resources
\r
82 associated with an existing FILE* are no longer being used and they
\r
83 can be cleaned up. For maildir, of course, this is just a call to
\r
84 fclose(), but for other mailstores this might involve freeing memory
\r
85 or unlinking temporary files...
\r
87 Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
89 lib/mailstore.c | 17 ++++++++++++++++-
\r
90 lib/notmuch.h | 5 +++++
\r
91 2 files changed, 21 insertions(+), 1 deletions(-)
\r
93 diff --git a/lib/mailstore.c b/lib/mailstore.c
\r
94 index b4d512d..51c2710 100644
\r
95 --- a/lib/mailstore.c
\r
96 +++ b/lib/mailstore.c
\r
98 typedef struct _notmuch_mailstore {
\r
99 notmuch_status_t (*constructor) (void **data, va_list args);
\r
100 FILE *(*open) (struct _notmuch_mailstore *mailstore, const char *filename);
\r
101 + int (*close) (struct _notmuch_mailstore *mailstore, FILE *);
\r
102 int (*rename) (struct _notmuch_mailstore *mailstore, const char *old_filename,
\r
103 const char *new_filename);
\r
105 @@ -44,6 +45,13 @@ _maildir_open_function (unused (notmuch_mailstore_t *mailstore),
\r
109 +_maildir_close_function (unused (notmuch_mailstore_t *mailstore),
\r
112 + return fclose (file);
\r
116 _maildir_rename_function (unused (notmuch_mailstore_t *mailstore),
\r
117 const char *old_filename, const char *new_filename)
\r
119 @@ -68,7 +76,8 @@ _maildir_rename_function (unused (notmuch_mailstore_t *mailstore),
\r
122 notmuch_mailstore_maildir = { _maildir_constructor,
\r
123 - _maildir_open_function, _maildir_rename_function,
\r
124 + _maildir_open_function, _maildir_close_function,
\r
125 + _maildir_rename_function,
\r
128 _notmuch_mailstore *
\r
129 @@ -93,6 +102,12 @@ notmuch_mailstore_rename (notmuch_mailstore_t *mailstore, const char *old_filena
\r
130 return mailstore->rename (mailstore, old_filename, new_filename);
\r
134 +notmuch_mailstore_close (notmuch_mailstore_t *mailstore, FILE *file)
\r
136 + return mailstore->close (mailstore, file);
\r
140 notmuch_mailstore_construct (notmuch_mailstore_t *mailstore, ...)
\r
142 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
143 index 7f48507..d760d4f 100644
\r
144 --- a/lib/notmuch.h
\r
145 +++ b/lib/notmuch.h
\r
146 @@ -423,6 +423,11 @@ notmuch_mailstore_get_by_name (const char *name);
\r
148 notmuch_mailstore_open (notmuch_mailstore_t *mailstore, const char *filename);
\r
150 +/* Signal that a filename is no longer being used; get rid of its resources.
\r
153 +notmuch_mailstore_close (notmuch_mailstore_t *mailstore, FILE *file);
\r
155 /* Rename a file. This is used to update maildir tags and can safely
\r
156 * be a NO-OP for non-filesystem mailstores.
\r