From 992e29205528414cdd8fd7e8415a3493676f022b Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 31 Mar 2018 11:05:57 -0700 Subject: [PATCH] Make the LIST_FOREACH_SAFE publicly visible. We will want to use this macro in more than one source file. This patch moves the macro into the common header for possibly undefined code. Signed-off-by: Richard Cochran --- clock.c | 7 ------- missing.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clock.c b/clock.c index 4bd20c5..97f1188 100644 --- a/clock.c +++ b/clock.c @@ -134,13 +134,6 @@ static int cid_eq(struct ClockIdentity *a, struct ClockIdentity *b) return 0 == memcmp(a, b, sizeof(*a)); } -#ifndef LIST_FOREACH_SAFE -#define LIST_FOREACH_SAFE(var, head, field, tvar) \ - for ((var) = LIST_FIRST((head)); \ - (var) && ((tvar) = LIST_NEXT((var), field), 1); \ - (var) = (tvar)) -#endif - static void remove_subscriber(struct clock_subscriber *s) { LIST_REMOVE(s, list); diff --git a/missing.h b/missing.h index b5ca270..b186aa7 100644 --- a/missing.h +++ b/missing.h @@ -60,6 +60,13 @@ enum { }; #endif +#ifndef LIST_FOREACH_SAFE +#define LIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = LIST_FIRST((head)); \ + (var) && ((tvar) = LIST_NEXT((var), field), 1); \ + (var) = (tvar)) +#endif + #ifndef SIOCGHWTSTAMP #define SIOCGHWTSTAMP 0x89b1 #endif