use strchr/strrchr/memset/memmove instead of index/rindex/bzero/bcopy

This commit is contained in:
lukem 1997-10-18 11:23:20 +00:00
parent 22597304f5
commit 7f43427b52

View File

@ -1,4 +1,4 @@
/* $NetBSD: utils.c,v 1.8 1997/07/30 17:43:55 thorpej Exp $ */
/* $NetBSD: utils.c,v 1.9 1997/10/18 11:23:20 lukem Exp $ */
/*
* Copyright (c) 1988, 1992 The University of Utah and the Center
@ -51,7 +51,7 @@
#if 0
static char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: utils.c,v 1.8 1997/07/30 17:43:55 thorpej Exp $");
__RCSID("$NetBSD: utils.c,v 1.9 1997/10/18 11:23:20 lukem Exp $");
#endif
#endif /* not lint */
@ -89,7 +89,7 @@ DispPkt(rconn, direct)
static char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n";
struct tm *tmp;
register struct rmp_packet *rmp;
struct rmp_packet *rmp;
int i, omask;
u_int32_t t;
@ -215,8 +215,8 @@ GetEtherAddr(addr)
{
static char Hex[] = "0123456789abcdef";
static char etherstr[RMP_ADDRLEN*3];
register int i;
register char *cp;
int i;
char *cp;
/*
* For each byte in `addr', convert it to "<hexchar><hexchar>:".
@ -252,10 +252,10 @@ GetEtherAddr(addr)
*/
void
DspFlnm(size, flnm)
register u_int size;
register char *flnm;
u_int size;
char *flnm;
{
register int i;
int i;
(void) fprintf(DbgFp, "\n\t\tFile Name (%u): <", size);
for (i = 0; i < size; i++)
@ -289,8 +289,8 @@ NewClient(addr)
return(NULL);
}
bzero(ctmp, sizeof(CLIENT));
bcopy(addr, &ctmp->addr[0], RMP_ADDRLEN);
memset(ctmp, 0, sizeof(CLIENT));
memmove(&ctmp->addr[0], addr, RMP_ADDRLEN);
return(ctmp);
}
@ -313,7 +313,7 @@ NewClient(addr)
void
FreeClients()
{
register CLIENT *ctmp;
CLIENT *ctmp;
while (Clients != NULL) {
ctmp = Clients;
@ -391,7 +391,7 @@ NewConn(rconn)
* Copy template into `rtmp', init file descriptor to `-1' and
* set ptr to next elem NULL.
*/
bcopy((char *)rconn, (char *)rtmp, sizeof(RMPCONN));
memmove((char *)rtmp, (char *)rconn, sizeof(RMPCONN));
rtmp->bootfd = -1;
rtmp->next = NULL;
@ -413,7 +413,7 @@ NewConn(rconn)
*/
void
FreeConn(rtmp)
register RMPCONN *rtmp;
RMPCONN *rtmp;
{
/*
* If the file descriptor is in use, close the file.
@ -449,7 +449,7 @@ FreeConn(rtmp)
void
FreeConns()
{
register RMPCONN *rtmp;
RMPCONN *rtmp;
while (RmpConns != NULL) {
rtmp = RmpConns;
@ -480,7 +480,7 @@ FreeConns()
*/
void
AddConn(rconn)
register RMPCONN *rconn;
RMPCONN *rconn;
{
if (RmpConns != NULL)
rconn->next = RmpConns;
@ -508,12 +508,12 @@ AddConn(rconn)
*/
RMPCONN *
FindConn(rconn)
register RMPCONN *rconn;
RMPCONN *rconn;
{
register RMPCONN *rtmp;
RMPCONN *rtmp;
for (rtmp = RmpConns; rtmp != NULL; rtmp = rtmp->next)
if (bcmp((char *)&rconn->rmp.hp_hdr.saddr[0],
if (memcmp((char *)&rconn->rmp.hp_hdr.saddr[0],
(char *)&rtmp->rmp.hp_hdr.saddr[0], RMP_ADDRLEN) == 0)
break;
@ -538,9 +538,9 @@ FindConn(rconn)
*/
void
RemoveConn(rconn)
register RMPCONN *rconn;
RMPCONN *rconn;
{
register RMPCONN *thisrconn, *lastrconn;
RMPCONN *thisrconn, *lastrconn;
if (RmpConns == rconn) { /* easy case */
RmpConns = RmpConns->next;