long wrote;
switch (ntohl(ce->ce_mode) & S_IFMT) {
- char *buf, *new;
+ char *new;
+ struct strbuf buf;
unsigned long size;
case S_IFREG:
/*
* Convert from git internal format to working tree format
*/
- buf = convert_to_working_tree(ce->name, new, &size);
- if (buf) {
+ strbuf_init(&buf, 0);
+ if (convert_to_working_tree(ce->name, new, size, &buf)) {
+ size_t newsize = 0;
free(new);
- new = buf;
+ new = strbuf_detach(&buf, &newsize);
+ size = newsize;
}
if (to_tempfile) {