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

Re: [PATCH v2] packfile: Correct zlib buffer handling

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 13, 2018, 18:32 UTC
Message-ID
<xmqqy3fi5ygz.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cQ1s7QFjEFrOHMYZR8qja5yTjV5D3ksUXXqFL61YthA3g@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 8 quoted lines
> A couple comments if you happen to re-roll...
>
> On Wed, Jun 13, 2018 at 10:22 AM Jeremy Linton <lintonrjeremy@gmail.com> wrote:
>> The buffer being passed to zlib includes a null terminator that
>
> On this project, the character mnemonic "NUL" is typically used, not
> "null" or "NULL" (which is typically reserved for pointers), so:
> s/null/NUL/g

Correct but I did not think it is a per-project preference; rather, "NUL is the name of the byte" is universal ;-)

Show 10 quoted lines
>> diff --git a/packfile.c b/packfile.c
>> @@ -1433,6 +1433,8 @@ static void *unpack_compressed_entry(struct packed_git *p,
>> +       buffer[size] = 0; /* assure that the buffer is still terminated */
>
> I think we normally use '\0' for NUL on this project rather than simply 0.
>
> The comment is also effectively pure noise since it merely repeats
> what the code already states clearly (especially when the code says
> "buffer[size] = '\0';"), so dropping the comment altogether would be
> reasonable.
Both are sensible suggestions.  Thanks for making them.
Previous: Eric SunshineNext: Eric Sunshine
Message 3 of 7 in “packfile: Correct zlib buffer handling”
  1. packfile: Correct zlib buffer handlingJeremy Linton, Jun 13, 2018
  2. Eric SunshineJun 13, 2018
  3. Junio C HamanoJun 13, 2018
  4. Eric SunshineJun 13, 2018
  5. Junio C HamanoJun 13, 2018
  6. Jeremy LintonJun 13, 2018
  7. Junio C HamanoJun 13, 2018

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.