Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys kill sprintf
details: https://anonhg.NetBSD.org/src/rev/985d8b844f9d
branches: trunk
changeset: 327904:985d8b844f9d
user: christos <christos%NetBSD.org@localhost>
date: Thu Mar 20 18:01:19 2014 +0000
description:
kill sprintf
diffstat:
sys/arch/sh3/sh3/db_disasm.c | 612 ++++++++++++++++++++--------------------
sys/miscfs/fdesc/fdesc_vnops.c | 7 +-
2 files changed, 310 insertions(+), 309 deletions(-)
diffs (truncated from 1823 to 300 lines):
diff -r 266edc8994ce -r 985d8b844f9d sys/arch/sh3/sh3/db_disasm.c
--- a/sys/arch/sh3/sh3/db_disasm.c Thu Mar 20 17:25:23 2014 +0000
+++ b/sys/arch/sh3/sh3/db_disasm.c Thu Mar 20 18:01:19 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.21 2008/06/07 02:43:10 uwe Exp $ */
+/* $NetBSD: db_disasm.c,v 1.22 2014/03/20 18:01:19 christos Exp $ */
/*
* Copyright (c) 1998-2000 Internet Initiative Japan Inc.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.21 2008/06/07 02:43:10 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.22 2014/03/20 18:01:19 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -42,62 +42,62 @@
static uint16_t get_insn(const void *);
-static void get_opcode(const uint16_t *, char *);
+static void get_opcode(const uint16_t *, char *, size_t);
-static void f_02(const uint16_t *, char *);
-static void f_03(const uint16_t *, char *);
-static void f_04(const uint16_t *, char *);
-static void f_08(const uint16_t *, char *);
-static void f_09(const uint16_t *, char *);
-static void f_0a(const uint16_t *, char *);
-static void f_0b(const uint16_t *, char *);
-static void f_0c(const uint16_t *, char *);
-static void f_10(const uint16_t *, char *);
-static void f_20(const uint16_t *, char *);
-static void f_24(const uint16_t *, char *);
-static void f_28(const uint16_t *, char *);
-static void f_2c(const uint16_t *, char *);
-static void f_30(const uint16_t *, char *);
-static void f_34(const uint16_t *, char *);
-static void f_38(const uint16_t *, char *);
-static void f_3c(const uint16_t *, char *);
-static void f_40(const uint16_t *, char *);
-static void f_41(const uint16_t *, char *);
-static void f_42(const uint16_t *, char *);
-static void f_43(const uint16_t *, char *);
-static void f_44(const uint16_t *, char *);
-static void f_45(const uint16_t *, char *);
-static void f_46(const uint16_t *, char *);
-static void f_47(const uint16_t *, char *);
-static void f_48(const uint16_t *, char *);
-static void f_49(const uint16_t *, char *);
-static void f_4a(const uint16_t *, char *);
-static void f_4b(const uint16_t *, char *);
-static void f_4c(const uint16_t *, char *);
-static void f_4d(const uint16_t *, char *);
-static void f_4e(const uint16_t *, char *);
-static void f_4f(const uint16_t *, char *);
-static void f_50(const uint16_t *, char *);
-static void f_60(const uint16_t *, char *);
-static void f_64(const uint16_t *, char *);
-static void f_68(const uint16_t *, char *);
-static void f_6c(const uint16_t *, char *);
-static void f_70(const uint16_t *, char *);
-static void f_80(const uint16_t *, char *);
-static void f_90(const uint16_t *, char *);
-static void f_a0(const uint16_t *, char *);
-static void f_b0(const uint16_t *, char *);
-static void f_c0(const uint16_t *, char *);
-static void f_d0(const uint16_t *, char *);
-static void f_e0(const uint16_t *, char *);
-static void f_f0(const uint16_t *, char *);
-static void f_f4(const uint16_t *, char *);
-static void f_f8(const uint16_t *, char *);
-static void f_fc(const uint16_t *, char *);
-static void f_fd(const uint16_t *, char *);
-static void f_fe(const uint16_t *, char *);
+static void f_02(const uint16_t *, char *, size_t);
+static void f_03(const uint16_t *, char *, size_t);
+static void f_04(const uint16_t *, char *, size_t);
+static void f_08(const uint16_t *, char *, size_t);
+static void f_09(const uint16_t *, char *, size_t);
+static void f_0a(const uint16_t *, char *, size_t);
+static void f_0b(const uint16_t *, char *, size_t);
+static void f_0c(const uint16_t *, char *, size_t);
+static void f_10(const uint16_t *, char *, size_t);
+static void f_20(const uint16_t *, char *, size_t);
+static void f_24(const uint16_t *, char *, size_t);
+static void f_28(const uint16_t *, char *, size_t);
+static void f_2c(const uint16_t *, char *, size_t);
+static void f_30(const uint16_t *, char *, size_t);
+static void f_34(const uint16_t *, char *, size_t);
+static void f_38(const uint16_t *, char *, size_t);
+static void f_3c(const uint16_t *, char *, size_t);
+static void f_40(const uint16_t *, char *, size_t);
+static void f_41(const uint16_t *, char *, size_t);
+static void f_42(const uint16_t *, char *, size_t);
+static void f_43(const uint16_t *, char *, size_t);
+static void f_44(const uint16_t *, char *, size_t);
+static void f_45(const uint16_t *, char *, size_t);
+static void f_46(const uint16_t *, char *, size_t);
+static void f_47(const uint16_t *, char *, size_t);
+static void f_48(const uint16_t *, char *, size_t);
+static void f_49(const uint16_t *, char *, size_t);
+static void f_4a(const uint16_t *, char *, size_t);
+static void f_4b(const uint16_t *, char *, size_t);
+static void f_4c(const uint16_t *, char *, size_t);
+static void f_4d(const uint16_t *, char *, size_t);
+static void f_4e(const uint16_t *, char *, size_t);
+static void f_4f(const uint16_t *, char *, size_t);
+static void f_50(const uint16_t *, char *, size_t);
+static void f_60(const uint16_t *, char *, size_t);
+static void f_64(const uint16_t *, char *, size_t);
+static void f_68(const uint16_t *, char *, size_t);
+static void f_6c(const uint16_t *, char *, size_t);
+static void f_70(const uint16_t *, char *, size_t);
+static void f_80(const uint16_t *, char *, size_t);
+static void f_90(const uint16_t *, char *, size_t);
+static void f_a0(const uint16_t *, char *, size_t);
+static void f_b0(const uint16_t *, char *, size_t);
+static void f_c0(const uint16_t *, char *, size_t);
+static void f_d0(const uint16_t *, char *, size_t);
+static void f_e0(const uint16_t *, char *, size_t);
+static void f_f0(const uint16_t *, char *, size_t);
+static void f_f4(const uint16_t *, char *, size_t);
+static void f_f8(const uint16_t *, char *, size_t);
+static void f_fc(const uint16_t *, char *, size_t);
+static void f_fd(const uint16_t *, char *, size_t);
+static void f_fe(const uint16_t *, char *, size_t);
-typedef void (*rasm_t)(const uint16_t *, char *);
+typedef void (*rasm_t)(const uint16_t *, char *, size_t);
static rasm_t f[16][16] = {
{ /* [0][0-7] */ NULL, NULL, f_02, f_03, f_04, f_04, f_04, f_04,
/* [0][8-f] */ f_08, f_09, f_0a, f_0b, f_0c, f_0c, f_0c, f_0c },
@@ -139,7 +139,7 @@
const void *pc = (void *)loc;
char line[40];
- get_opcode(pc, line);
+ get_opcode(pc, line, sizeof(line));
db_printf("%s\n", line);
return (loc + 2);
@@ -175,23 +175,23 @@
}
static void
-get_opcode(const uint16_t *pc, char *buf)
+get_opcode(const uint16_t *pc, char *buf, size_t len)
{
uint16_t insn = get_insn(pc);
int n0, n3;
- strcpy(buf, "????");
+ strlcpy(buf, "????", len);
n0 = (insn & 0xf000) >> 12;
n3 = (insn & 0x000f);
if (f[n0][n3] != NULL) {
- (*f[n0][n3])(pc, buf);
+ (*f[n0][n3])(pc, buf, len);
}
}
static void
-f_02(const uint16_t *pc, char *buf)
+f_02(const uint16_t *pc, char *buf, size_t len)
{
uint16_t insn = get_insn(pc);
int rn, type, md;
@@ -204,19 +204,19 @@
case 0:
switch (md) {
case 0:
- sprintf(buf, "stc sr, r%d", rn);
+ snprintf(buf, len, "stc sr, r%d", rn);
break;
case 1:
- sprintf(buf, "stc gbr, r%d", rn);
+ snprintf(buf, len, "stc gbr, r%d", rn);
break;
case 2:
- sprintf(buf, "stc vbr, r%d", rn);
+ snprintf(buf, len, "stc vbr, r%d", rn);
break;
case 3:
- sprintf(buf, "stc ssr, r%d", rn);
+ snprintf(buf, len, "stc ssr, r%d", rn);
break;
}
@@ -225,23 +225,23 @@
case 1:
switch (md) {
case 0:
- sprintf(buf, "stc spc, r%d", rn);
+ snprintf(buf, len, "stc spc, r%d", rn);
break;
}
break;
case 2:
- sprintf(buf, "stc r%d_bank, r%d", md, rn);
+ snprintf(buf, len, "stc r%d_bank, r%d", md, rn);
break;
case 3:
- sprintf(buf, "stc r%d_bank, r%d", md+4, rn);
+ snprintf(buf, len, "stc r%d_bank, r%d", md+4, rn);
break;
} /* end of switch (type) */
}
static void
-f_03(const uint16_t *pc, char *buf)
+f_03(const uint16_t *pc, char *buf, size_t len)
{
uint16_t insn = get_insn(pc);
int rn, type, md;
@@ -254,11 +254,11 @@
case 0:
switch (md) {
case 0:
- sprintf(buf, "bsrf r%d", rn);
+ snprintf(buf, len, "bsrf r%d", rn);
break;
case 2:
- sprintf(buf, "braf r%d", rn);
+ snprintf(buf, len, "braf r%d", rn);
break;
}
break;
@@ -266,7 +266,7 @@
case 2:
switch (md) {
case 0:
- sprintf(buf, "pref @r%d", rn);
+ snprintf(buf, len, "pref @r%d", rn);
break;
}
break;
@@ -275,7 +275,7 @@
static void
-f_04(const uint16_t *pc, char *buf)
+f_04(const uint16_t *pc, char *buf, size_t len)
{
uint16_t insn = get_insn(pc);
int rn, rm, md;
@@ -286,25 +286,25 @@
switch (md) {
case 0:
- sprintf(buf, "mov.b r%d, @(r0, r%d)", rm, rn);
+ snprintf(buf, len, "mov.b r%d, @(r0, r%d)", rm, rn);
break;
case 1:
- sprintf(buf, "mov.w r%d, @(r0, r%d)", rm, rn);
+ snprintf(buf, len, "mov.w r%d, @(r0, r%d)", rm, rn);
break;
case 2:
- sprintf(buf, "mov.l r%d, @(r0, r%d)", rm, rn);
+ snprintf(buf, len, "mov.l r%d, @(r0, r%d)", rm, rn);
break;
case 3:
- sprintf(buf, "mul.l r%d, r%d)", rm, rn);
+ snprintf(buf, len, "mul.l r%d, r%d)", rm, rn);
break;
} /* end of switch (md) */
}
static void
-f_08(const uint16_t *pc, char *buf)
+f_08(const uint16_t *pc, char *buf, size_t len)
{
uint16_t insn = get_insn(pc);
int n1, type, md;
@@ -320,19 +320,19 @@
case 0:
switch (md) {
case 0:
- sprintf(buf, "clrt");
+ snprintf(buf, len, "clrt");
break;
case 1:
- sprintf(buf, "sett");
+ snprintf(buf, len, "sett");
break;
Home |
Main Index |
Thread Index |
Old Index