From: Kuba Kozak <kubax.kozak@intel.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com, deepak.k.jain@intel.com,
michalx.k.jastrzebski@intel.com, jacekx.piasecki@intel.com
Subject: [dpdk-dev] [PATCH v6 1/5] cfgfile: remove EAL dependency
Date: Fri, 22 Sep 2017 11:44:46 +0200 [thread overview]
Message-ID: <1506073490-45399-2-git-send-email-kubax.kozak@intel.com> (raw)
In-Reply-To: <1506073490-45399-1-git-send-email-kubax.kozak@intel.com>
From: Jacek Piasecki <jacekx.piasecki@intel.com>
This patch removes the dependency to EAL in cfgfile library.
Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/Makefile | 3 +--
lib/librte_cfgfile/Makefile | 1 +
lib/librte_cfgfile/rte_cfgfile.c | 29 +++++++++++++++++------------
3 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/lib/Makefile b/lib/Makefile
index 86caba1..1080a95 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -32,6 +32,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
DIRS-y += librte_compat
+DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
DEPDIRS-librte_ring := librte_eal
@@ -41,8 +42,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
DEPDIRS-librte_mbuf := librte_eal librte_mempool
DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
DEPDIRS-librte_timer := librte_eal
-DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
-DEPDIRS-librte_cfgfile := librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
DEPDIRS-librte_cmdline := librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
diff --git a/lib/librte_cfgfile/Makefile b/lib/librte_cfgfile/Makefile
index 755ef11..0bee43e 100644
--- a/lib/librte_cfgfile/Makefile
+++ b/lib/librte_cfgfile/Makefile
@@ -38,6 +38,7 @@ LIB = librte_cfgfile.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(SRCDIR)/../librte_eal/common/include
EXPORT_MAP := rte_cfgfile_version.map
diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c
index 2588093..9dc25cc 100644
--- a/lib/librte_cfgfile/rte_cfgfile.c
+++ b/lib/librte_cfgfile/rte_cfgfile.c
@@ -36,7 +36,6 @@
#include <string.h>
#include <ctype.h>
#include <rte_common.h>
-#include <rte_string_fns.h>
#include "rte_cfgfile.h"
@@ -258,19 +257,25 @@ rte_cfgfile_load_with_params(const char *filename, int flags,
struct rte_cfgfile_section *sect =
cfg->sections[curr_section];
- int n;
+
char *split[2] = {NULL};
- n = rte_strsplit(buffer, sizeof(buffer), split, 2, '=');
- if (flags & CFG_FLAG_EMPTY_VALUES) {
- if ((n < 1) || (n > 2)) {
- printf("Error at line %d - cannot split string, n=%d\n",
- lineno, n);
- goto error1;
- }
+ split[0] = buffer;
+ split[1] = memchr(buffer, '=', len);
+
+ /* when delimeter not found */
+ if (split[1] == NULL) {
+ printf("Error at line %d - cannot "
+ "split string\n", lineno);
+ goto error1;
} else {
- if (n != 2) {
- printf("Error at line %d - cannot split string, n=%d\n",
- lineno, n);
+ /* when delimeter found */
+ *split[1] = '\0';
+ split[1]++;
+
+ if (!(flags & CFG_FLAG_EMPTY_VALUES) &&
+ (*split[1] == '\0')) {
+ printf("Error at line %d - cannot "
+ "split string\n", lineno);
goto error1;
}
}
--
2.7.4
next prev parent reply other threads:[~2017-09-22 9:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 9:44 [dpdk-dev] [PATCH v6 0/5] Rework cfgfile API to enable apps config file support Kuba Kozak
2017-09-22 9:44 ` Kuba Kozak [this message]
2017-09-22 9:44 ` [dpdk-dev] [PATCH v6 2/5] cfgfile: change existing API functions Kuba Kozak
2017-09-22 9:44 ` [dpdk-dev] [PATCH v6 3/5] cfgfile: add APIs for cfgfile modification Kuba Kozak
2017-09-22 9:44 ` [dpdk-dev] [PATCH v6 4/5] cfgfile: rework of load function Kuba Kozak
2017-09-22 9:44 ` [dpdk-dev] [PATCH v6 5/5] test/cfgfile: add new unit test Kuba Kozak
2017-10-08 22:55 ` [dpdk-dev] [PATCH v6 0/5] Rework cfgfile API to enable apps config file support Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506073490-45399-2-git-send-email-kubax.kozak@intel.com \
--to=kubax.kozak@intel.com \
--cc=bruce.richardson@intel.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=jacekx.piasecki@intel.com \
--cc=michalx.k.jastrzebski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).