From d751f0a93513416334158d9de5ff0e4f990362c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 9 Jul 2004 11:35:30 +0000 Subject: [PATCH] Have sbuf_bcat() and sbuf_bcpy() take a const void * instead of a const char *, since callers are likely to pass in pointers to all kinds of structs and whatnot. --- sys/kern/subr_sbuf.c | 8 +++++--- sys/sys/sbuf.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index e3f61bac84a3..312e28f62c1f 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -261,8 +261,10 @@ sbuf_setpos(struct sbuf *s, int pos) * Append a byte string to an sbuf. */ int -sbuf_bcat(struct sbuf *s, const char *str, size_t len) +sbuf_bcat(struct sbuf *s, const void *data, size_t len) { + const char *str = data; + assert_sbuf_integrity(s); assert_sbuf_state(s, 0); @@ -312,13 +314,13 @@ sbuf_bcopyin(struct sbuf *s, const void *uaddr, size_t len) * Copy a byte string into an sbuf. */ int -sbuf_bcpy(struct sbuf *s, const char *str, size_t len) +sbuf_bcpy(struct sbuf *s, const void *data, size_t len) { assert_sbuf_integrity(s); assert_sbuf_state(s, 0); sbuf_clear(s); - return (sbuf_bcat(s, str, len)); + return (sbuf_bcat(s, data, len)); } /* diff --git a/sys/sys/sbuf.h b/sys/sys/sbuf.h index 606c1ca91fee..0c1e6e1e0cf8 100644 --- a/sys/sys/sbuf.h +++ b/sys/sys/sbuf.h @@ -58,8 +58,8 @@ __BEGIN_DECLS struct sbuf *sbuf_new(struct sbuf *, char *, int, int); void sbuf_clear(struct sbuf *); int sbuf_setpos(struct sbuf *, int); -int sbuf_bcat(struct sbuf *, const char *, size_t); -int sbuf_bcpy(struct sbuf *, const char *, size_t); +int sbuf_bcat(struct sbuf *, const void *, size_t); +int sbuf_bcpy(struct sbuf *, const void *, size_t); int sbuf_cat(struct sbuf *, const char *); int sbuf_cpy(struct sbuf *, const char *); int sbuf_printf(struct sbuf *, const char *, ...) __printflike(2, 3);