[PATCH] cli: use designated initializer to initialize add_files_state
authorJani Nikula <jani@nikula.org>
Fri, 25 Sep 2015 18:47:35 +0000 (21:47 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:37 +0000 (14:49 -0700)
c7/b9b7b5872cf0bd265ebee3b75308cbea3b922c [new file with mode: 0644]

diff --git a/c7/b9b7b5872cf0bd265ebee3b75308cbea3b922c b/c7/b9b7b5872cf0bd265ebee3b75308cbea3b922c
new file mode 100644 (file)
index 0000000..52e93d3
--- /dev/null
@@ -0,0 +1,111 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id B6F846DE0924\r
+ for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 11:47:57 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.521\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.521 tagged_above=-999 required=5 tests=[AWL=0.199,\r
+  RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id YYRrfe4EnDiV for <notmuch@notmuchmail.org>;\r
+ Fri, 25 Sep 2015 11:47:56 -0700 (PDT)\r
+Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com\r
+ [209.85.212.178])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id B117B6DE02D2\r
+ for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 11:47:55 -0700 (PDT)\r
+Received: by wiclk2 with SMTP id lk2so31076924wic.1\r
+ for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 11:47:53 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
+ bh=wJkOMnk94WYIFe6F7GiEPhSBNnbXJ+yIKeEWFvCerC8=;\r
+ b=UcQg76tx74zzxdzF/AJacwJhd+3DihXSK6Rfllp4OaebDIu+ZyAv8CN6GHnnPfcyhy\r
+ YhEaJgRuAX+m0rKpTNW9NlDahSOU5TTKL1P3/pv1wGw8BWVRu9o4HKBUERUxnabH0Hup\r
+ aVGHw0nopzwEw1ksqawzZjHwhT9yArMXz76HxGb4kYlIGiqhxxQ/0GqEZq4lubisLtS4\r
+ nJTJG2ZBB7ALW//LD0HI84pFns+8j1gpB4VqZK3VHc4hd6xeaC8Hc3JlsZKZR8ODdiBp\r
+ bmD9tLl4gKR6hlBsDg6mQCVBSbwzA1/LbkJcnJOrAe/evZD7jY7QGqmJ+cCzaE8N2xsf\r
+ yOZA==\r
+X-Gm-Message-State:\r
+ ALoCoQktkxjT0RVv499eFLQUDyrj9az6hGIy5bge58rHB7DiMOE9nOn4VqUuDZf1XyoB6v+FZiR4\r
+X-Received: by 10.180.230.197 with SMTP id ta5mr4896059wic.26.1443206873666;\r
+ Fri, 25 Sep 2015 11:47:53 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee63-221.dhcp.inet.fi.\r
+ [188.238.99.221])\r
+ by smtp.gmail.com with ESMTPSA id h7sm4659383wjz.7.2015.09.25.11.47.52\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Fri, 25 Sep 2015 11:47:52 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] cli: use designated initializer to initialize add_files_state\r
+Date: Fri, 25 Sep 2015 21:47:35 +0300\r
+Message-Id: <1443206855-21701-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 25 Sep 2015 18:47:57 -0000\r
+\r
+The side effect is that all of add_files_state will be initialized to\r
+zero, removing any lingering doubt that some of it might not be\r
+initialized. It's not a small struct, and the initialization is\r
+scattered around a bit, so this makes the code more readable.\r
+---\r
+ notmuch-new.c | 13 +++++--------\r
+ 1 file changed, 5 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 33645349cd5f..442a2f0ae288 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -933,7 +933,11 @@ int\r
+ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+ {\r
+     notmuch_database_t *notmuch;\r
+-    add_files_state_t add_files_state;\r
++    add_files_state_t add_files_state = {\r
++      .verbosity = VERBOSITY_NORMAL,\r
++      .debug = FALSE,\r
++      .output_is_a_tty = isatty (fileno (stdout)),\r
++    };\r
+     struct timeval tv_start;\r
+     int ret = 0;\r
+     struct stat st;\r
+@@ -948,10 +952,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+     notmuch_bool_t quiet = FALSE, verbose = FALSE;\r
+     notmuch_status_t status;\r
\r
+-    add_files_state.verbosity = VERBOSITY_NORMAL;\r
+-    add_files_state.debug = FALSE;\r
+-    add_files_state.output_is_a_tty = isatty (fileno (stdout));\r
+-\r
+     notmuch_opt_desc_t options[] = {\r
+       { NOTMUCH_OPT_BOOLEAN,  &quiet, "quiet", 'q', 0 },\r
+       { NOTMUCH_OPT_BOOLEAN,  &verbose, "verbose", 'v', 0 },\r
+@@ -1086,9 +1086,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+     talloc_free (dot_notmuch_path);\r
+     dot_notmuch_path = NULL;\r
\r
+-    add_files_state.processed_files = 0;\r
+-    add_files_state.added_messages = 0;\r
+-    add_files_state.removed_messages = add_files_state.renamed_messages = 0;\r
+     gettimeofday (&add_files_state.tv_start, NULL);\r
\r
+     add_files_state.removed_files = _filename_list_create (config);\r
+-- \r
+2.1.4\r
+\r