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 E0D45A0471 for ; Tue, 16 Jul 2019 19:27:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DE8B91B950; Tue, 16 Jul 2019 19:27:55 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 2558D3195 for ; Tue, 16 Jul 2019 19:27:52 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id 4so3500488pld.10 for ; Tue, 16 Jul 2019 10:27:52 -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 :mime-version:content-transfer-encoding; bh=dcNLr0jir3vesF0krOzdG75kFT8Y5ChbO3SsnV4VN5w=; b=tMrb4Hbd72pDFNWH6Qzvkw6sheaxlMRpjbt/z+OxAMiqrOmQVg6j67yERYSBJLsAA7 fc7Yihwh5tohwby8JLRowJrv4kQw6SJa3wyEvGoV6VHRiO1i/DliRF6RvG5AOBYFLJIi DRflWBA9zRGMpjJqOsrcC/uaVAilYLhcEIibedOQ/hMCH5/m7UI4RFYoyr43IpZ2rAL7 MOvDALhgMyZdBOWziOVWeax4W5890f4lzUSnPLPN+/fbEdSDAR6zeOvPR2GkeTrQDCiK 8qpIoLfYxqQ+b3LHqX9LtPQonb+qQY4OyV14zh6n+9g2MzEgPj80I/sDEwMEgTp/Cgvz IsFw== 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:mime-version:content-transfer-encoding; bh=dcNLr0jir3vesF0krOzdG75kFT8Y5ChbO3SsnV4VN5w=; b=e3G8vxVzyu7HkKICaHlXS8SKOyVWFaP9QX5lOlCLmBDOb4xyR6cMUAKrRogvtTLb0C h8rOVkiJKZS8E7MY286OoWSLaK5im4HixLqXwXtiHzreMGxnszZHep/xhhyM51nVHcRv 7mzMg88S1YkxZ13iimxtzVUfDu0lz4wD6GvgenhqumWBRV0zEypT76AeGQ6PzlgKY5IE ntruQ3O7FWliQIEPf9o3XMI95Rk9kmsDvCOWrhWI27DDR29OEhF/jtFbE1jteVvNEb4c Xl8T4Y7uGLjXb5tA+KrXAfm9oy3lwbtlMUpPDYooKH9DhkRlZYXudlOZVcb1w1mPjnau mtkQ== X-Gm-Message-State: APjAAAXLK7RKOlFcnYupgP7XXvQ57B3i1xgjtQeI+SuWdRW+jcRRRErd N/FCLXlC4zkfN2ik4B8Zcvw= X-Google-Smtp-Source: APXvYqw6APnWUGsg1CPtqY3fBf3wMZoa5t+1bDveeNzZcsqd8+L61WlR1LP/1/BJo4P224YoMlclaw== X-Received: by 2002:a17:902:e2:: with SMTP id a89mr37494646pla.210.1563298071393; Tue, 16 Jul 2019 10:27:51 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id m6sm21173049pfb.151.2019.07.16.10.27.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 10:27:50 -0700 (PDT) From: Stephen Hemminger To: cristian.dumitrescu@intel.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 16 Jul 2019 10:27:39 -0700 Message-Id: <20190716172741.21399-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190716172741.21399-1-stephen@networkplumber.org> References: <20190716172741.21399-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 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.20.1