git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] pack-objects: don't loosen objects available in alternate or kept packs

From
Nicolas Pitre <nico@cam.org>
Date
Mar 22, 2009, 17:40 UTC
Message-ID
<alpine.LFD.2.00.0903221325380.30483@xanadu.home>
In-Reply-To
<ee63ef30903220748q4e78e626t2ea3930809a670d6@mail.gmail.com>
On Sun, 22 Mar 2009, Brandon Casey wrote:
Show 19 quoted lines
> >> +static int has_sha1_pack_kept_or_nonlocal(const unsigned char *sha1)
> >> +{
> >> +     static struct packed_git *last_found = (void *)1;
> >> +     struct packed_git *p;
> >> +
> >> +     p = (last_found == (void *)1) ? packed_git : last_found;
> >
> > Why (void *)1, not like:
> >
> >        static struct packed_git *last_found;
> >        struct packed_git *p = last_found ? last_found : packed_git;
> >
> > Am I missing something?
> 
> Heh, I am missing something too.  Maybe I should have _thought_ more
> about this code that I copied from sha1_file.c: find_pack_entry() and
> I would have asked the same question about _that_ code.
> 
> Maybe Nico has some idea?

Well... I know this is my code, and I must have had a reason to keep the NULL pointer distinct from the initial value. But at the moment I just can't remember about it, and the code doesn't show a need for it either.

Nicolas
Previous: Brandon CaseyNext: Junio C Hamano
Message 4 of 7 in “pack-objects: don't loosen objects available in alternate or kept packs”
  1. 2/2 pack-objects: don't loosen objects available in alternate or kept packsBrandon Casey, Mar 21, 2009
  2. Junio C HamanoMar 22, 2009
  3. Brandon CaseyMar 22, 2009
  4. Nicolas PitreMar 22, 2009
  5. Junio C HamanoMar 22, 2009
  6. Nicolas PitreMar 22, 2009
  7. Brandon CaseyMar 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.