Lines Matching defs:sb
26 * strbuf_grow(sb, SOME_SIZE);
27 * ... Here, the memory array starting at sb->buf, and of length
28 * ... strbuf_avail(sb) is all yours, and you are sure that
29 * ... strbuf_avail(sb) is at least SOME_SIZE.
30 * strbuf_setlen(sb, sb->len + SOME_OTHER_SIZE);
32 * Of course, SOME_OTHER_SIZE must be smaller or equal to strbuf_avail(sb).
64 static inline ssize_t strbuf_avail(const struct strbuf *sb) {
65 return sb->alloc ? sb->alloc - sb->len - 1 : 0;
70 static inline int strbuf_setlen(struct strbuf *sb, size_t len) {
71 if (!sb->alloc) {
72 int ret = strbuf_grow(sb, 0);
76 assert(len < sb->alloc);
77 sb->len = len;
78 sb->buf[len] = '\0';
83 int strbuf_addch(struct strbuf *sb, int c);
86 static inline int strbuf_addstr(struct strbuf *sb, const char *s) {
87 return strbuf_add(sb, s, strlen(s));
90 int strbuf_addf(struct strbuf *sb, const char *fmt, ...) __printf(2, 3);