Author: allanjude
Date: Fri Jun 26 16:20:34 2020
New Revision: 362654
URL: https://svnweb.freebsd.org/changeset/base/362654

Log:
  ifconfig(8): optimize -f ether:dash mode
  
  Switch to the simplified while loop suggest by Aaron LI
  
  Post commit review via: https://reviews.freebsd.org/rS301185#inline-232
  
  Submitted by: Aaron LI <a...@aaronly.me>
  Sponsored by: Klara Inc.

Modified:
  head/sbin/ifconfig/af_link.c

Modified: head/sbin/ifconfig/af_link.c
==============================================================================
--- head/sbin/ifconfig/af_link.c        Fri Jun 26 16:16:25 2020        
(r362653)
+++ head/sbin/ifconfig/af_link.c        Fri Jun 26 16:20:34 2020        
(r362654)
@@ -74,10 +74,10 @@ link_status(int s __unused, const struct ifaddrs *ifa)
            sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) {
                ether_format = ether_ntoa((struct ether_addr *)LLADDR(sdl));
                if (f_ether != NULL && strcmp(f_ether, "dash") == 0) {
-                       for (format_char = strchr(ether_format, ':');
-                           format_char != NULL;
-                           format_char = strchr(ether_format, ':'))
+                       while ((format_char = strchr(ether_format, ':')) !=
+                           NULL) {
                                *format_char = '-';
+                       }
                }
                printf("\tether %s\n", ether_format);
        } else {
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to