1 Return-Path: <dmitry.kurochkin@gmail.com>
\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 B83D8431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 25 Dec 2011 15:40:45 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id bglNPG7swhvX for <notmuch@notmuchmail.org>;
\r
17 Sun, 25 Dec 2011 15:40:45 -0800 (PST)
\r
18 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
19 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 149F0431FB6
\r
22 for <notmuch@notmuchmail.org>; Sun, 25 Dec 2011 15:40:44 -0800 (PST)
\r
23 Received: by wibhq2 with SMTP id hq2so5051930wib.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 25 Dec 2011 15:40:43 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type;
\r
28 bh=Tk4hQXiMEPsanJ4hPAMsiZeFUtqIOUUnP0Uw0rWR2Y0=;
\r
29 b=bup5Vdx4r4lTFNIN60MIdV+MgcFDx6lD6S6Dcfxhma12G1U1M5txXKx/vCW5NCQp7E
\r
30 JiP1cqL+FlS928+AUnSDsGkDv2DBa78Z32KjNSIffH4o/huRH5+BdtTwKMAwumPQV1h/
\r
31 +ys79sCn02JwtnAvY5a4GddfMWdHu24l28bNA=
\r
32 Received: by 10.180.19.106 with SMTP id d10mr49658931wie.2.1324856443766;
\r
33 Sun, 25 Dec 2011 15:40:43 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id fy5sm52303194wib.7.2011.12.25.15.40.42
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sun, 25 Dec 2011 15:40:42 -0800 (PST)
\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
39 To: Austin Clements <amdragon@MIT.EDU>
\r
40 Subject: Re: [PATCH 3/4] Utility function to seek in MIME trees in depth-first
\r
42 In-Reply-To: <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> <20111224034603.GC1927@mit.edu>
\r
47 User-Agent: Notmuch/0.10.2+116~g4c449d4 (http://notmuchmail.org) Emacs/23.3.1
\r
48 (x86_64-pc-linux-gnu)
\r
49 Date: Mon, 26 Dec 2011 03:39:57 +0400
\r
50 Message-ID: <87pqfc1ar6.fsf@gmail.com>
\r
52 Content-Type: text/plain; charset=us-ascii
\r
53 Cc: notmuch@notmuchmail.org
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Sun, 25 Dec 2011 23:40:45 -0000
\r
68 On Fri, 23 Dec 2011 22:46:19 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
\r
69 > Quoth Dmitry Kurochkin on Dec 10 at 3:43 pm:
\r
70 > > On Fri, 9 Dec 2011 14:54:27 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
\r
71 > > > This function matches how we number parts for the --part argument to
\r
72 > > > show. It will allow us to jump directly to the desired part, rather
\r
73 > > > than traversing the entire tree and carefully tracking whether or not
\r
74 > > > we're "in the zone".
\r
76 > > > mime-node.c | 25 +++++++++++++++++++++++++
\r
77 > > > notmuch-client.h | 5 +++++
\r
78 > > > 2 files changed, 30 insertions(+), 0 deletions(-)
\r
80 > > > diff --git a/mime-node.c b/mime-node.c
\r
81 > > > index a8e4a59..207818e 100644
\r
82 > > > --- a/mime-node.c
\r
83 > > > +++ b/mime-node.c
\r
84 > > > @@ -232,3 +232,28 @@ mime_node_child (const mime_node_t *parent, int child)
\r
85 > > > g_type_name (G_OBJECT_TYPE (parent->part)));
\r
89 > > > +static mime_node_t *
\r
90 > > > +_mime_node_seek_dfs_walk (mime_node_t *node, int *n)
\r
92 > > > + mime_node_t *ret = NULL;
\r
96 > > Can we move declarations below the if (which does not need them)? I
\r
97 > > always have troubles remembering if (recent enough) C standard allows
\r
98 > > that or it is a GCC extension. FWIW in the previous patch there are
\r
99 > > declarations in the middle of a block, e.g.:
\r
102 > > out->is_signed = TRUE;
\r
104 > > GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify
\r
105 > > (GMIME_MULTIPART_SIGNED (part), out->ctx->cryptoctx, &err);
\r
107 > > So either we can move these declarations to where they are needed, or we
\r
108 > > should fix it in _mime_node_create().
\r
110 > Since prevailing notmuch style seems to be top-declarations, I fixed
\r
111 > up _mime_node_create instead (personally I prefer C99-style
\r
112 > declarations, but *shrug*).
\r
115 If there is any code which already uses C99-style declarations, then we
\r
116 should use them in the new code IMO. Perhaps whether to use C99-style
\r
117 declarations or not should be a coding style requirement.
\r
122 > > > + if (*n <= 0)
\r
124 > > Comment for mime_node_seek_dfs() says that the function returns the node
\r
125 > > itself for n = 0, but does not say anything about n < 0. I would expect
\r
126 > > the function to return NULL for n < 0. In any case, the comment below
\r
127 > > should probably mention what happens for n < 0;
\r
129 > Good point. I made it return NULL for n < 0. I think this logically
\r
130 > falls under "Returns NULL if there is no such part."
\r
132 > > > + return node;
\r
134 > > > + *n = *n - 1;
\r
136 > > Perhaps *n -= 1? Or even --(*n)?
\r
138 > Changed to *n -= 1.
\r
140 > > > + for (i = 0; i < node->children && !ret; i++) {
\r
142 > > Consider s/i++/++i/.
\r
144 > notmuch uses i++ remarkably consistently, so I left this.
\r