Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Yes, it was a cool trick >20 years ago to use "012345678...
details: https://anonhg.NetBSD.org/src/rev/352f26a5fcaf
branches: trunk
changeset: 580949:352f26a5fcaf
user: christos <christos%NetBSD.org@localhost>
date: Tue May 17 04:14:57 2005 +0000
description:
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:
sys/arch/alpha/alpha/machdep.c | 6 +++---
sys/arch/alpha/stand/common/putulong.c | 4 +---
sys/arch/i386/pnpbios/pnpbios.c | 13 ++++++-------
sys/arch/m68k/m68k/db_disasm.c | 8 ++++----
sys/arch/m68k/m68k/regdump.c | 6 +++---
sys/arch/mvme68k/stand/sboot/etherfun.c | 4 ++--
sys/arch/next68k/dev/esp.c | 6 +++---
sys/arch/next68k/dev/mb8795.c | 6 +++---
sys/arch/next68k/stand/boot/en.c | 4 ++--
sys/arch/prep/prep/residual.c | 14 ++++++--------
sys/arch/xen/xen/if_xennet.c | 6 +++---
sys/compat/svr4/svr4_net.c | 9 ++++-----
sys/crypto/sha2/sha2.c | 23 ++++++++---------------
sys/dev/eisa/eisareg.h | 11 +++++------
sys/dev/ic/pdq.c | 29 ++++++++++++++---------------
sys/dev/isapnp/isapnp.c | 13 ++++++-------
sys/fs/filecorefs/filecore_utils.c | 18 +++++++++---------
sys/kern/kgdb_stub.c | 6 +++---
sys/kern/subr_prf.c | 15 +++++++++------
sys/lib/libsa/ether_sprintf.c | 7 +++----
sys/lib/libsa/stand.h | 4 +++-
sys/lib/libsa/subr_prf.c | 6 ++++--
sys/net/if_arcsubr.c | 9 ++++-----
sys/net/if_ethersubr.c | 9 ++++-----
sys/net/if_ppp.c | 9 ++++-----
sys/net/if_tap.c | 9 ++++-----
sys/net/ppp_tty.c | 9 ++++-----
sys/netatalk/at_rmx.c | 8 ++++----
sys/netatalk/ddp_input.c | 9 ++++-----
sys/netinet6/in6.c | 13 ++++++-------
sys/netiso/clnp_debug.c | 9 ++++-----
sys/nfs/nfs_vnops.c | 14 ++++++--------
sys/sys/systm.h | 5 ++++-
33 files changed, 152 insertions(+), 169 deletions(-)
diffs (truncated from 1140 to 300 lines):
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.284 2005/04/25 15:02:02 lukem Exp $ */
+/* $NetBSD: machdep.c,v 1.285 2005/05/17 04:14:57 christos Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.284 2005/04/25 15:02:02 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.285 2005/05/17 04:14:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1912,7 +1912,7 @@
for (i = 0;; ++i) {
if (i && (i & 3) == 0)
*--xc = '.';
- *--xc = "0123456789abcdef"[x & 0xf];
+ *--xc = hexdigits[x & 0xf];
x >>= 4;
if (x == 0)
break;
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/alpha/stand/common/putulong.c
--- a/sys/arch/alpha/stand/common/putulong.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/alpha/stand/common/putulong.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: putulong.c,v 1.1 1999/08/18 20:00:27 cgd Exp $ */
+/* $NetBSD: putulong.c,v 1.2 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -26,8 +26,6 @@
#include <lib/libsa/stand.h>
#include "common.h"
-static const char hexdigits[16] = "0123456789abcdef";
-
void
putulong(unsigned long ul)
{
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/i386/pnpbios/pnpbios.c
--- a/sys/arch/i386/pnpbios/pnpbios.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/i386/pnpbios/pnpbios.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pnpbios.c,v 1.46 2005/04/01 11:59:31 yamt Exp $ */
+/* $NetBSD: pnpbios.c,v 1.47 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 2000 Jason R. Thorpe. All rights reserved.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.46 2005/04/01 11:59:31 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pnpbios.c,v 1.47 2005/05/17 04:14:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -676,17 +676,16 @@
static void
pnpbios_id_to_string(u_int32_t pnpid, char *s)
{
- static char hex[] = "0123456789ABCDEF";
u_int8_t *id;
id = (u_int8_t *)&pnpid;
*s++ = 'A' + (id[0] >> 2) - 1;
*s++ = 'A' + ((id[0] & 3) << 3) + (id[1] >> 5) - 1;
*s++ = 'A' + (id[1] & 0x1f) - 1;
- *s++ = hex[id[2] >> 4];
- *s++ = hex[id[2] & 0x0f];
- *s++ = hex[id[3] >> 4];
- *s++ = hex[id[3] & 0x0f];
+ *s++ = HEXDIGITS[id[2] >> 4];
+ *s++ = HEXDIGITS[id[2] & 0x0f];
+ *s++ = HEXDIGITS[id[3] >> 4];
+ *s++ = HEXDIGITS[id[3] & 0x0f];
*s = '\0';
}
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/m68k/m68k/db_disasm.c
--- a/sys/arch/m68k/m68k/db_disasm.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/m68k/m68k/db_disasm.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.30 2004/08/28 22:06:28 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.31 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.30 2004/08/28 22:06:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.31 2005/05/17 04:14:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -3063,7 +3063,7 @@
p = buf;
do {
- *++p = "0123456789abcdef"[val % base];
+ *++p = hexdigits[val % base];
} while (val /= base);
while ((ch = *p--))
@@ -3098,7 +3098,7 @@
p = buf;
do {
- *++p = "0123456789abcdef"[val % base];
+ *++p = hexdigits[val % base];
} while (val /= base);
while ((ch = *p--))
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/m68k/m68k/regdump.c
--- a/sys/arch/m68k/m68k/regdump.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/m68k/m68k/regdump.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: regdump.c,v 1.8 2004/08/28 22:06:28 thorpej Exp $ */
+/* $NetBSD: regdump.c,v 1.9 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: regdump.c,v 1.8 2004/08/28 22:06:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: regdump.c,v 1.9 2005/05/17 04:14:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -174,7 +174,7 @@
for (i = len-1; i >= 0; --i) {
x = val & 0xF;
/* Isn't this a cool trick? */
- nbuf[i] = "0123456789ABCDEF"[x];
+ nbuf[i] = HEXDIGITS[x];
val >>= 4;
}
return(nbuf);
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/mvme68k/stand/sboot/etherfun.c
--- a/sys/arch/mvme68k/stand/sboot/etherfun.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/mvme68k/stand/sboot/etherfun.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: etherfun.c,v 1.5 2001/09/16 16:34:33 wiz Exp $ */
+/* $NetBSD: etherfun.c,v 1.6 2005/05/17 04:14:57 christos Exp $ */
/*
*
@@ -139,7 +139,7 @@
memcpy (&iptmp, myip, sizeof(iptmp));
memcpy(tftp_r, MSG, (sizeof(MSG)-1));
for (lcv = 9; lcv >= 2; lcv--) {
- tftp_r[lcv] = "0123456789ABCDEF"[iptmp & 0xF];
+ tftp_r[lcv] = HEXDIGITS[iptmp & 0xF];
iptmp = iptmp >> 4;
}
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/next68k/dev/esp.c
--- a/sys/arch/next68k/dev/esp.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/next68k/dev/esp.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: esp.c,v 1.49 2005/01/19 01:58:21 chs Exp $ */
+/* $NetBSD: esp.c,v 1.50 2005/05/17 04:14:57 christos Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.49 2005/01/19 01:58:21 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esp.c,v 1.50 2005/05/17 04:14:57 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -190,7 +190,7 @@
};
#ifdef ESP_DEBUG
-#define XCHR(x) "0123456789abcdef"[(x) & 0xf]
+#define XCHR(x) hexdigits[(x) & 0xf]
static void
esp_hex_dump(unsigned char *pkt, size_t len)
{
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/next68k/dev/mb8795.c
--- a/sys/arch/next68k/dev/mb8795.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/next68k/dev/mb8795.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mb8795.c,v 1.36 2005/01/30 19:10:16 thorpej Exp $ */
+/* $NetBSD: mb8795.c,v 1.37 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 1998 Darrin B. Jewell
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.36 2005/01/30 19:10:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.37 2005/05/17 04:14:57 christos Exp $");
#include "opt_inet.h"
#include "opt_ccitt.h"
@@ -241,7 +241,7 @@
/****************************************************************/
#ifdef MB8795_DEBUG
-#define XCHR(x) "0123456789abcdef"[(x) & 0xf]
+#define XCHR(x) hexdigits[(x) & 0xf]
static void
mb8795_hex_dump(unsigned char *pkt, size_t len)
{
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/next68k/stand/boot/en.c
--- a/sys/arch/next68k/stand/boot/en.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/next68k/stand/boot/en.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: en.c,v 1.11 2005/01/19 01:58:21 chs Exp $ */
+/* $NetBSD: en.c,v 1.12 2005/05/17 04:14:57 christos Exp $ */
/*
* Copyright (c) 1996 Rolf Grossmann
* All rights reserved.
@@ -170,7 +170,7 @@
#if 0
/* ### remove this when things work! */
-#define XCHR(x) "0123456789abcdef"[(x) & 0xf]
+#define XCHR(x) hexdigits[(x) & 0xf]
void
dump_pkt(unsigned char *pkt, size_t len)
{
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/prep/prep/residual.c
--- a/sys/arch/prep/prep/residual.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/prep/prep/residual.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: residual.c,v 1.3 2004/10/24 07:18:53 skrll Exp $ */
+/* $NetBSD: residual.c,v 1.4 2005/05/17 04:14:57 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: residual.c,v 1.3 2004/10/24 07:18:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: residual.c,v 1.4 2005/05/17 04:14:57 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -140,8 +140,6 @@
"Enabled",
};
-static char hextochr[] = "0123456789ABCDEF";
-
void
print_residual_device_info(void)
{
@@ -338,8 +336,8 @@
((p[0] >> 2) & 0x1f) + 'A' - 1,
(((p[0] & 0x03) << 3) | ((p[1] >> 5) & 0x07)) + 'A' - 1,
(p[1] & 0x1f) + 'A' - 1,
- hextochr[(p[2] >> 4) & 0xf], hextochr[p[2] & 0xf],
- hextochr[(p[3] >> 4) & 0xf], hextochr[p[3] & 0xf]);
+ HEXDIGITS[(p[2] >> 4) & 0xf], HEXDIGITS[p[2] & 0xf],
+ HEXDIGITS[(p[3] >> 4) & 0xf], HEXDIGITS[p[3] & 0xf]);
printf("\t\tSerialNum = 0x%08lx\n", be32toh(id->SerialNum));
l = be32toh(id->Flags);
printf("\t\tFlags = 0x%08lx\n", l);
@@ -421,8 +419,8 @@
((q[0] >> 2) & 0x1f) + 'A' - 1,
(((q[0] & 0x03) << 3) | ((q[1] >> 5) & 0x07)) + 'A' - 1,
(q[1] & 0x1f) + 'A' - 1,
- hextochr[(q[2] >> 4) & 0xf], hextochr[q[2] & 0xf],
- hextochr[(q[3] >> 4) & 0xf], hextochr[q[3] & 0xf]);
+ HEXDIGITS[(q[2] >> 4) & 0xf], HEXDIGITS[q[2] & 0xf],
+ HEXDIGITS[(q[3] >> 4) & 0xf], HEXDIGITS[q[3] & 0xf]);
}
break;
diff -r 706a357309c6 -r 352f26a5fcaf sys/arch/xen/xen/if_xennet.c
--- a/sys/arch/xen/xen/if_xennet.c Mon May 16 21:43:33 2005 +0000
+++ b/sys/arch/xen/xen/if_xennet.c Tue May 17 04:14:57 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xennet.c,v 1.22 2005/04/17 21:11:30 bouyer Exp $ */
+/* $NetBSD: if_xennet.c,v 1.23 2005/05/17 04:14:57 christos Exp $ */
/*
*
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
Home |
Main Index |
Thread Index |
Old Index