summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2005-05-17 04:14:57 +0000
committerchristos <christos@NetBSD.org>2005-05-17 04:14:57 +0000
commit362a4a0bd547eac009cbfedf1b6d294b706361d0 (patch)
treea02f30dd6eaee133e5f0d772232f0647bc987959 /sys/dev
parenteaa19a67b88686f14f908f6cb8de78f54c1e949b (diff)
Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/eisa/eisareg.h11
-rw-r--r--sys/dev/ic/pdq.c29
-rw-r--r--sys/dev/isapnp/isapnp.c13
3 files changed, 25 insertions, 28 deletions
diff --git a/sys/dev/eisa/eisareg.h b/sys/dev/eisa/eisareg.h
index e3dbe82cef9..4dfbfbdddda 100644
--- a/sys/dev/eisa/eisareg.h
+++ b/sys/dev/eisa/eisareg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: eisareg.h,v 1.5 2000/08/11 00:44:37 thorpej Exp $ */
+/* $NetBSD: eisareg.h,v 1.6 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -87,14 +87,13 @@
*
* EISA_PRIDID_n returns the "n"th hex digit of the product ID.
*/
-#define __EISA_HEX_MAP "0123456789ABCDEF"
#define EISA_PRODID_0(pid) \
- (__EISA_HEX_MAP[(((pid)[0] >> 4) & 0xf)])
+ (HEXDIGITS[(((pid)[0] >> 4) & 0xf)])
#define EISA_PRODID_1(pid) \
- (__EISA_HEX_MAP[(((pid)[0] >> 0) & 0xf)])
+ (HEXDIGITS[(((pid)[0] >> 0) & 0xf)])
#define EISA_PRODID_2(pid) \
- (__EISA_HEX_MAP[(((pid)[1] >> 4) & 0xf)])
+ (HEXDIGITS[(((pid)[1] >> 4) & 0xf)])
#define EISA_PRODID_3(pid) \
- (__EISA_HEX_MAP[(((pid)[1] >> 0) & 0xf)])
+ (HEXDIGITS[(((pid)[1] >> 0) & 0xf)])
#endif /* !__DEV_EISA_EISAREG_H__ */
diff --git a/sys/dev/ic/pdq.c b/sys/dev/ic/pdq.c
index 9242e3dc21e..4a9ead4b3a9 100644
--- a/sys/dev/ic/pdq.c
+++ b/sys/dev/ic/pdq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pdq.c,v 1.37 2005/02/27 00:27:02 perry Exp $ */
+/* $NetBSD: pdq.c,v 1.38 2005/05/17 04:14:57 christos Exp $ */
/*-
* Copyright (c) 1995,1996 Matt Thomas <matt@3am-software.com>
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pdq.c,v 1.37 2005/02/27 00:27:02 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pdq.c,v 1.38 2005/05/17 04:14:57 christos Exp $");
#define PDQ_HWSUPPORT /* for pdq.h */
@@ -182,7 +182,6 @@ pdq_print_fddi_chars(
pdq_t *pdq,
const pdq_response_status_chars_get_t *rsp)
{
- static const char hexchars[] = "0123456789abcdef";
pdq_uint32_t phy_type;
pdq_uint32_t pmd_type;
pdq_uint32_t smt_version_id;
@@ -203,18 +202,18 @@ pdq_print_fddi_chars(
printf(PDQ_OS_PREFIX "FDDI address %c%c:%c%c:%c%c:%c%c:%c%c:%c%c, FW=%c%c%c%c, HW=%c",
PDQ_OS_PREFIX_ARGS,
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[0] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[0] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[1] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[1] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[2] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[2] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[3] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[3] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[4] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[4] & 0x0F],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[5] >> 4],
- hexchars[pdq->pdq_hwaddr.lanaddr_bytes[5] & 0x0F],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[0] >> 4],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[0] & 0x0F],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[1] >> 4],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[1] & 0x0F],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[2] >> 4],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[2] & 0x0F],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[3] >> 4],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[3] & 0x0F],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[4] >> 4],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[4] & 0x0F],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[5] >> 4],
+ hexdigits[pdq->pdq_hwaddr.lanaddr_bytes[5] & 0x0F],
pdq->pdq_fwrev.fwrev_bytes[0], pdq->pdq_fwrev.fwrev_bytes[1],
pdq->pdq_fwrev.fwrev_bytes[2], pdq->pdq_fwrev.fwrev_bytes[3],
rsp->status_chars_get.module_rev.fwrev_bytes[0]);
diff --git a/sys/dev/isapnp/isapnp.c b/sys/dev/isapnp/isapnp.c
index bc7917a628e..2a6b58d492c 100644
--- a/sys/dev/isapnp/isapnp.c
+++ b/sys/dev/isapnp/isapnp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: isapnp.c,v 1.45 2005/02/27 00:27:21 perry Exp $ */
+/* $NetBSD: isapnp.c,v 1.46 2005/05/17 04:14:57 christos Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.45 2005/02/27 00:27:21 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isapnp.c,v 1.46 2005/05/17 04:14:57 christos Exp $");
#include "isadma.h"
@@ -508,16 +508,15 @@ isapnp_id_to_vendor(v, id)
char *v;
const u_char *id;
{
- static const char hex[] = "0123456789ABCDEF";
char *p = v;
*p++ = 'A' + (id[0] >> 2) - 1;
*p++ = 'A' + ((id[0] & 3) << 3) + (id[1] >> 5) - 1;
*p++ = 'A' + (id[1] & 0x1f) - 1;
- *p++ = hex[id[2] >> 4];
- *p++ = hex[id[2] & 0x0f];
- *p++ = hex[id[3] >> 4];
- *p++ = hex[id[3] & 0x0f];
+ *p++ = HEXDIGITS[id[2] >> 4];
+ *p++ = HEXDIGITS[id[2] & 0x0f];
+ *p++ = HEXDIGITS[id[3] >> 4];
+ *p++ = HEXDIGITS[id[3] & 0x0f];
*p = '\0';
return v;