Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2e / d15c9e70bce1a05c27b30bf2869e5269a9169b
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 A5D12431FAF\r
6         for <notmuch@notmuchmail.org>; Thu,  2 May 2013 11:03:26 -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 hUl6GlmkfTh2 for <notmuch@notmuchmail.org>;\r
16         Thu,  2 May 2013 11:03:23 -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 D753D431FB6\r
19         for <notmuch@notmuchmail.org>; Thu,  2 May 2013 11:03:22 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 8AFA4100044;\r
22         Thu,  2 May 2013 21:03:20 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Vladimir Marek <Vladimir.Marek@Oracle.COM>\r
25 Subject: Re: [PATCH 01/24] lib/message.cc: stale pointer bug\r
26 In-Reply-To: <20130502134530.GB23259@pub.cz.oracle.com>\r
27 References: <1367444021-2757-1-git-send-email-Vladimir.Marek@oracle.com>\r
28         <m2sj25snsk.fsf@guru.guru-group.fi>\r
29         <20130502134530.GB23259@pub.cz.oracle.com>\r
30 User-Agent: Notmuch/0.15.2+75~gd7fa7c4 (http://notmuchmail.org) Emacs/24.3.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Thu, 02 May 2013 21:03:20 +0300\r
36 Message-ID: <m238u5tg2f.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\r
39 Cc: notmuch@notmuchmail.org, Vladimir Marek <vlmarek@volny.cz>\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Thu, 02 May 2013 18:03:26 -0000\r
53 \r
54 On Thu, May 02 2013, Vladimir Marek <Vladimir.Marek@Oracle.COM> wrote:\r
55 \r
56 >> >      int prefix_len = strlen (prefix);\r
57 >> > -    const char *term = NULL;\r
58 >> > +    std::string term;\r
59 >> >      char *value;\r
60 >> >  \r
61 >> >      i.skip_to (prefix);\r
62 >> >  \r
63 >> > -    if (i != end)\r
64 >> > -  term = (*i).c_str ();\r
65 >> > +    if (i == end)\r
66 >> > +  return NULL;\r
67 >> >  \r
68 >> > -    if (!term || strncmp (term, prefix, prefix_len))\r
69 >> > +    term = *i;\r
70 >> \r
71 >> ... hmm, a raii(?) solution above would be std::string term = *i;\r
72 >\r
73 > I'm not sure what's raii (I'm not very good at c++ ...), but I guess you\r
74 > mean to use 'std::string term = *i;' to avoid copy constructor. That\r
75 > surely is a good idea. Let me rework the patch!\r
76 \r
77 I am not that smart (i.e. avoid copy constructor it might be, I don't\r
78 know...) I am lousy in c++. I attempter to mean\r
79 http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization\r
80 in a sense that when variable is introduced it is also initialized\r
81 to useful value (so that no-one accidentally add code between introduction\r
82 and initialization). \r
83  \r
84 Anyway, if you rework the patch then we can vote which version to\r
85 apply (yeah, sure >;)\r
86 \r
87 > -- \r
88 >       Vlad\r
89 \r
90 Tomi\r