• Home
  • Raw
  • Download

Lines Matching refs:len

22 	sb->alloc = sb->len = 0;  in strbuf_init()
40 *sz = sb->len; in strbuf_detach()
47 if (sb->len + extra + 1 <= sb->len) in strbuf_grow()
51 ALLOC_GROW(sb->buf, sb->len + extra + 1, sb->alloc); in strbuf_grow()
54 static void strbuf_splice(struct strbuf *sb, size_t pos, size_t len, in strbuf_splice() argument
57 if (pos + len < pos) in strbuf_splice()
59 if (pos > sb->len) in strbuf_splice()
61 if (pos + len > sb->len) in strbuf_splice()
64 if (dlen >= len) in strbuf_splice()
65 strbuf_grow(sb, dlen - len); in strbuf_splice()
67 sb->buf + pos + len, in strbuf_splice()
68 sb->len - pos - len); in strbuf_splice()
70 strbuf_setlen(sb, sb->len + dlen - len); in strbuf_splice()
73 void strbuf_remove(struct strbuf *sb, size_t pos, size_t len) in strbuf_remove() argument
75 strbuf_splice(sb, pos, len, NULL, 0); in strbuf_remove()
78 void strbuf_add(struct strbuf *sb, const void *data, size_t len) in strbuf_add() argument
80 strbuf_grow(sb, len); in strbuf_add()
81 memcpy(sb->buf + sb->len, data, len); in strbuf_add()
82 strbuf_setlen(sb, sb->len + len); in strbuf_add()
87 int len; in strbuf_addf() local
93 len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); in strbuf_addf()
95 if (len < 0) in strbuf_addf()
97 if (len > strbuf_avail(sb)) { in strbuf_addf()
98 strbuf_grow(sb, len); in strbuf_addf()
100 len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap); in strbuf_addf()
102 if (len > strbuf_avail(sb)) { in strbuf_addf()
106 strbuf_setlen(sb, sb->len + len); in strbuf_addf()
111 size_t oldlen = sb->len; in strbuf_read()
118 cnt = read(fd, sb->buf + sb->len, sb->alloc - sb->len - 1); in strbuf_read()
128 sb->len += cnt; in strbuf_read()
132 sb->buf[sb->len] = '\0'; in strbuf_read()
133 return sb->len - oldlen; in strbuf_read()