Re: Flat search and threaded views
[notmuch-archives.git] / 70 / 0e9b183e9560abb35f879e3656fa1f65a2e304
1 Return-Path: <tomi.ollila@iki.fi>\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 D5233431FAF\r
6         for <notmuch@notmuchmail.org>; Sat, 27 Apr 2013 02:33:20 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 zK9mbM7l3GWh for <notmuch@notmuchmail.org>;\r
16         Sat, 27 Apr 2013 02:33:20 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id DD124431FAE\r
19         for <notmuch@notmuchmail.org>; Sat, 27 Apr 2013 02:33:19 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 2F4841001F0;\r
22         Sat, 27 Apr 2013 12:33:17 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Vladimir.Marek@oracle.com, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] don't store temporary value returned from c_str()\r
26 In-Reply-To: <1366405933-17223-1-git-send-email-Vladimir.Marek@oracle.com>\r
27 References: <1366405933-17223-1-git-send-email-Vladimir.Marek@oracle.com>\r
28 User-Agent: Notmuch/0.15.2+75~gd7fa7c4 (http://notmuchmail.org) Emacs/24.3.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Sat, 27 Apr 2013 12:33:16 +0300\r
34 Message-ID: <m2sj2cjp2b.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 Cc: Vladimir Marek <vlmarek@volny.cz>\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sat, 27 Apr 2013 09:33:21 -0000\r
51 \r
52 On Sat, Apr 20 2013, Vladimir.Marek@oracle.com wrote:\r
53 \r
54 > From: Vladimir Marek <vlmarek@volny.cz>\r
55 >\r
56 > This is causing problems when compiled by Oracle Studio. Memory pointed\r
57 > by (const char*)term was already changed once talloc_strdup was called.\r
58 \r
59 If that changes, I'd like to understand why (and stated in the commit\r
60 message). If that is clear to everyone else I will withdraw the question --\r
61 I am not too familiar with these iterators magic... :D\r
62 \r
63 Tomi\r
64 \r
65 >\r
66 > Signed-off-by: Vladimir Marek <vlmarek@volny.cz>\r
67 > ---\r
68 >  lib/message.cc |    9 ++++-----\r
69 >  1 files changed, 4 insertions(+), 5 deletions(-)\r
70 >\r
71 > diff --git a/lib/message.cc b/lib/message.cc\r
72 > index 8720c1b..8d329d1 100644\r
73 > --- a/lib/message.cc\r
74 > +++ b/lib/message.cc\r
75 > @@ -266,18 +266,17 @@ _notmuch_message_get_term (notmuch_message_t *message,\r
76 >                          const char *prefix)\r
77 >  {\r
78 >      int prefix_len = strlen (prefix);\r
79 > -    const char *term = NULL;\r
80 >      char *value;\r
81 >  \r
82 >      i.skip_to (prefix);\r
83 >  \r
84 > -    if (i != end)\r
85 > -     term = (*i).c_str ();\r
86 > +    if (i == end)\r
87 > +     return NULL;\r
88 >  \r
89 > -    if (!term || strncmp (term, prefix, prefix_len))\r
90 > +    if (strncmp ((*i).c_str(), prefix, prefix_len))\r
91 >       return NULL;\r
92 >  \r
93 > -    value = talloc_strdup (message, term + prefix_len);\r
94 > +    value = talloc_strdup (message, (*i).c_str() + prefix_len);\r
95 >  \r
96 >  #if DEBUG_DATABASE_SANITY\r
97 >      i++;\r
98 > -- \r
99 > 1.7.3.2\r
100 >\r
101 > _______________________________________________\r
102 > notmuch mailing list\r
103 > notmuch@notmuchmail.org\r
104 > http://notmuchmail.org/mailman/listinfo/notmuch\r