Re: [PATCH 04/10] combine-diff.c: convert trivial snprintf calls to xsnprintf
- From
Jeff King <peff@peff.net>
- Date
- Jun 3, 2016, 08:54 UTC
- Message-ID
- <20160603085441.GD28401@sigill.intra.peff.net>
- In-Reply-To
- <20160603074724.12173-4-gitter.spiros@gmail.com>
On Fri, Jun 03, 2016 at 07:47:18AM +0000, Elia Pinto wrote:
Show 11 quoted lines
> diff --git a/combine-diff.c b/combine-diff.c
> index 8f2313d..a91d9b3 100644
> --- a/combine-diff.c
> +++ b/combine-diff.c
> @@ -293,7 +293,7 @@ static char *grab_blob(const struct object_id *oid, unsigned int mode,
>
> if (S_ISGITLINK(mode)) {
> blob = xmalloc(100);
> - *size = snprintf(blob, 100,
> + *size = xsnprintf(blob, 100,
> "Subproject commit %s\n", oid_to_hex(oid));This one seems like a no-brainer to convert to xstrmft(), since we're already using a heap buffer, and then we can get rid of that meaningless "100" magic number.
-Peff