From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Jim Meyering <meyering@redhat.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] * remote.c (valid_fetch_refspec): remove useless if-before-free test
Date: Wed, 20 Aug 2008 19:42:30 -0700 [thread overview]
Message-ID: <7vpro3ks15.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <aS-Yl0OfC9_Ks79Dz2qAKZMrGX1F6_mTNtSFuB45LyarCC5Zmb8agA@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Wed, 20 Aug 2008 19:33:11 -0500")
Brandon Casey <casey@nrlssc.navy.mil> writes:
>> Are you sure all the codepaths that stuff refspec[].{src,dst} give
>> freeable pointer?
>
> remote.c:parse_refspec_internal() always does. This function is the
> producer of the refspec that is being passed to free_refspecs() in the two
> places where the patch called it.
>
> The code paths for each additionally use of free_refspecs would have to
> check that it is safe. Perhaps a comment is in order.
>
> If you don't think we're ready for free_refspecs we can still call free()
> manually in the two places I called free_refspecs.
Thanks.
A generic helper like this is preferable, as long as (1) you made sure
existing callsites are safe, and (2) the helper is clearly commented
against misuse by future callsites.
I personally do not think it would be a bad idea to even make a rule that
refspec[].{src,dst} _must_ be freeable pointers. After all, we may have
to deal with repositories with insane number of refs (not in millions but
certainly in thousands), but it would be insane to have a remote with
insane number of refspecs (even in hundreds).
next prev parent reply other threads:[~2008-08-21 2:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 18:46 [PATCH] * remote.c (valid_fetch_refspec): remove useless if-before-free test Jim Meyering
2008-08-20 19:40 ` Alex Riesen
2008-08-20 20:22 ` Jim Meyering
2008-08-20 23:38 ` Brandon Casey
2008-08-21 0:16 ` Junio C Hamano
2008-08-21 0:33 ` Brandon Casey
2008-08-21 2:42 ` Junio C Hamano [this message]
2008-08-22 0:16 ` [PATCH] remote.c: add a function for deleting a refspec array and use it (twice) Brandon Casey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vpro3ks15.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=casey@nrlssc.navy.mil \
--cc=git@vger.kernel.org \
--cc=meyering@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).