[lxc-devel] [lxc/master] Declare loop variable outside of 'for' statement
ganto on Github
lxc-bot at linuxcontainers.org
Sat Sep 15 19:54:49 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 532 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180915/679fec30/attachment.bin>
-------------- next part --------------
From 19335fb986bc69904bbfa8c92b29fc7cc5b95aa4 Mon Sep 17 00:00:00 2001
From: Reto Gantenbein <reto.gantenbein at linuxmonk.ch>
Date: Sat, 15 Sep 2018 21:43:09 +0200
Subject: [PATCH] Declare loop variable outside of 'for' statement
This fixes a build failure on CentOS 7:
./macro.h:135:2: error: 'for' loop initial declarations are only
allowed in C99 mode
for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \
^
Signed-off-by: Reto Gantenbein <reto.gantenbein at linuxmonk.ch>
---
src/lxc/macro.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lxc/macro.h b/src/lxc/macro.h
index c0a50371d..03f07143e 100644
--- a/src/lxc/macro.h
+++ b/src/lxc/macro.h
@@ -228,7 +228,8 @@ extern int __build_bug_on_failed;
#endif
#define lxc_iterate_parts(__iterator, __splitme, __separators) \
- for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \
+ char *__p, *__it; \
+ for (__p = NULL, __it = strtok_r(__splitme, __separators, &__p); \
(__iterator = __it); \
__iterator = __it = strtok_r(NULL, __separators, &__p))
More information about the lxc-devel
mailing list