Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DBEDE431FD0 for ; Fri, 9 Dec 2011 11:05:59 -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 5twdQCPY93rg for ; Fri, 9 Dec 2011 11:05:59 -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 3004F431FB6 for ; Fri, 9 Dec 2011 11:05:59 -0800 (PST) Received: by bkat8 with SMTP id t8so3503471bka.26 for ; Fri, 09 Dec 2011 11:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; bh=ZBBxHMds7DmNU1+Aon40Lqr+y3JMPJ4vKYUM0Lz3OlI=; b=KRPGBhix5qnW7d8rwy+I2bqrCBTN8wxWxxJEx8OYShrsFqa4Rij73hwNI04p8zChU2 O7mhWJN2tyRCgd1xq9ZJV7JZwnU5/nIVjsQpdXgJXCV5O2xH/bM/+mkHr/MziTayr5+L cVRdhEkZu9etGFuHZdJFGgcAe8aRMsXM4lVAQ= Received: by 10.204.148.76 with SMTP id o12mr4629961bkv.114.1323457557733; Fri, 09 Dec 2011 11:05:57 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id zv9sm12029944bkb.0.2011.12.09.11.05.55 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 11:05:56 -0800 (PST) From: Dmitry Kurochkin To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH 1/4] show: Pass notmuch_message_t instead of path to show_message_body. In-Reply-To: <1323027100-10307-2-git-send-email-amdragon@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> 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:05:23 +0400 Message-ID: <87ty597eh8.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 19:06:00 -0000 On Sun, 4 Dec 2011 14:31:37 -0500, Austin Clements wrote: > In addition to simplifying the code, we'll need the notmuch_message_t* > in show_message_body shortly. > --- > notmuch-client.h | 2 +- > notmuch-reply.c | 3 +-- > notmuch-show.c | 3 +-- > show-message.c | 3 ++- > 4 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/notmuch-client.h b/notmuch-client.h > index b50cb38..d7fb6ee 100644 > --- a/notmuch-client.h > +++ b/notmuch-client.h > @@ -162,7 +162,7 @@ char * > query_string_from_args (void *ctx, int argc, char *argv[]); > > 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); > > diff --git a/notmuch-reply.c b/notmuch-reply.c > index 7ac879f..f8d5f64 100644 > --- a/notmuch-reply.c > +++ b/notmuch-reply.c > @@ -546,8 +546,7 @@ notmuch_reply_format_default(void *ctx, > notmuch_message_get_header (message, "date"), > notmuch_message_get_header (message, "from")); > > - show_message_body (notmuch_message_get_filename (message), > - format, params); > + show_message_body (message, format, params); > > notmuch_message_destroy (message); > } > diff --git a/notmuch-show.c b/notmuch-show.c > index 603992a..1dee3aa 100644 > --- a/notmuch-show.c > +++ b/notmuch-show.c > @@ -753,8 +753,7 @@ show_message (void *ctx, > } > > if (format->part_content) > - show_message_body (notmuch_message_get_filename (message), > - format, params); > + show_message_body (message, format, params); > > if (params->part <= 0) { > fputs (format->body_end, stdout); > diff --git a/show-message.c b/show-message.c > index d83f04e..09fa607 100644 > --- a/show-message.c > +++ b/show-message.c > @@ -175,7 +175,7 @@ show_message_part (GMimeObject *part, > } > > 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. 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 > { > @@ -183,6 +183,7 @@ show_message_body (const char *filename, > GMimeParser *parser = NULL; > GMimeMessage *mime_message = NULL; > notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS; > + const char *filename = notmuch_message_get_filename (message); > FILE *file = NULL; > show_message_state_t state; > > -- > 1.7.5.4 >