Kill a couple of unnecessary calls to strlen().

This commit is contained in:
thorpej 1996-05-07 05:26:02 +00:00
parent 38b11e7c82
commit 527565ac15
3 changed files with 6 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bpf.c,v 1.26 1996/05/07 02:40:22 thorpej Exp $ */
/* $NetBSD: bpf.c,v 1.27 1996/05/07 05:26:02 thorpej Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@ -930,7 +930,6 @@ bpf_setif(d, ifr)
struct ifnet *ifp = bp->bif_ifp;
if (ifp == 0 ||
strlen(ifp->if_xname) != strlen(ifr->ifr_name) ||
strcmp(ifp->if_xname, ifr->ifr_name) != 0)
continue;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.34 1996/05/07 02:40:25 thorpej Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -416,13 +416,9 @@ ifunit(name)
register char *name;
{
register struct ifnet *ifp;
size_t namelen;
namelen = strlen(name);
for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next)
if (strlen(ifp->if_xname) == namelen &&
strcmp(ifp->if_xname, name) == 0)
if (strcmp(ifp->if_xname, name) == 0)
return (ifp);
return (NULL);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.15 1996/05/07 02:55:00 thorpej Exp $ */
/* $NetBSD: if.c,v 1.16 1996/05/07 05:30:45 thorpej Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
static char *rcsid = "$NetBSD: if.c,v 1.15 1996/05/07 02:55:00 thorpej Exp $";
static char *rcsid = "$NetBSD: if.c,v 1.16 1996/05/07 05:30:45 thorpej Exp $";
#endif
#endif /* not lint */
@ -129,9 +129,7 @@ intpr(interval, ifnetaddr)
bcopy(ifnet.if_xname, name, IFNAMSIZ);
name[IFNAMSIZ - 1] = '\0'; /* sanity */
ifnetaddr = (u_long)ifnet.if_list.tqe_next;
if (interface != 0 &&
(strlen(name) != strlen(interface) ||
strcmp(name, interface) != 0))
if (interface != 0 && strcmp(name, interface) != 0)
continue;
cp = index(name, '\0');
if ((ifnet.if_flags & IFF_UP) == 0)
@ -292,7 +290,6 @@ sidewaysintpr(interval, off)
ip->ift_name[0] = '(';
bcopy(ifnet.if_xname, ip->ift_name + 1, IFNAMSIZ - 1);
if (interface &&
strlen(ip->ift_name + 1) == strlen(interface) &&
strcmp(ip->ift_name + 1, interface) == 0)
interesting = ip;
ip->ift_name[IFNAMSIZ - 1] = '\0';