[PATCH 3/9] cli/show: consistently use format_sel for checking the format

Subject:[PATCH 3/9] cli/show: consistently use format_sel for checking the format

Date:Fri, 6 Jan 2017 22:14:44 +0200

To:notmuch@notmuchmail.org

Cc:

From:Jani Nikula


The mixed use of the format pointer and the format selection variables
is confusing. Add more clarity by using format_sel alone. No
functional changes.
---
 notmuch-show.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 273b5d3ba3ac..b8e45f187360 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1093,7 +1093,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
     /* Default is entire-thread = FALSE except for format=json and
      * format=sexp. */
     if (entire_thread == ENTIRE_THREAD_DEFAULT) {
-	if (format == &format_json || format == &format_sexp)
+	if (format_sel == NOTMUCH_FORMAT_JSON ||
+	    format_sel == NOTMUCH_FORMAT_SEXP)
 	    entire_thread = ENTIRE_THREAD_TRUE;
 	else
 	    entire_thread = ENTIRE_THREAD_FALSE;
@@ -1104,7 +1105,8 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
 	    fprintf (stderr, "Warning: --body=false is incompatible with --part > 0. Disabling.\n");
 	    params.output_body = TRUE;
 	} else {
-	    if (format != &format_json && format != &format_sexp)
+	    if (format_sel != NOTMUCH_FORMAT_JSON &&
+		format_sel != NOTMUCH_FORMAT_SEXP)
 		fprintf (stderr,
 			 "Warning: --body=false only implemented for format=json and format=sexp\n");
 	}
-- 
2.11.0


Thread: