summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-08-07 14:05:00 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-08-07 14:05:00 +0000
commit49680bcbab397ab3555526324ca55bceb8941c0c (patch)
tree6da8381ef02d1b4a49ca1b5dd5843db3c626e9c3 /usr.sbin
parentd5dce99a695d532b7c202b86c3bf37f0f3e3452e (diff)
Do not hardcode the key length.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/btrace/btrace.c6
-rw-r--r--usr.sbin/btrace/btrace.h4
-rw-r--r--usr.sbin/btrace/map.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c
index 63fa20db2a2..680833e9bd6 100644
--- a/usr.sbin/btrace/btrace.c
+++ b/usr.sbin/btrace/btrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btrace.c,v 1.21 2020/07/11 14:52:14 mpi Exp $ */
+/* $OpenBSD: btrace.c,v 1.22 2020/08/07 14:04:59 mpi Exp $ */
/*
* Copyright (c) 2019 - 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -860,7 +860,7 @@ ba_read(struct bt_arg *ba)
const char *
ba2hash(struct bt_arg *ba, struct dt_evt *dtev)
{
- static char buf[256];
+ static char buf[KLEN];
char *hash;
int l, len;
@@ -905,7 +905,7 @@ const char *
ba2bucket(struct bt_arg *ba, struct bt_arg *brange, struct dt_evt *dtev,
long *pstep)
{
- static char buf[256];
+ static char buf[KLEN];
long val, bucket;
int l;
diff --git a/usr.sbin/btrace/btrace.h b/usr.sbin/btrace/btrace.h
index cd9001a44d8..1cbbbf8d525 100644
--- a/usr.sbin/btrace/btrace.h
+++ b/usr.sbin/btrace/btrace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: btrace.h,v 1.6 2020/07/11 14:52:14 mpi Exp $ */
+/* $OpenBSD: btrace.h,v 1.7 2020/08/07 14:04:59 mpi Exp $ */
/*
* Copyright (c) 2019 - 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -51,6 +51,8 @@ void map_zero(struct map *);
struct hist *hist_increment(struct hist *, const char *, long);
void hist_print(struct hist *, const char *);
+#define KLEN 512 /* number of characters in a key */
+
/* printf.c */
int stmt_printf(struct bt_stmt *, struct dt_evt *);
diff --git a/usr.sbin/btrace/map.c b/usr.sbin/btrace/map.c
index 86dca1bc86c..f0e9cac1672 100644
--- a/usr.sbin/btrace/map.c
+++ b/usr.sbin/btrace/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.8 2020/07/11 14:52:14 mpi Exp $ */
+/* $OpenBSD: map.c,v 1.9 2020/08/07 14:04:59 mpi Exp $ */
/*
* Copyright (c) 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -43,8 +43,6 @@
RB_HEAD(map, mentry);
-#define KLEN 256
-
struct mentry {
RB_ENTRY(mentry) mlink;
char mkey[KLEN];