diff options
author | des <des@FreeBSD.org> | 2004-07-09 11:35:30 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2004-07-09 11:35:30 +0000 |
commit | 3bf01ad1d705bd4ba0c11b8215b8c379d796ceab (patch) | |
tree | c38c9ee2985b996ebe39725d57fd9cf5596b3943 | |
parent | 6c7bd732862424f5dc31c4f693756e0845eafcac (diff) | |
download | FreeBSD-src-3bf01ad1d705bd4ba0c11b8215b8c379d796ceab.zip FreeBSD-src-3bf01ad1d705bd4ba0c11b8215b8c379d796ceab.tar.gz |
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.
-rw-r--r-- | sys/kern/subr_sbuf.c | 8 | ||||
-rw-r--r-- | 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 e3f61ba..312e28f 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 606c1ca..0c1e6e1 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); |