combine-diff: replace malloc/snprintf with xstrfmt

There's no need to use the magic "100" when a strbuf can do it for us. Signed-off-by: Jeff King <peff@peff.net>

Jeff King committed Mar 28, 2017 at 15:46 UTC 0dc3b035e03a4028a22cd2a8b5f21086e3227047
1 file changed +4 -3
combine-diff.c
+4 -3
@@ -292,9 +292,10 @@ static char *grab_blob(const struct object_id *oid, unsigned int mode,
292 enum object_type type;
293
294 if (S_ISGITLINK(mode)) {
295 - blob = xmalloc(100);
296 - *size = snprintf(blob, 100,
297 - "Subproject commit %s\n", oid_to_hex(oid));
295 + struct strbuf buf = STRBUF_INIT;
296 + strbuf_addf(&buf, "Subproject commit %s\n", oid_to_hex(oid));
297 + *size = buf.len;
298 + blob = strbuf_detach(&buf, NULL);
299 } else if (is_null_oid(oid)) {
300 /* deleted blob */
301 *size = 0;