From patchwork Thu Mar 2 19:29:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allain Legacy X-Patchwork-Id: 21149 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 0CD94F923; Thu, 2 Mar 2017 20:30:39 +0100 (CET) Received: from mail.windriver.com (mail.windriver.com [147.11.1.11]) by dpdk.org (Postfix) with ESMTP id C60D72C60 for ; Thu, 2 Mar 2017 20:29:49 +0100 (CET) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id v22JTmUF016167 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 2 Mar 2017 11:29:48 -0800 (PST) Received: from yow-cgts4-lx.wrs.com (128.224.145.137) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 2 Mar 2017 11:29:47 -0800 From: Allain Legacy To: , CC: , Date: Thu, 2 Mar 2017 14:29:27 -0500 Message-ID: <1488482971-170522-2-git-send-email-allain.legacy@windriver.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488482971-170522-1-git-send-email-allain.legacy@windriver.com> References: <1488482971-170522-1-git-send-email-allain.legacy@windriver.com> MIME-Version: 1.0 X-Originating-IP: [128.224.145.137] Subject: [dpdk-dev] [PATCH 1/5] cfgfile: configurable comment character 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" The current cfgfile comment character is hardcoded to ';'. This commit introduces a configuration attribute to allow an application to select a different character. This is to ease adoption by applications that have an existing configuration file which may use a different comment character. For instance, an application may already have a configuration file that uses the '#' as the comment character. Signed-off-by: Allain Legacy --- config/common_base | 1 + lib/librte_cfgfile/rte_cfgfile.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/common_base b/config/common_base index aeee13e..32a42d7 100644 --- a/config/common_base +++ b/config/common_base @@ -477,6 +477,7 @@ CONFIG_RTE_LIBRTE_TIMER_DEBUG=n # Compile librte_cfgfile # CONFIG_RTE_LIBRTE_CFGFILE=y +CONFIG_RTE_LIBRTE_CFGFILE_COMMENT_CHAR=';' # # Compile librte_cmdline diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 829109a..603dd73 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -116,7 +116,7 @@ struct rte_cfgfile * "Check if line too long\n", lineno); goto error1; } - pos = memchr(buffer, ';', sizeof(buffer)); + pos = memchr(buffer, RTE_LIBRTE_CFGFILE_COMMENT_CHAR, len); if (pos != NULL) { *pos = '\0'; len = pos - buffer;