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 3AAF4A0471 for ; Thu, 18 Jul 2019 19:18:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DE0DE325F; Thu, 18 Jul 2019 19:18:21 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 70F8814E8 for ; Thu, 18 Jul 2019 19:18:17 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id 19so12926380pfa.4 for ; Thu, 18 Jul 2019 10:18:17 -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=eTpnM5DBP2DH/NtiuQr5aYiVF+2w4T+bnVCytPBYXJbQOuPTRWrXKaEW4YIdrdC4iB hgyayS7PYrVXX22Rj02rRzs3yNefH5sgBzM7UqES36UijIIM1G0FNtTD7//EKBK8CHj/ RFsarzy84Q+Ts4Q4+ibXtKfM/beVTA228AZu5pV+c9WZzSa5MJy1zRlYg+aCrOa6fYaZ TaXhe+dHn6asAqvld5hvidvIuz/LTNdDa9+ZIQDNzXBjoWQFMM2ywiHty9TUHa2ZuDB+ 1ncFbhgwRskd21O4PigfgQMxvg0IqQCgIrFkUs84vNEZKTx1Pap83GfyLY9TUdH4B59v mzPQ== 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=ETA4VT2Al3iY+F2UF742uMgrvtzA8P8NZusHuANCmLo3TrTyFdqBEM6B0nAQ2ArujR O41k1kIwJmP7KbPu3W2o2eirTDqxk/4ujks+A3YPyKIRO+Ien9gzkg7yp4MmrmQDdLTS cGmNX9U/F/AOfaB8q8AKDXbhXyYUIPv73uxYSQmsQz574WzhXtdc2R6z6yHgPVTiNdYM FmeSr3MZyulkc2J1WwwnVY2/0WtyUa/ZjSfOoXVnxNNAr/IrN59cwAEgXg5iLf0dJHID IMxCi5kC/obCdP8G9tEtiXPzP5LD2DZTgXRoI8IN9Y/Zdwmpy2wxL+jsQQwwJ2FykSkq ocfQ== X-Gm-Message-State: APjAAAUUc8npe2GQkq0dxSE4Ham6uyRn+ViR4T/BBfZbxpEGudin/q1k /0VZkZWmEw8ZYumWRtnFpXzs7PyZ X-Google-Smtp-Source: APXvYqyxkCfVUkN9nAnMi6wehFz1fHD4XXnL3ZQzGF9/rsllU4Mn1pCjRNLYAVj3kBEI63fLHuCQiQ== X-Received: by 2002:a17:90a:dac3:: with SMTP id g3mr52002034pjx.45.1563470296325; Thu, 18 Jul 2019 10:18:16 -0700 (PDT) Received: from localhost.localdomain ([67.23.203.6]) by smtp.gmail.com with ESMTPSA id 137sm36038021pfz.112.2019.07.18.10.18.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 18 Jul 2019 10:18:15 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 18 Jul 2019 10:18:10 -0700 Message-Id: <20190718171812.3209-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190718171812.3209-1-stephen@networkplumber.org> References: <20190716172741.21399-1-stephen@networkplumber.org> <20190718171812.3209-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v3 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