]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: style cleanup
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 14 Nov 2016 08:28:09 +0000 (09:28 +0100)
committerStephen Hemminger <sthemmin@microsoft.com>
Tue, 29 Nov 2016 19:41:58 +0000 (11:41 -0800)
Make code more inline with current kernel style

ip/ipaddress.c

index df0f1b9c94c58e3a80d4c78a0e7ba919555930e0..b9cd255f93cbed4be3e89d0795e37e4853d7f44d 100644 (file)
@@ -148,11 +148,11 @@ static void print_operstate(FILE *f, __u8 state)
                fprintf(f, "state %#x ", state);
        } else if (brief) {
                color_fprintf(f, oper_state_color(state),
-                             "%-14s ", oper_states[state]);
+                             "%-14s ", oper_states[state]);
        } else {
                fprintf(f, "state ");
                color_fprintf(f, oper_state_color(state),
-                             "%s ", oper_states[state]);
+                             "%s ", oper_states[state]);
        }
 }
 
@@ -385,7 +385,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
 
                if (vf_spoofchk->setting != -1)
                        fprintf(fp, ", spoof checking %s",
-                               vf_spoofchk->setting ? "on" : "off");
+                               vf_spoofchk->setting ? "on" : "off");
        }
        if (vf[IFLA_VF_LINK_STATE]) {
                struct ifla_vf_link_state *vf_linkstate =
@@ -403,7 +403,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo)
 
                if (vf_trust->setting != -1)
                        fprintf(fp, ", trust %s",
-                               vf_trust->setting ? "on" : "off");
+                               vf_trust->setting ? "on" : "off");
        }
        if (vf[IFLA_VF_STATS] && show_stats)
                print_vf_stats64(fp, vf[IFLA_VF_STATS]);
@@ -424,7 +424,8 @@ static void print_num(FILE *fp, unsigned int width, uint64_t count)
        }
 
        /* increase value by a factor of 1000/1024 and print
-        * if result is something a human can read */
+        * if result is something a human can read
+        */
        for (;;) {
                powi *= base;
                if (count / base < powi)
@@ -667,9 +668,9 @@ int print_linkinfo_brief(const struct sockaddr_nl *who,
                return -1;
 
        parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
-       if (tb[IFLA_IFNAME] == NULL) {
+       if (tb[IFLA_IFNAME] == NULL)
                fprintf(stderr, "BUG: device with ifindex %d has nil ifname\n", ifi->ifi_index);
-       }
+
        if (filter.label &&
            (!filter.family || filter.family == AF_PACKET) &&
            fnmatch(filter.label, RTA_DATA(tb[IFLA_IFNAME]), 0))
@@ -763,9 +764,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
                return 0;
 
        parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
-       if (tb[IFLA_IFNAME] == NULL) {
+       if (tb[IFLA_IFNAME] == NULL)
                fprintf(stderr, "BUG: device with ifindex %d has nil ifname\n", ifi->ifi_index);
-       }
+
        if (filter.label &&
            (!filter.family || filter.family == AF_PACKET) &&
            fnmatch(filter.label, RTA_DATA(tb[IFLA_IFNAME]), 0))
@@ -1094,16 +1095,16 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
 
        if (rta_tb[IFA_LOCAL]) {
                color_fprintf(fp, ifa_family_color(ifa->ifa_family), "%s",
-                             format_host_rta(ifa->ifa_family,
-                                             rta_tb[IFA_LOCAL]));
+                             format_host_rta(ifa->ifa_family,
+                                             rta_tb[IFA_LOCAL]));
                if (rta_tb[IFA_ADDRESS] &&
                    memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]),
-                          RTA_DATA(rta_tb[IFA_LOCAL]),
-                          ifa->ifa_family == AF_INET ? 4 : 16)) {
+                          RTA_DATA(rta_tb[IFA_LOCAL]),
+                          ifa->ifa_family == AF_INET ? 4 : 16)) {
                        fprintf(fp, " peer ");
                        color_fprintf(fp, ifa_family_color(ifa->ifa_family),
-                                     "%s", format_host_rta(ifa->ifa_family,
-                                     rta_tb[IFA_ADDRESS]));
+                                     "%s", format_host_rta(ifa->ifa_family,
+                                     rta_tb[IFA_ADDRESS]));
                }
                fprintf(fp, "/%d ", ifa->ifa_prefixlen);
        }
@@ -1114,14 +1115,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
        if (rta_tb[IFA_BROADCAST]) {
                fprintf(fp, "brd ");
                color_fprintf(fp, ifa_family_color(ifa->ifa_family), "%s ",
-                             format_host_rta(ifa->ifa_family,
-                                             rta_tb[IFA_BROADCAST]));
+                             format_host_rta(ifa->ifa_family,
+                                             rta_tb[IFA_BROADCAST]));
        }
        if (rta_tb[IFA_ANYCAST]) {
                fprintf(fp, "any ");
                color_fprintf(fp, ifa_family_color(ifa->ifa_family), "%s ",
-                             format_host_rta(ifa->ifa_family,
-                                             rta_tb[IFA_ANYCAST]));
+                             format_host_rta(ifa->ifa_family,
+                                             rta_tb[IFA_ANYCAST]));
        }
        fprintf(fp, "scope %s ", rtnl_rtscope_n2a(ifa->ifa_scope, b1, sizeof(b1)));
        if (ifa_flags & IFA_F_SECONDARY) {
@@ -1160,9 +1161,9 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
                ifa_flags &= ~IFA_F_MCAUTOJOIN;
                fprintf(fp, "autojoin ");
        }
-       if (!(ifa_flags & IFA_F_PERMANENT)) {
+       if (!(ifa_flags & IFA_F_PERMANENT))
                fprintf(fp, "dynamic ");
-       else
+       else
                ifa_flags &= ~IFA_F_PERMANENT;
        if (ifa_flags & IFA_F_DADFAILED) {
                ifa_flags &= ~IFA_F_DADFAILED;
@@ -1648,9 +1649,9 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
                                filter.kind = *argv;
                        }
                } else {
-                       if (strcmp(*argv, "dev") == 0) {
+                       if (strcmp(*argv, "dev") == 0)
                                NEXT_ARG();
-                       else if (matches(*argv, "help") == 0)
+                       else if (matches(*argv, "help") == 0)
                                usage();
                        if (filter_dev)
                                duparg2("dev", *argv);
@@ -1955,9 +1956,8 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)
                } else if (strcmp(*argv, "autojoin") == 0) {
                        ifa_flags |= IFA_F_MCAUTOJOIN;
                } else {
-                       if (strcmp(*argv, "local") == 0) {
+                       if (strcmp(*argv, "local") == 0)
                                NEXT_ARG();
-                       }
                        if (matches(*argv, "help") == 0)
                                usage();
                        if (local_len)
@@ -1988,9 +1988,9 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)
        if (peer_len == 0 && local_len) {
                if (cmd == RTM_DELADDR && lcl.family == AF_INET && !(lcl.flags & PREFIXLEN_SPECIFIED)) {
                        fprintf(stderr,
-                           "Warning: Executing wildcard deletion to stay compatible with old scripts.\n" \
-                           "         Explicitly specify the prefix length (%s/%d) to avoid this warning.\n" \
-                           "         This special behaviour is likely to disappear in further releases,\n" \
+                           "Warning: Executing wildcard deletion to stay compatible with old scripts.\n"
+                           "         Explicitly specify the prefix length (%s/%d) to avoid this warning.\n"
+                           "         This special behaviour is likely to disappear in further releases,\n"
                            "         fix your scripts!\n", lcl_arg, local_len*8);
                } else {
                        peer = lcl;