#endif
int vsb_putc(struct vsb *, int);
int vsb_trim(struct vsb *);
-int vsb_overflowed(struct vsb *);
+int vsb_overflowed(const struct vsb *);
void vsb_finish(struct vsb *);
char *vsb_data(struct vsb *);
int vsb_len(struct vsb *);
-int vsb_done(struct vsb *);
+int vsb_done(const struct vsb *);
void vsb_delete(struct vsb *);
#ifdef __cplusplus
};
#define VSB_ISFINISHED(s) ((s)->s_flags & VSB_FINISHED)
#define VSB_HASOVERFLOWED(s) ((s)->s_flags & VSB_OVERFLOWED)
#define VSB_HASROOM(s) ((s)->s_len < (s)->s_size - 1)
-#define VSB_FREESPACE(s) ((s)->s_size - (s)->s_len - 1)
+#define VSB_FREESPACE(s) ((s)->s_size - ((s)->s_len + 1))
#define VSB_CANEXTEND(s) ((s)->s_flags & VSB_AUTOEXTEND)
/*
return (-1);
}
if (c != '\0')
- s->s_buf[s->s_len++] = c;
+ s->s_buf[s->s_len++] = (char)c;
return (0);
}
* Check if an vsb overflowed
*/
int
-vsb_overflowed(struct vsb *s)
+vsb_overflowed(const struct vsb *s)
{
return VSB_HASOVERFLOWED(s);
}
* Check if an vsb has been finished.
*/
int
-vsb_done(struct vsb *s)
+vsb_done(const struct vsb *s)
{
return(VSB_ISFINISHED(s));