1 Return-Path: <anthony.j.towns@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 43BB44196F2
\r
6 for <notmuch@notmuchmail.org>; Mon, 12 Apr 2010 22:59:27 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.499 tagged_above=-999 required=5
\r
12 tests=[BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
\r
13 FREEMAIL_FROM=0.001] autolearn=ham
\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 G5FnqAvteGCy for <notmuch@notmuchmail.org>;
\r
17 Mon, 12 Apr 2010 22:59:25 -0700 (PDT)
\r
18 Received: from mail-gy0-f181.google.com (mail-gy0-f181.google.com
\r
20 by olra.theworths.org (Postfix) with ESMTP id E3C93431FC1
\r
21 for <notmuch@notmuchmail.org>; Mon, 12 Apr 2010 22:59:24 -0700 (PDT)
\r
22 Received: by gyg8 with SMTP id 8so3474792gyg.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 12 Apr 2010 22:59:24 -0700 (PDT)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
25 h=domainkey-signature:mime-version:sender:received:in-reply-to
\r
26 :references:date:x-google-sender-auth:received:message-id:subject
\r
27 :from:to:cc:content-type:content-transfer-encoding;
\r
28 bh=yeDmNraJ1Aun117bESXzfJuWAHHj27OybHs/CJypg8U=;
\r
29 b=To0GQ/ZtzLhSw4uVJCzen/wc3JkKuh7ITGCs/eXTPxPDkL2jS8HZWtIZQ4FxU9U7dd
\r
30 fWPbwv2l3E/U+ZRRO02OznxxAl4186pacGAtKj7iRLbiIPCbgyZj82PFDDIQUvLCROzy
\r
31 emF9T2CmS5L+AKekDTAnWpiDbAxW9RsPSC7jU=
\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
33 h=mime-version:sender:in-reply-to:references:date
\r
34 :x-google-sender-auth:message-id:subject:from:to:cc:content-type
\r
35 :content-transfer-encoding;
\r
36 b=dwwJXVCSbV1h/qhXzh/hJU2ZydO+Blo1uMkTL8yG+lz26Oz+ZSm2LbTbc2XNfMJNVf
\r
37 BjRWDU4Ww1oFxVBoTBQ5Ksd5F5VqdMpzulw3OFETT/vbRe/0qhFnH2tURg/7jKil9JxH
\r
38 viobp/ZNRYHmAMPw+QhU9UfJ3YjieL4upcCho=
\r
40 Sender: anthony.j.towns@gmail.com
\r
41 Received: by 10.90.114.1 with HTTP; Mon, 12 Apr 2010 22:59:24 -0700 (PDT)
\r
42 In-Reply-To: <m3eiikc7rc.fsf@x200.gr8dns.org>
\r
43 References: <m3eiikc7rc.fsf@x200.gr8dns.org>
\r
44 Date: Tue, 13 Apr 2010 15:59:24 +1000
\r
45 X-Google-Sender-Auth: 08b2a26383bfd99d
\r
46 Received: by 10.90.19.22 with SMTP id 22mr2299378ags.67.1271138364341; Mon, 12
\r
47 Apr 2010 22:59:24 -0700 (PDT)
\r
48 Message-ID: <h2r87b3a4191004122259ofc26c84dk7ebc53c250ffb263@mail.gmail.com>
\r
49 Subject: Re: [PATCH] Add simplistic reimplementation of strcasestr to compat
\r
51 From: Anthony Towns <aj@erisian.com.au>
\r
52 To: Dirk Hohndel <hohndel@infradead.org>
\r
53 Content-Type: text/plain; charset=ISO-8859-1
\r
54 Content-Transfer-Encoding: quoted-printable
\r
55 Cc: notmuch@notmuchmail.org
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Tue, 13 Apr 2010 05:59:28 -0000
\r
70 On Tue, Apr 13, 2010 at 14:10, Dirk Hohndel <hohndel@infradead.org> wrote:
\r
71 > +/* the semantic here actually puzzles me:
\r
72 > + =A0 how can haystack be const char * - yet the return value is char *
\r
73 > + =A0 after all, it points to a sub-string of haystack... */
\r
75 Dunno if this is a question from the original source, but the answer
\r
76 if anyone's interested is probably because C doesn't have templates --
\r
77 you'd ideally like to have it treated as:
\r
79 char *strcasestr(char *haystack, const char *needle);
\r
81 for when you're doing a search and replace on the needle (say), and:
\r
83 const char *strcasestr(const char *haystack, const char *needle);
\r
85 for when you're doing a search for the needle in something you can't
\r
86 modify. But C isn't clever enough to let you say that with just one
\r
87 function (and no fancy #defines), so you have to drop some of the
\r
88 typechecking with the (char*) cast on the return value if you want to
\r
89 handle both use cases, without the compiler complaining about
\r
90 const->non-const conversions in otherwise correct code in one case or
\r
97 Anthony Towns <aj@erisian.com.au>
\r