Re: [PATCH v2 3/8] midx: preliminary support for `--refs-snapshot`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A small nitpick for this patch:

On 2021.09.15 14:24, Taylor Blau wrote:
> diff --git a/midx.c b/midx.c
> index 0330202fda..97ba3421f2 100644
> --- a/midx.c
> +++ b/midx.c
> @@ -968,7 +968,42 @@ static void bitmap_show_commit(struct commit *commit, void *_data)
>  	data->commits[data->commits_nr++] = commit;
>  }
>  
> +static int read_refs_snapshot(const char *refs_snapshot,
> +			      struct rev_info *revs)
> +{
> +	struct strbuf buf = STRBUF_INIT;
> +	struct object_id oid;
> +	FILE *f = xfopen(refs_snapshot, "r");
> +
> +	while (strbuf_getline(&buf, f) != EOF) {
> +		struct object *object;
> +		int preferred = 0;
> +		char *hex = buf.buf;
> +		const char *end = NULL;
> +
> +		if (buf.len && *buf.buf == '+') {
> +			preferred = 1;
> +			hex = &buf.buf[1];
> +		}
> +
> +		if (parse_oid_hex(hex, &oid, &end) < 0)
> +			die(_("could not parse line: %s"), buf.buf);
> +		if (*end)
> +			die(_("malformed line: %s"), buf.buf);
> +
> +		object = parse_object_or_die(&oid, NULL);
> +		if (preferred)
> +			object->flags |= NEEDS_BITMAP;
> +
> +		add_pending_object(revs, object, "");
> +	}
> +
> +	fclose(f);
> +	return 0;
> +}

`buf` needs to be released here.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux