[dpdk-dev] [PATCH 1/5] cfgfile: configurable comment character
Allain Legacy
allain.legacy at windriver.com
Thu Mar 2 20:29:27 CET 2017
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 <allain.legacy at windriver.com>
---
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;
--
1.8.3.1
More information about the dev
mailing list