From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 032036DE0FA5 for ; Fri, 6 Jan 2017 12:15:08 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.192 X-Spam-Level: X-Spam-Status: No, score=-0.192 tagged_above=-999 required=5 tests=[AWL=-0.172, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6BVQMtF1_oTe for ; Fri, 6 Jan 2017 12:15:07 -0800 (PST) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by arlo.cworth.org (Postfix) with ESMTPS id 564F66DE0C67 for ; Fri, 6 Jan 2017 12:15:02 -0800 (PST) Received: by mail-lf0-f65.google.com with SMTP id v186so687861lfa.2 for ; Fri, 06 Jan 2017 12:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=1rGXAg+WBE/scNthoGQjD5wVJy7wiq4ndJZYgPgPbXY=; b=T746miQdAb3wmOsGybzihjbqXp1m/5dyKjLY6N/1pSMyToT2ZSgvafepTya0eq1O8+ Ii964guxfTKcWJOyEXZOkN0cE8wut62UbEyeKIola0M/0nxAqnl2p8ShY5wbIpJBiQYI S0h5FiMY+Nzvmn8ehriY7TnsVwF3yWbDzF6qktwtIf0epY4tjTlKSUHlzv8CJVIsE5FB O+jW0YoKxInwugoF/CveP6iI0t/mCZOvY/GoDDpF0lKAmir+S/XdYWkGHuwixv0nLGoe N2cLF6ikVyxmiyOWvSwjVlqjn5OyywmljE49UglZwf3y2RQrwJW/BefBvIR1CSicfA1V UNKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=1rGXAg+WBE/scNthoGQjD5wVJy7wiq4ndJZYgPgPbXY=; b=Yr+kJP5oSusQVDxdyulpcJ7fgiUf9fM8yu3aqa/b6yKNi0eK5EQ0N/dAoVkD0g8MUm yWgmnCD0X+4Yg7le7OAMTPF2/jYxJxLbTFqjK6kRLHdNiRkaIS9iViJgVonxy0O77LYd 8recVKXRc4eZinHf085cqQ+lstdVSCJEIRjSul/Y1pAldsI1zDPi65fxrVAbVi6UTcmi qcwq6a9FuWbqA6sio58A9RwxH6rWecH4Beuo9vMSH5WMnNEglqNSygunbRxwZkesjm+r f4e9zLJ5Cr5s4btE0gI9kx74JhV7O1ZcBkBLJGEmvMS/iTzsyZ49bxL2eJwjk/DYTXo9 AndA== X-Gm-Message-State: AIkVDXJYHk8zDPrn3yNU5h/SzDKG555BpM5BMybATjOvMil5udiqmk86hj0kGCDQxBnalA== X-Received: by 10.25.206.204 with SMTP id e195mr13766450lfg.94.1483733700440; Fri, 06 Jan 2017 12:15:00 -0800 (PST) Received: from localhost (mobile-access-bceec7-199.dhcp.inet.fi. [188.238.199.199]) by smtp.gmail.com with ESMTPSA id s64sm19227423lfs.38.2017.01.06.12.14.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jan 2017 12:14:59 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 6/9] cli/show: group --entire-thread option handling into one place Date: Fri, 6 Jan 2017 22:14:47 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 06 Jan 2017 20:15:08 -0000 The --entire-thread option handling is split around, making the logic harder to follow than necessary. Put it in one place. While at it, make the true/false values match notmuch_bool_t values for simplicity. No functional changes. --- notmuch-show.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 1032694edcd9..bddcb190e4cf 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -987,9 +987,9 @@ static const notmuch_show_format_t *formatters[] = { }; enum { - ENTIRE_THREAD_DEFAULT, - ENTIRE_THREAD_TRUE, - ENTIRE_THREAD_FALSE, + ENTIRE_THREAD_DEFAULT = -1, + ENTIRE_THREAD_FALSE = FALSE, + ENTIRE_THREAD_TRUE = TRUE, }; /* The following is to allow future options to be added more easily */ @@ -1087,9 +1087,11 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) * format=sexp. */ if (entire_thread == ENTIRE_THREAD_DEFAULT) { if (format == NOTMUCH_FORMAT_JSON || format == NOTMUCH_FORMAT_SEXP) - entire_thread = ENTIRE_THREAD_TRUE; + params.entire_thread = TRUE; else - entire_thread = ENTIRE_THREAD_FALSE; + params.entire_thread = FALSE; + } else { + params.entire_thread = entire_thread; } if (!params.output_body) { @@ -1108,11 +1110,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[]) fprintf (stderr, "Warning: --include-html only implemented for format=json and format=sexp\n"); } - if (entire_thread == ENTIRE_THREAD_TRUE) - params.entire_thread = TRUE; - else - params.entire_thread = FALSE; - query_string = query_string_from_args (config, argc-opt_index, argv+opt_index); if (query_string == NULL) { fprintf (stderr, "Out of memory\n"); -- 2.11.0