Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa Obtain and use ETHER_ADDR_LEN where appropriate.



details:   https://anonhg.NetBSD.org/src/rev/64c6539965c4
branches:  trunk
changeset: 794947:64c6539965c4
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sat Mar 29 14:20:14 2014 +0000

description:
Obtain and use ETHER_ADDR_LEN where appropriate.
Drop unnecessary includes.

XXX libsa ether_sprintf() should maybe be ether_snprintf.

diffstat:

 sys/lib/libsa/ether_sprintf.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 522524be09f8 -r 64c6539965c4 sys/lib/libsa/ether_sprintf.c
--- a/sys/lib/libsa/ether_sprintf.c     Sat Mar 29 14:13:17 2014 +0000
+++ b/sys/lib/libsa/ether_sprintf.c     Sat Mar 29 14:20:14 2014 +0000
@@ -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 @@
 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++ = ':';



Home | Main Index | Thread Index | Old Index