From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 9EA45429E25 for ; Fri, 9 Dec 2011 12:00:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KZMmXIPy0+35 for ; Fri, 9 Dec 2011 12:00:35 -0800 (PST) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0A4B1431FB6 for ; Fri, 9 Dec 2011 12:00:34 -0800 (PST) Received: by bkat8 with SMTP id t8so3562540bka.26 for ; Fri, 09 Dec 2011 12:00:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=6y7BNmkdU49JxlJZYVus7fWw76/0Ox1Ho/DSoN+Fybk=; b=J704yeo8A+vCX31YEbiMtQMmv8t6Cdwq4xsnZGNFa0MUX0JWkl6xVBvGeNA2eIW3jL pFZc82C3BHrIPDKXzoSYSh+9+79Cpef+TmO7JVSyCchvIS1bI7qnSrcacqaAd6MjIeH4 h69gZGi5zpIxmYsDedeFfkUwlHcIc+v3HLOew= Received: by 10.205.127.2 with SMTP id gy2mr3644351bkc.87.1323460832411; Fri, 09 Dec 2011 12:00:32 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id p13sm12345880bkd.4.2011.12.09.12.00.31 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 12:00:31 -0800 (PST) From: Dmitry Kurochkin To: Austin Clements , David Bremner Subject: Re: [PATCH 1/4] show: Pass notmuch_message_t instead of path to show_message_body. In-Reply-To: <20111209195426.GJ3190@mit.edu> References: <1322446871-14986-1-git-send-email-amdragon@mit.edu> <1323027100-10307-1-git-send-email-amdragon@mit.edu> <1323027100-10307-2-git-send-email-amdragon@mit.edu> <87ty597eh8.fsf@gmail.com> <20111209195426.GJ3190@mit.edu> User-Agent: Notmuch/0.10.2+82~g96a629c (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 09 Dec 2011 23:59:59 +0400 Message-ID: <87pqfx7by8.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:00:35 -0000 On Fri, 9 Dec 2011 14:54:26 -0500, Austin Clements wrote: > Quoth Dmitry Kurochkin on Dec 09 at 11:05 pm: > > On Sun, 4 Dec 2011 14:31:37 -0500, Austin Clements wrote: > > > } > > > > > > notmuch_status_t > > > -show_message_body (const char *filename, > > > +show_message_body (notmuch_message_t *message, > > > const notmuch_show_format_t *format, > > > notmuch_show_params_t *params) > > > > Is show_message_body() (or functions that it calls/would call) supposed > > to modify the message structure? If not, we should make it const. > > That would be nice, but lack of const in libnotmuch makes it difficult > to do this (for example, notmuch_message_get_filename, which > show_message_body calls, takes a non-const notmuch_message_t *). > > OTOH, since functions like notmuch_message_get_filename lazily compute > fields of notmuch_message_t and C has no equivalent of C++'s mutable, > it's not clear making the message const is even the right thing to do. > If there are fields that are computed lazily (I just did not know it), we can not make it const. The patch looks good. I think it can be pushed before the rest of the patches are reviewed/ready. Regards, Dmitry > > I would also make all pointers constant (i.e. const notmuch_message_t > > *const message), but I can not insist since it is not common in notmuch. > > > > Regards, > > Dmitry