diff options
Diffstat (limited to 'scripts/dtc/dtc.h')
| -rw-r--r-- | scripts/dtc/dtc.h | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index d501c8605f26..3e42a071070e 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h | |||
| @@ -161,51 +161,27 @@ struct node { | |||
| 161 | struct label *labels; | 161 | struct label *labels; |
| 162 | }; | 162 | }; |
| 163 | 163 | ||
| 164 | static inline struct label *for_each_label_next(struct label *l) | ||
| 165 | { | ||
| 166 | do { | ||
| 167 | l = l->next; | ||
| 168 | } while (l && l->deleted); | ||
| 169 | |||
| 170 | return l; | ||
| 171 | } | ||
| 172 | |||
| 173 | #define for_each_label(l0, l) \ | ||
| 174 | for ((l) = (l0); (l); (l) = for_each_label_next(l)) | ||
| 175 | |||
| 176 | #define for_each_label_withdel(l0, l) \ | 164 | #define for_each_label_withdel(l0, l) \ |
| 177 | for ((l) = (l0); (l); (l) = (l)->next) | 165 | for ((l) = (l0); (l); (l) = (l)->next) |
| 178 | 166 | ||
| 179 | static inline struct property *for_each_property_next(struct property *p) | 167 | #define for_each_label(l0, l) \ |
| 180 | { | 168 | for_each_label_withdel(l0, l) \ |
| 181 | do { | 169 | if (!(l)->deleted) |
| 182 | p = p->next; | ||
| 183 | } while (p && p->deleted); | ||
| 184 | |||
| 185 | return p; | ||
| 186 | } | ||
| 187 | |||
| 188 | #define for_each_property(n, p) \ | ||
| 189 | for ((p) = (n)->proplist; (p); (p) = for_each_property_next(p)) | ||
| 190 | 170 | ||
| 191 | #define for_each_property_withdel(n, p) \ | 171 | #define for_each_property_withdel(n, p) \ |
| 192 | for ((p) = (n)->proplist; (p); (p) = (p)->next) | 172 | for ((p) = (n)->proplist; (p); (p) = (p)->next) |
| 193 | 173 | ||
| 194 | static inline struct node *for_each_child_next(struct node *c) | 174 | #define for_each_property(n, p) \ |
| 195 | { | 175 | for_each_property_withdel(n, p) \ |
| 196 | do { | 176 | if (!(p)->deleted) |
| 197 | c = c->next_sibling; | ||
| 198 | } while (c && c->deleted); | ||
| 199 | |||
| 200 | return c; | ||
| 201 | } | ||
| 202 | |||
| 203 | #define for_each_child(n, c) \ | ||
| 204 | for ((c) = (n)->children; (c); (c) = for_each_child_next(c)) | ||
| 205 | 177 | ||
| 206 | #define for_each_child_withdel(n, c) \ | 178 | #define for_each_child_withdel(n, c) \ |
| 207 | for ((c) = (n)->children; (c); (c) = (c)->next_sibling) | 179 | for ((c) = (n)->children; (c); (c) = (c)->next_sibling) |
| 208 | 180 | ||
| 181 | #define for_each_child(n, c) \ | ||
| 182 | for_each_child_withdel(n, c) \ | ||
| 183 | if (!(c)->deleted) | ||
| 184 | |||
| 209 | void add_label(struct label **labels, char *label); | 185 | void add_label(struct label **labels, char *label); |
| 210 | void delete_labels(struct label **labels); | 186 | void delete_labels(struct label **labels); |
| 211 | 187 | ||
