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.
This commit is contained in:
des 2004-07-09 11:35:30 +00:00
parent 6c7bd73286
commit 3bf01ad1d7
2 changed files with 7 additions and 5 deletions

View File

@ -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));
}
/*

View File

@ -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);