From a2addae8fe172f04f4d8ac99aa123a7d2dd64604 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Fri, 15 Sep 2017 12:47:35 -0300 Subject: *: use clang's 'ForEachMacros' format style option This fixes the broken indentation of several foreach loops throughout the code. From clang's documentation[1]: ForEachMacros: A vector of macros that should be interpreted as foreach loops instead of as function calls. [1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html Signed-off-by: Renato Westphal --- lib/if.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'lib/if.c') diff --git a/lib/if.c b/lib/if.c index 43c382beaa..7d27229656 100644 --- a/lib/if.c +++ b/lib/if.c @@ -249,8 +249,7 @@ struct interface *if_lookup_by_name_all_vrf(const char *name) struct vrf *vrf; struct interface *ifp; - RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) - { + RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { ifp = if_lookup_by_name(name, vrf->vrf_id); if (ifp) return ifp; @@ -386,8 +385,7 @@ struct interface *if_get_by_name_len(const char *name, size_t namelen, return ifp; /* Didn't find the interface on that vrf. Defined on a different one? */ - RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) - { + RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) { for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf->vrf_id), node, ifp)) { if (!memcmp(name, ifp->name, namelen) && (ifp->name[namelen] == '\0')) { @@ -541,10 +539,10 @@ void if_dump_all(void) struct listnode *node; void *p; - RB_FOREACH(vrf, vrf_id_head, &vrfs_by_id) - if (vrf->iflist != NULL) - for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, p)) - if_dump(p); + RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) + if (vrf->iflist != NULL) + for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, p)) + if_dump(p); } DEFUN (interface_desc, @@ -1053,8 +1051,7 @@ static void if_autocomplete(vector comps, struct cmd_token *token) struct listnode *ln; struct vrf *vrf = NULL; - RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) - { + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { for (ALL_LIST_ELEMENTS_RO(vrf->iflist, ln, ifp)) vector_set(comps, XSTRDUP(MTYPE_COMPLETION, ifp->name)); } -- cgit v1.2.3