Re: [PATCH 08/21] remote: let guess_remote_head() optionally return all matches

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

 



On Wed, Feb 25, 2009 at 03:32:15AM -0500, Jay Soffian wrote:

> +struct ref *copy_ref_with_peer(const struct ref *src)
> +{
> +	struct ref *dst = copy_ref(src);
> +	dst->peer_ref = copy_ref(src->peer_ref);
> +	return dst;
> +}

Hmm. This should probably be:

  dst->peer_ref = src->peer_ref ? copy_ref(src->peer_ref) : NULL;

(or copy_ref should return NULL when given NULL). I also wonder if the
copied ref's peer_ref should be explicitly NULL'd.

I don't think it matters for the current code, since we always feed it
"matched refs" which have a peer, but I think it is good to be a little
more defensive in such a generically-named function.

And yes, this bug was in my original patch. :)

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

  Powered by Linux