RE: Reply all - issue
[notmuch-archives.git] / 89 / 6f54247a69116c80444514764d003452635954
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 92A11429E25\r
6         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 03:44:13 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \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 WBY0V6+GGZA6 for <notmuch@notmuchmail.org>;\r
17         Sat, 10 Dec 2011 03:44:11 -0800 (PST)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (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 543EA431FB6\r
22         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 03:44:11 -0800 (PST)\r
23 Received: by bkat8 with SMTP id t8so4092685bka.26\r
24         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 03:44:08 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=fR0KfrGdU4UJ+gVbfzI5Uc39RkYGVKLGRVeGtlrP/Ik=;\r
29         b=rApFqKHO9ZpYidoYTtQ5KxGMC/XGozmXPbeDe+qJzlWHums7w0fK8xIfATzBcYTUTX\r
30         ENn23zhT1xG7nYUZMnetSCj+jcbILESH83bnzyFpJ6Kf1nDGz969xzeubhjdmZUTtpyj\r
31         6ktVBPxCypEATDTFAqfm2mUGqO/WaZLDk1oJQ=\r
32 Received: by 10.204.128.130 with SMTP id k2mr5691320bks.7.1323517444209;\r
33         Sat, 10 Dec 2011 03:44:04 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id\r
35         fg16sm16533407bkb.16.2011.12.10.03.44.02\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Sat, 10 Dec 2011 03:44:02 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH 3/4] Utility function to seek in MIME trees in depth-first\r
41         order.\r
42 In-Reply-To: <1323460468-4030-4-git-send-email-amdragon@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 User-Agent: Notmuch/0.10.2+82~g96a629c (http://notmuchmail.org) Emacs/23.3.1\r
47         (x86_64-pc-linux-gnu)\r
48 Date: Sat, 10 Dec 2011 15:43:29 +0400\r
49 Message-ID: <87hb187iu6.fsf@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=us-ascii\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Sat, 10 Dec 2011 11:44:13 -0000\r
65 \r
66 On Fri,  9 Dec 2011 14:54:27 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
67 > This function matches how we number parts for the --part argument to\r
68 > show.  It will allow us to jump directly to the desired part, rather\r
69 > than traversing the entire tree and carefully tracking whether or not\r
70 > we're "in the zone".\r
71 > ---\r
72 >  mime-node.c      |   25 +++++++++++++++++++++++++\r
73 >  notmuch-client.h |    5 +++++\r
74 >  2 files changed, 30 insertions(+), 0 deletions(-)\r
75\r
76 > diff --git a/mime-node.c b/mime-node.c\r
77 > index a8e4a59..207818e 100644\r
78 > --- a/mime-node.c\r
79 > +++ b/mime-node.c\r
80 > @@ -232,3 +232,28 @@ mime_node_child (const mime_node_t *parent, int child)\r
81 >                       g_type_name (G_OBJECT_TYPE (parent->part)));\r
82 >      }\r
83 >  }\r
84 > +\r
85 > +static mime_node_t *\r
86 > +_mime_node_seek_dfs_walk (mime_node_t *node, int *n)\r
87 > +{\r
88 > +    mime_node_t *ret = NULL;\r
89 > +    int i;\r
90 > +\r
91 \r
92 Can we move declarations below the if (which does not need them)?  I\r
93 always have troubles remembering if (recent enough) C standard allows\r
94 that or it is a GCC extension.  FWIW in the previous patch there are\r
95 declarations in the middle of a block, e.g.:\r
96 \r
97         } else {\r
98             out->is_signed = TRUE;\r
99             ...\r
100             GMimeSignatureValidity *sig_validity = g_mime_multipart_signed_verify\r
101                 (GMIME_MULTIPART_SIGNED (part), out->ctx->cryptoctx, &err);\r
102 \r
103 So either we can move these declarations to where they are needed, or we\r
104 should fix it in _mime_node_create().\r
105 \r
106 > +    if (*n <= 0)\r
107 \r
108 Comment for mime_node_seek_dfs() says that the function returns the node\r
109 itself for n = 0, but does not say anything about n < 0.  I would expect\r
110 the function to return NULL for n < 0.  In any case, the comment below\r
111 should probably mention what happens for n < 0;\r
112 \r
113 > +     return node;\r
114 > +\r
115 > +    *n = *n - 1;\r
116 \r
117 Perhaps *n -= 1?  Or even --(*n)?\r
118 \r
119 > +    for (i = 0; i < node->children && !ret; i++) {\r
120 \r
121 Consider s/i++/++i/.\r
122 \r
123 Regards,\r
124   Dmitry\r
125 \r
126 > +     mime_node_t *child = mime_node_child (node, i);\r
127 > +     ret = _mime_node_seek_dfs_walk (child, n);\r
128 > +     if (!ret)\r
129 > +         talloc_free (child);\r
130 > +    }\r
131 > +    return ret;\r
132 > +}\r
133 > +\r
134 > +mime_node_t *\r
135 > +mime_node_seek_dfs (mime_node_t *node, int n)\r
136 > +{\r
137 > +    return _mime_node_seek_dfs_walk (node, &n);\r
138 > +}\r
139 > diff --git a/notmuch-client.h b/notmuch-client.h\r
140 > index fce1187..f215d4b 100644\r
141 > --- a/notmuch-client.h\r
142 > +++ b/notmuch-client.h\r
143 > @@ -318,5 +318,10 @@ mime_node_open (const void *ctx, notmuch_message_t *message,\r
144 >  mime_node_t *\r
145 >  mime_node_child (const mime_node_t *parent, int child);\r
146 >  \r
147 > +/* Return the nth child of node in a depth-first traversal.  If n is\r
148 > + * 0, returns node itself.  Returns NULL if there is no such part. */\r
149 > +mime_node_t *\r
150 > +mime_node_seek_dfs (mime_node_t *node, int n);\r
151 > +\r
152 >  #include "command-line-arguments.h"\r
153 >  #endif\r
154 > -- \r
155 > 1.7.7.3\r
156\r
157 > _______________________________________________\r
158 > notmuch mailing list\r
159 > notmuch@notmuchmail.org\r
160 > http://notmuchmail.org/mailman/listinfo/notmuch\r