1 Return-Path: <amdragon@mit.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 525C6429E25
\r
6 for <notmuch@notmuchmail.org>; Fri, 23 Dec 2011 19:45:21 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id cCAf0-dApj5y for <notmuch@notmuchmail.org>;
\r
16 Fri, 23 Dec 2011 19:45:20 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id C3D11431FB6
\r
20 for <notmuch@notmuchmail.org>; Fri, 23 Dec 2011 19:45:20 -0800 (PST)
\r
21 X-AuditID: 1209190c-b7fad6d000000920-f1-4ef54ad02546
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 8D.2C.02336.0DA45FE4; Fri, 23 Dec 2011 22:45:20 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id pBO3jJKg008667;
\r
27 Fri, 23 Dec 2011 22:45:20 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBO3jIEB017741
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Fri, 23 Dec 2011 22:45:19 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1ReIYt-0002FY-EW; Fri, 23 Dec 2011 22:46:19 -0500
\r
37 Date: Fri, 23 Dec 2011 22:46:19 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
40 Subject: Re: [PATCH 3/4] Utility function to seek in MIME trees in
\r
42 Message-ID: <20111224034603.GC1927@mit.edu>
\r
43 References: <1323027100-10307-1-git-send-email-amdragon@mit.edu>
\r
44 <1323460468-4030-1-git-send-email-amdragon@mit.edu>
\r
45 <1323460468-4030-4-git-send-email-amdragon@mit.edu>
\r
46 <87hb187iu6.fsf@gmail.com>
\r
48 Content-Type: text/plain; charset=us-ascii
\r
49 Content-Disposition: inline
\r
50 In-Reply-To: <87hb187iu6.fsf@gmail.com>
\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
52 X-Brightmail-Tracker:
\r
53 H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IRYrdT0b3g9dXP4P53AYurW/vZLa7fnMns
\r
54 wOSxc9Zddo9nq24xBzBFcdmkpOZklqUW6dslcGXMuu1csFC44v6dnUwNjBf4uhg5OCQETCQa
\r
55 j5V0MXICmWISF+6tZ+ti5OIQEtjHKNH/r50dJCEksIFR4s8xHojESSaJ6VfeMUI4SxglOh/1
\r
56 MYFUsQioSvRf/8QGYrMJaEhs27+cEcQWETCUuHXxFTOIzSwgLfHtdzNYvbBAuMSE9XPANvAK
\r
57 aEtMeH0HauhJRon5q+4yQyQEJU7OfMIC0awlcePfSyaQs0EGLf/HARLmFFCXOLJpNtgcUQEV
\r
58 iSknt7FNYBSahaR7FpLuWQjdCxiZVzHKpuRW6eYmZuYUpybrFicn5uWlFuka6uVmluilppRu
\r
59 YgQFNackzw7GNweVDjEKcDAq8fA2Lv3iJ8SaWFZcmXuIUZKDSUmU96rbVz8hvqT8lMqMxOKM
\r
60 +KLSnNTiQ4wSHMxKIryaSUDlvCmJlVWpRfkwKWkOFiVxXhWtd35CAumJJanZqakFqUUwWRkO
\r
61 DiUJ3ieeQEMFi1LTUyvSMnNKENJMHJwgw3mAhnMDk4AQb3FBYm5xZjpE/hSjLsfiVRvOMgqx
\r
62 5OXnpUqJ874DGSQAUpRRmgc3B5aMXjGKA70lzNsDMooHmMjgJr0CWsIEtCTGCOSD4pJEhJRU
\r
63 A2NF3Z5NOW8tz2+XWsOmFcl8Kbjz17nSA9wrZPe4HX3DvCxuZcGKN2l25Ta39r++P81hwspS
\r
64 B/nkHykdunUP4y46bDdLWcDxyGbmTQ7B5lNlh403nAtZ+8hf/zvLV/Ec83hlCaG5e+8+eRxp
\r
65 U53R0nUqun/24j1BK1qiEvZf70u9wfp280qn7fxKLMUZiYZazEXFiQD2x+kxIQMAAA==
\r
66 Cc: notmuch@notmuchmail.org
\r
67 X-BeenThere: notmuch@notmuchmail.org
\r
68 X-Mailman-Version: 2.1.13
\r
70 List-Id: "Use and development of the notmuch mail system."
\r
71 <notmuch.notmuchmail.org>
\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
75 List-Post: <mailto:notmuch@notmuchmail.org>
\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
78 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
79 X-List-Received-Date: Sat, 24 Dec 2011 03:45:21 -0000
\r
81 Quoth Dmitry Kurochkin on Dec 10 at 3:43 pm:
\r
82 > On Fri, 9 Dec 2011 14:54:27 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
\r
83 > > This function matches how we number parts for the --part argument to
\r
84 > > show. It will allow us to jump directly to the desired part, rather
\r
85 > > than traversing the entire tree and carefully tracking whether or not
\r
86 > > we're "in the zone".
\r
88 > > mime-node.c | 25 +++++++++++++++++++++++++
\r
89 > > notmuch-client.h | 5 +++++
\r
90 > > 2 files changed, 30 insertions(+), 0 deletions(-)
\r
92 > > diff --git a/mime-node.c b/mime-node.c
\r
93 > > index a8e4a59..207818e 100644
\r
94 > > --- a/mime-node.c
\r
95 > > +++ b/mime-node.c
\r
96 > > @@ -232,3 +232,28 @@ mime_node_child (const mime_node_t *parent, int child)
\r
97 > > g_type_name (G_OBJECT_TYPE (parent->part)));
\r
101 > > +static mime_node_t *
\r
102 > > +_mime_node_seek_dfs_walk (mime_node_t *node, int *n)
\r
104 > > + mime_node_t *ret = NULL;
\r
108 > Can we move declarations below the if (which does not need them)? I
\r
109 > always have troubles remembering if (recent enough) C standard allows
\r
110 > that or it is a GCC extension. FWIW in the previous patch there are
\r
111 > declarations in the middle of a block, e.g.:
\r
114 > out->is_signed = TRUE;
\r
116 > GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify
\r
117 > (GMIME_MULTIPART_SIGNED (part), out->ctx->cryptoctx, &err);
\r
119 > So either we can move these declarations to where they are needed, or we
\r
120 > should fix it in _mime_node_create().
\r
122 Since prevailing notmuch style seems to be top-declarations, I fixed
\r
123 up _mime_node_create instead (personally I prefer C99-style
\r
124 declarations, but *shrug*).
\r
128 > Comment for mime_node_seek_dfs() says that the function returns the node
\r
129 > itself for n = 0, but does not say anything about n < 0. I would expect
\r
130 > the function to return NULL for n < 0. In any case, the comment below
\r
131 > should probably mention what happens for n < 0;
\r
133 Good point. I made it return NULL for n < 0. I think this logically
\r
134 falls under "Returns NULL if there is no such part."
\r
140 > Perhaps *n -= 1? Or even --(*n)?
\r
142 Changed to *n -= 1.
\r
144 > > + for (i = 0; i < node->children && !ret; i++) {
\r
146 > Consider s/i++/++i/.
\r
148 notmuch uses i++ remarkably consistently, so I left this.
\r