]> git.droids-corp.org - dpdk.git/commitdiff
cfgfile: remove EAL dependency
authorJacek Piasecki <jacekx.piasecki@intel.com>
Fri, 22 Sep 2017 09:44:46 +0000 (11:44 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 8 Oct 2017 22:44:59 +0000 (00:44 +0200)
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
lib/librte_cfgfile/Makefile
lib/librte_cfgfile/rte_cfgfile.c

index dea64253b109a0e7b691391afe56cf85fd5e119b..f0ab2fb06efbf46fca88c5428738f572527d5664 100644 (file)
@@ -42,7 +42,6 @@ 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
index 755ef11f6947833765f17ff735571de8ac14748d..0bee43e21eb14187fd736cf0c27f29ee7128ef90 100644 (file)
@@ -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
 
index 258809373ac2b74a73a0fe4e62142438fecb5756..9dc25cc3db5ba83afaa55e658bc5813a5165ab20 100644 (file)
@@ -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;
                                }
                        }