Date: Fri, 26 Jun 2020 16:20:35 +0000 (UTC) From: Allan Jude <allanjude@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362654 - head/sbin/ifconfig Message-ID: <202006261620.05QGKZmO050588@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <aly@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 {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006261620.05QGKZmO050588>