From: Christian Brauner Date: Fri, 19 Feb 2021 16:39:09 +0000 (+0100) Subject: string_utils: move lxc_iterate_parts() X-Git-Tag: lxc-5.0.0~274^2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9be3d269433165da879dac87d56f84949fbe135;p=thirdparty%2Flxc.git string_utils: move lxc_iterate_parts() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/macro.h b/src/lxc/macro.h index d802849ee..e900df281 100644 --- a/src/lxc/macro.h +++ b/src/lxc/macro.h @@ -406,11 +406,6 @@ extern int __build_bug_on_failed; } while (0) #endif -#define lxc_iterate_parts(__iterator, __splitme, __separators) \ - for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ - (__iterator = __it); \ - __iterator = __it = strtok_r(NULL, __separators, &__p)) - #define prctl_arg(x) ((unsigned long)x) /* networking */ diff --git a/src/lxc/string_utils.h b/src/lxc/string_utils.h index 85962c76d..52e3f35d5 100644 --- a/src/lxc/string_utils.h +++ b/src/lxc/string_utils.h @@ -187,4 +187,9 @@ static inline const char *fdstr(int fd) return buf; } +#define lxc_iterate_parts(__iterator, __splitme, __separators) \ + for (char *__p = NULL, *__it = strtok_r(__splitme, __separators, &__p); \ + (__iterator = __it); \ + __iterator = __it = strtok_r(NULL, __separators, &__p)) + #endif /* __LXC_STRING_UTILS_H */