Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 1/3] spp_nfv: remove declaration in for loop
Date: Thu,  4 Apr 2019 18:57:38 +0900	[thread overview]
Message-ID: <1554371860-18206-2-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1554371860-18206-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

For some environment, declaration in for loop cause an error.

  error: ‘for’ loop initial declarations are only allowed in C99 mode

This update is move this declaration from.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/nfv/main.c       | 2 +-
 src/nfv/nfv_status.c | 4 ++--
 src/nfv/nfv_utils.h  | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/nfv/main.c b/src/nfv/main.c
index 4ecc553..fbcef0c 100644
--- a/src/nfv/main.c
+++ b/src/nfv/main.c
@@ -248,7 +248,7 @@ main(int argc, char *argv[])
 		lcore_id_used[lcore_id] = 1;
 	}
 	sprintf(log_msg, "Used lcores: ");
-	for (int i = 0; i < RTE_MAX_LCORE; i++) {
+	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		if (lcore_id_used[i] == 1)
 			sprintf(log_msg + strlen(log_msg), "%d ", i);
 	}
diff --git a/src/nfv/nfv_status.c b/src/nfv/nfv_status.c
index a3ad597..d29e083 100644
--- a/src/nfv/nfv_status.c
+++ b/src/nfv/nfv_status.c
@@ -54,9 +54,9 @@ int
 append_lcore_info_json(char *str,
 		uint8_t lcore_id_used[RTE_MAX_LCORE])
 {
-
+	int i;
 	sprintf(str + strlen(str), "\"lcores\":[");
-	for (int i = 0; i < RTE_MAX_LCORE; i++) {
+	for (i = 0; i < RTE_MAX_LCORE; i++) {
 		if (lcore_id_used[i] == 1)
 			sprintf(str + strlen(str), "%d,", i);
 	}
diff --git a/src/nfv/nfv_utils.h b/src/nfv/nfv_utils.h
index aca5f13..9d4f9dd 100644
--- a/src/nfv/nfv_utils.h
+++ b/src/nfv/nfv_utils.h
@@ -107,7 +107,8 @@ forward_array_reset(void)
 /* Return a type of port as a enum member of porttype_map structure. */
 static enum port_type get_port_type(char *portname)
 {
-	for (int i = 0; portmap[i].port_name != NULL; i++) {
+	int i;
+	for (i = 0; portmap[i].port_name != NULL; i++) {
 		const char *port_name = portmap[i].port_name;
 		if (strncmp(portname, port_name, strlen(port_name)) == 0)
 			return portmap[i].port_type;
-- 
2.7.4


  reply	other threads:[~2019-04-04  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04  9:57 [spp] [PATCH 0/3] Update for compile on CentOS7 ogawa.yasufumi
2019-04-04  9:57 ` ogawa.yasufumi [this message]
2019-04-04  9:57 ` [spp] [PATCH 2/3] spp_primary: remove declaration in for loop ogawa.yasufumi
2019-04-04  9:57 ` [spp] [PATCH 3/3] spp_vf: change inline func calls static inside ogawa.yasufumi

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=1554371860-18206-2-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /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).