strbuf_addstr(&res, one);
strbuf_addstr(&res, two);
}
- return res.buf;
+ return strbuf_detach(&res, NULL);
}
static const char *external_diff(void)
quote_c_style(a, &name, NULL, 0);
strbuf_addstr(&name, " => ");
quote_c_style(b, &name, NULL, 0);
- return name.buf;
+ return strbuf_detach(&name, NULL);
}
/* Find common prefix */
strbuf_addch(&name, '}');
strbuf_add(&name, a + len_a - sfx_length, sfx_length);
}
- return name.buf;
+ return strbuf_detach(&name, NULL);
}
struct diffstat_t {
strbuf_init(&buf, 0);
if (quote_c_style(file->name, &buf, NULL, 0)) {
free(file->name);
- file->name = buf.buf;
+ file->name = strbuf_detach(&buf, NULL);
} else {
strbuf_release(&buf);
}
strerror(errno));
s->should_munmap = 0;
- s->size = buf.len;
- s->data = strbuf_detach(&buf);
+ s->data = strbuf_detach(&buf, &s->size);
s->should_free = 1;
return 0;
}
if (convert_to_git(s->path, s->data, s->size, &buf)) {
munmap(s->data, s->size);
s->should_munmap = 0;
- s->data = buf.buf;
- s->size = buf.len;
+ s->data = strbuf_detach(&buf, &s->size);
s->should_free = 1;
}
}