From patchwork Thu Oct 15 21:06:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7409931 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F377BEEA4 for ; Thu, 15 Oct 2015 21:12:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF50C2069F for ; Thu, 15 Oct 2015 21:12:00 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F099F2069D for ; Thu, 15 Oct 2015 21:11:59 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E1E32605A5; Thu, 15 Oct 2015 14:11:59 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ml01.01.org (Postfix) with ESMTP id EA85E605A5 for ; Thu, 15 Oct 2015 14:11:58 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 15 Oct 2015 14:11:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,687,1437462000"; d="scan'208";a="812066266" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by fmsmga001.fm.intel.com with ESMTP; 15 Oct 2015 14:11:58 -0700 Subject: [PATCH 06/11] ndctl: kill unused code From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 15 Oct 2015 17:06:16 -0400 Message-ID: <20151015210616.22046.7231.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151015210544.22046.31483.stgit@dwillia2-desk3.jf.intel.com> References: <20151015210544.22046.31483.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Static analysis points out that nothing uses 'cmd' in ndctl.c::main(). Signed-off-by: Dan Williams --- ndctl.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/ndctl.c b/ndctl.c index 8d806d3adb30..242832af8249 100644 --- a/ndctl.c +++ b/ndctl.c @@ -168,32 +168,9 @@ static void handle_internal_command(int argc, const char **argv) } } -static const char *to_argv0_path(const char *argv0) -{ - const char *slash, *argv0_path; - - if (!argv0 || !*argv0) - return NULL; - slash = argv0 + strlen(argv0); - - while (argv0 <= slash && !is_dir_sep(*slash)) - slash--; - - if (slash >= argv0) { - argv0_path = strndup(argv0, slash - argv0); - return argv0_path ? slash + 1 : NULL; - } - - return argv0; -} - int main(int argc, const char **argv) { - const char *cmd = to_argv0_path(argv[0]); - ndctl_usage_string = init_usage_string(); - if (!cmd) - cmd = "ndctl-help"; /* Look for flags.. */ argv++; @@ -209,10 +186,9 @@ int main(int argc, const char **argv) /* printf("\n %s\n\n", ndctl_more_info_string); TODO */ goto out; } - cmd = argv[0]; handle_internal_command(argc, argv); fprintf(stderr, "Failed to run command '%s': %s\n", - cmd, strerror(errno)); + argv[0], strerror(errno)); out: return 1; }