aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorAllan Jude <allanjude@FreeBSD.org>2020-06-26 16:20:34 +0000
committerAllan Jude <allanjude@FreeBSD.org>2020-06-26 16:20:34 +0000
commitd4be5ce5586e3ac6016956c03d85fdae495e54b0 (patch)
tree80bf2bcdd2ebb030ed3f641d4e1736c658172f70 /sbin/ifconfig
parentd9d09a7c993f650f2870de0d90c0118f300c6b3f (diff)
downloadsrc-d4be5ce5586e3ac6016956c03d85fdae495e54b0.tar.gz
src-d4be5ce5586e3ac6016956c03d85fdae495e54b0.zip
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.
Notes
Notes: svn path=/head/; revision=362654
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/af_link.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c
index fe2527ae9680..fb7a235b2f49 100644
--- a/sbin/ifconfig/af_link.c
+++ b/sbin/ifconfig/af_link.c
@@ -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 {