Obtain and use ETHER_ADDR_LEN where appropriate.

Drop unnecessary includes.

XXX libsa ether_sprintf() should maybe be ether_snprintf.
This commit is contained in:
jakllsch 2014-03-29 14:20:14 +00:00
parent 820d40c2f8
commit 2f39df062c

View File

@ -1,4 +1,4 @@
/* $NetBSD: ether_sprintf.c,v 1.6 2007/11/24 13:20:55 isaki Exp $ */
/* $NetBSD: ether_sprintf.c,v 1.7 2014/03/29 14:20:14 jakllsch Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@ -47,8 +47,7 @@
#include <string.h>
#endif
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <net/if_ether.h>
#include "stand.h"
#include "net.h"
@ -60,10 +59,10 @@ char *
ether_sprintf(const u_char *ap)
{
int i;
static char etherbuf[18];
static char etherbuf[3*ETHER_ADDR_LEN];
char *cp = etherbuf;
for (i = 0; i < 6; i++) {
for (i = 0; i < ETHER_ADDR_LEN; i++) {
*cp++ = hexdigits[*ap >> 4];
*cp++ = hexdigits[*ap++ & 0xf];
*cp++ = ':';