From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B00C3A0471 for ; Thu, 18 Jul 2019 02:48:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF7704D27; Thu, 18 Jul 2019 02:48:32 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 399D52BE1 for ; Thu, 18 Jul 2019 02:48:28 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id t16so11691865pfe.11 for ; Wed, 17 Jul 2019 17:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZpBjrOtCmw2GHEvi4Mm+NmlrCugLddmyXCS13mXxICw=; b=NbQ7kOKApjjh+ZgsPAMkD2SDDhQXd4sAAh7JcvoXrCiisI66BjTVmTkVesvWjYUOLe IY1teVrXI9cFbfyoVaQXDJTxdsazpL51JkPtQtM0O+8bvcaE93EqekaWDgdD9t5p75pP yoFgIBEw7bcBVDN3ylkTgfqqpgm/51AdJWumkvSnW46MlfxQPauqvyZoFY9cALpnVSUi McvwXg0m2i81aZEl7A1mTTZENrgMeH15uab0ufKEYD6ZF9Y0c7hbUMSgr1mMrf2AB7mg ChVbrFOprpxD7i3zCbor1sXEeepAKCIoK9bboUkCblgjyOg0QuzlXgIjhjalHYdaucmE ul0Q== 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; bh=ZpBjrOtCmw2GHEvi4Mm+NmlrCugLddmyXCS13mXxICw=; b=BLyMgqKDHs9OERHi2DQxNLmHjhYdd8RF6g+hakOtFtlx9VqMMpxMxDG32WUVwo7xd5 i1y2wy0Az+NjxADFYMGKLBlc80sWPretHcp+TsNebiUS0F6C3chdsztLXgLzcDG3qfq0 9uOeOj4pQ0lrtqEl4pv2njiW0qjJ5jwyGlPloWmQJWgrdOBa9MifI7PUo5opoRK7Z9El akkgVbHlG1sNYlKpAdE6a27FAYrT0mWjXiV4dLGNgnEtmL0Mxo28DP/ihXuBP6AkOt8U 5kRIkNeqwHMjyL39KQywzTGwnbRRZ1driCu+0mgv3LTzTDvuZi0f5Tv38PM4dic3Ap5I aFgA== X-Gm-Message-State: APjAAAUriiFO+KiyM8kPMu0vw69PpXPFXqZVNpi18CiOqauCfcR8sUmB liVpAhhuHojlFJJGeD+d5BKrNH2d X-Google-Smtp-Source: APXvYqy6dhxyS61dCLNmFosW+rnvuOgMG3j9dveQQvZHgSDtS5954UnRV1qVmRFVUYnJ1XHFRRtDJQ== X-Received: by 2002:a17:90a:bb01:: with SMTP id u1mr47013660pjr.92.1563410907178; Wed, 17 Jul 2019 17:48:27 -0700 (PDT) Received: from xps13.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 131sm30459808pfx.57.2019.07.17.17.48.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 17 Jul 2019 17:48:25 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 17 Jul 2019 17:48:20 -0700 Message-Id: <20190718004822.25431-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190718004822.25431-1-stephen@networkplumber.org> References: <20190716172741.21399-1-stephen@networkplumber.org> <20190718004822.25431-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 1/3] cfgfile: remove unnecessary initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" No need to initialize variable if it is immediately overwritten. It is better style not do unnecessary initialization with modern tools since it lets compiler and other static checkers detect uninitialized data. Signed-off-by: Stephen Hemminger --- lib/librte_cfgfile/rte_cfgfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index f8e7627a5169..1ef298592fa5 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -160,9 +160,9 @@ struct rte_cfgfile * rte_cfgfile_load_with_params(const char *filename, int flags, const struct rte_cfgfile_parameters *params) { - char buffer[CFG_NAME_LEN + CFG_VALUE_LEN + 4] = {0}; + char buffer[CFG_NAME_LEN + CFG_VALUE_LEN + 4]; int lineno = 0; - struct rte_cfgfile *cfg = NULL; + struct rte_cfgfile *cfg; if (rte_cfgfile_check_params(params)) return NULL; @@ -174,7 +174,7 @@ rte_cfgfile_load_with_params(const char *filename, int flags, cfg = rte_cfgfile_create(flags); while (fgets(buffer, sizeof(buffer), f) != NULL) { - char *pos = NULL; + char *pos; size_t len = strnlen(buffer, sizeof(buffer)); lineno++; if ((len >= sizeof(buffer) - 1) && (buffer[len-1] != '\n')) { @@ -260,7 +260,7 @@ struct rte_cfgfile * rte_cfgfile_create(int flags) { int i; - struct rte_cfgfile *cfg = NULL; + struct rte_cfgfile *cfg; cfg = malloc(sizeof(*cfg)); -- 2.17.1