From patchwork Wed Oct 19 13:26:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 684115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3szXmJ5N24z9sCZ; Thu, 20 Oct 2016 00:27:12 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bwqtj-00017C-Mi; Wed, 19 Oct 2016 13:27:11 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bwqtG-0000y0-Pm for fwts-devel@lists.ubuntu.com; Wed, 19 Oct 2016 13:26:42 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1bwqtG-0007pS-F3; Wed, 19 Oct 2016 13:26:42 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 4/7] lib: fwts_pipeio: remove redundant initializations of file to NULL Date: Wed, 19 Oct 2016 14:26:36 +0100 Message-Id: <20161019132639.16524-5-colin.king@canonical.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161019132639.16524-1-colin.king@canonical.com> References: <20161019132639.16524-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King The open assigns file to the open descriptor, so no need to initialize it to NULL. Cleans up 2 cppcheck style warnings: src/lib/src/fwts_pipeio.c:397: (style) Variable 'file' is reassigned a value before the old one has been used. src/lib/src/fwts_pipeio.c:429: (style) Variable 'file' is reassigned a value before the old one has been used Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_pipeio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c index ecd4e33..0ee1de1 100644 --- a/src/lib/src/fwts_pipeio.c +++ b/src/lib/src/fwts_pipeio.c @@ -390,7 +390,7 @@ int fwts_write_string_file( const char *file_name, const char *str) { - FILE *file = NULL; + FILE *file; int ret; errno = 0; @@ -422,7 +422,7 @@ int fwts_read_file_first_line( const char *file_name, char **line) { - FILE *file = NULL; + FILE *file; char buffer[LINE_MAX], *temp; errno = 0;