Mechanical whistespace cleanup.

This commit is contained in:
Dag-Erling Smørgrav 2004-02-17 10:21:03 +00:00
parent 0dd2d10898
commit 963385cf22

View File

@ -245,12 +245,12 @@ sbuf_setpos(struct sbuf *s, int pos)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
KASSERT(pos >= 0,
("attempt to seek to a negative position (%d)", pos));
KASSERT(pos < s->s_size,
("attempt to seek past end of sbuf (%d >= %d)", pos, s->s_size));
if (pos < 0 || pos > s->s_len)
return (-1);
s->s_len = pos;
@ -265,10 +265,10 @@ sbuf_bcat(struct sbuf *s, const char *str, size_t len)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
if (SBUF_HASOVERFLOWED(s))
return (-1);
for (; len; len--) {
if (!SBUF_HASROOM(s) && sbuf_extend(s, len) < 0)
break;
@ -303,7 +303,7 @@ sbuf_bcopyin(struct sbuf *s, const void *uaddr, size_t len)
if (copyin(uaddr, s->s_buf + s->s_len, len) != 0)
return (-1);
s->s_len += len;
return (0);
}
#endif
@ -316,7 +316,7 @@ sbuf_bcpy(struct sbuf *s, const char *str, size_t len)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
sbuf_clear(s);
return (sbuf_bcat(s, str, len));
}
@ -329,10 +329,10 @@ sbuf_cat(struct sbuf *s, const char *str)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
if (SBUF_HASOVERFLOWED(s))
return (-1);
while (*str) {
if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0)
break;
@ -353,7 +353,7 @@ int
sbuf_copyin(struct sbuf *s, const void *uaddr, size_t len)
{
size_t done;
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
@ -376,7 +376,7 @@ sbuf_copyin(struct sbuf *s, const void *uaddr, size_t len)
default:
return (-1); /* XXX */
}
return (0);
}
#endif
@ -389,7 +389,7 @@ sbuf_cpy(struct sbuf *s, const char *str)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
sbuf_clear(s);
return (sbuf_cat(s, str));
}
@ -464,10 +464,10 @@ sbuf_putc(struct sbuf *s, int c)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
if (SBUF_HASOVERFLOWED(s))
return (-1);
if (!SBUF_HASROOM(s) && sbuf_extend(s, 1) < 0) {
SBUF_SETFLAG(s, SBUF_OVERFLOWED);
return (-1);
@ -485,10 +485,10 @@ sbuf_trim(struct sbuf *s)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
if (SBUF_HASOVERFLOWED(s))
return (-1);
while (s->s_len && isspace(s->s_buf[s->s_len-1]))
--s->s_len;
@ -512,7 +512,7 @@ sbuf_finish(struct sbuf *s)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, 0);
s->s_buf[s->s_len] = '\0';
SBUF_CLEARFLAG(s, SBUF_OVERFLOWED);
SBUF_SETFLAG(s, SBUF_FINISHED);
@ -526,7 +526,7 @@ sbuf_data(struct sbuf *s)
{
assert_sbuf_integrity(s);
assert_sbuf_state(s, SBUF_FINISHED);
return s->s_buf;
}
@ -538,7 +538,7 @@ sbuf_len(struct sbuf *s)
{
assert_sbuf_integrity(s);
/* don't care if it's finished or not */
if (SBUF_HASOVERFLOWED(s))
return (-1);
return s->s_len;
@ -554,7 +554,7 @@ sbuf_delete(struct sbuf *s)
assert_sbuf_integrity(s);
/* don't care if it's finished or not */
if (SBUF_ISDYNAMIC(s))
SBFREE(s->s_buf);
isdyn = SBUF_ISDYNSTRUCT(s);