From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 21 16:50:26 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E64916A4FC for ; Mon, 21 Aug 2006 16:50:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C76CF43D5F for ; Mon, 21 Aug 2006 16:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k7LGoJfh044723 for ; Mon, 21 Aug 2006 16:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k7LGoJT9044722; Mon, 21 Aug 2006 16:50:19 GMT (envelope-from gnats) Resent-Date: Mon, 21 Aug 2006 16:50:19 GMT Resent-Message-Id: <200608211650.k7LGoJT9044722@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ricardo Nabinger Sanchez Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 240FC16A4DA for ; Mon, 21 Aug 2006 16:44:25 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73B9843D49 for ; Mon, 21 Aug 2006 16:44:24 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k7LGiOf3054408 for ; Mon, 21 Aug 2006 16:44:24 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k7LGiODJ054406; Mon, 21 Aug 2006 16:44:24 GMT (envelope-from nobody) Message-Id: <200608211644.k7LGiODJ054406@www.freebsd.org> Date: Mon, 21 Aug 2006 16:44:24 GMT From: Ricardo Nabinger Sanchez To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: bin/102354: Small cleanup for ifmedia.c X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2006 16:50:26 -0000 >Number: 102354 >Category: bin >Synopsis: Small cleanup for ifmedia.c >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Aug 21 16:50:19 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Ricardo Nabinger Sanchez >Release: FreeBSD-6.1-RELEASE >Organization: >Environment: FreeBSD sauron.lan.box 6.1-RELEASE FreeBSD 6.1-RELEASE #0: Sun May 7 04:32:43 UTC 2006 root@opus.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: Just a small cleanup for ifmedia, covering: * removing a redundant case, consolidating IFM_ETHER and IFM_ATM together. * removing unnecessary gotos, in the sense that a simple if () does the same thing, preserving the style (each goto is preceeded by a similar condition modelled with if (), as this patch also does). In case the fix is mangled, the patch is available at: http://rnsanchez.wait4.org/FreeBSD/ifmedia_small_cleanup.diff >How-To-Repeat: >Fix: This patch is against -current. Index: src/sbin/ifconfig/ifmedia.c =================================================================== RCS file: /home/ncvs/src/sbin/ifconfig/ifmedia.c,v retrieving revision 1.20 diff -u -r1.20 ifmedia.c --- src/sbin/ifconfig/ifmedia.c 11 Jan 2006 22:37:59 -0000 1.20 +++ src/sbin/ifconfig/ifmedia.c 21 Aug 2006 03:16:44 -0000 @@ -145,6 +145,7 @@ if (ifmr.ifm_status & IFM_AVALID) { printf("\tstatus: "); switch (IFM_TYPE(ifmr.ifm_active)) { + case IFM_ATM: case IFM_ETHER: if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); @@ -160,13 +161,6 @@ printf("no ring"); break; - case IFM_ATM: - if (ifmr.ifm_status & IFM_ACTIVE) - printf("active"); - else - printf("no carrier"); - break; - case IFM_IEEE80211: /* XXX: Different value for adhoc? */ if (ifmr.ifm_status & IFM_ACTIVE) @@ -692,14 +686,11 @@ /* Find subtype. */ desc = get_subtype_desc(ifmw, ttos); - if (desc != NULL) - goto got_subtype; - - /* Falling to here means unknown subtype. */ - printf(""); - return; + if (desc == NULL) { + printf(""); + return; + } - got_subtype: if (print_toptype) putchar(' '); @@ -750,14 +741,11 @@ /* Find subtype. */ desc = get_subtype_desc(ifmw, ttos); - if (desc != NULL) - goto got_subtype; - - /* Falling to here means unknown subtype. */ - printf(""); - return; + if (desc == NULL) { + printf(""); + return; + } - got_subtype: printf("media %s", desc->ifmt_string); desc = get_mode_desc(ifmw, ttos); >Release-Note: >Audit-Trail: >Unformatted: