Re: [PATCH 06/11] streaming: a new API to read from the object store

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

 



On Sun, May 15, 2011 at 05:30:26PM -0700, Junio C Hamano wrote:

> +struct git_istream *open_istream(const unsigned char *sha1,
> +				 enum object_type *type,
> +				 unsigned long *sz)
> +{
> +	struct git_istream *st;
> +	struct object_info oi;
> +	const unsigned char *real = lookup_replace_object(sha1);
> +	enum input_source src = istream_source(real, type, &oi);
> +
> +	if (src < 0)
> +		return NULL;
> +
> +	st = xmalloc(sizeof(*st));
> +	st->source = src;
> +	if (open_istream_tbl[src](st, &oi, real, type, sz)) {
> +		if (open_istream_incore(st, &oi, real, type, sz)) {
> +			free(st);
> +			st = NULL;
> +		}
> +	}
> +	return st;
> +}

I assume the "sz" parameter is meant to be an output parameter with the
total size of the object. The open_istream_incore function fills it in
properly. But later, when you add open_istream_loose and
open_istream_pack_non_delta, neither of them actually touches the "sz"
parameter at all. So code like:

  struct git_istream *st;
  enum object_type type;
  unsigned long size;
  st = open_istream(sha1, &type, &size);

may or may not have "size" meaningful at this point, which seems like a
bug.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]