The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2616

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
This fixes a build failure on CentOS 7 (#2615):
```
  ./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); \
    ^
```
From 19335fb986bc69904bbfa8c92b29fc7cc5b95aa4 Mon Sep 17 00:00:00 2001
From: Reto Gantenbein <reto.gantenb...@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.gantenb...@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))
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to