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

Re: [PATCH 1/4] write_idx_file should use an unsigned nr_objects parameter

From
Dan McGee <dpmcgee@gmail.com>
Date
Apr 1, 2011, 18:36 UTC
Message-ID
<AANLkTi=ZxV5WbDhhZG1SnS9W+MMhwpf-jdoKwdAD=zWN@mail.gmail.com>
In-Reply-To
<7vtyehg71w.fsf@alter.siamese.dyndns.org>
On Fri, Apr 1, 2011 at 1:28 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Dan McGee <dpmcgee@gmail.com> writes:
>
>> This follows the precedent set in the pack-objects code and being
>> adjusted for in index-pack and unpack-objects.
>
> Eh, why?  The use of a fixed-width type in the existing code is mostly to
> make sure that the on-disk result will fit within the on-disk field.  The
> variables like iteration counter "i" we use in write_idx_file() need to be
> at least as wide but there is no reason to forbid the compiler from using
> the natural interger type as long as it is more suiable on the platform,
> no?

Hmm. when making this patch, I thought it was required due to the other ones in this sequence or I was seeing compile errors. Reverting it seems to prove otherwise, as things compile just fine...

Either way, it should at least be an unsigned parameter of at least int length, no? The current parameter is signed, so 'unsigned' might make sense here.

-Dan
Previous: Junio C Hamano
Message 6 of 6 in “write_idx_file should use an unsigned nr_objects parameter”
  1. 1/4 write_idx_file should use an unsigned nr_objects parameterDan McGee, Mar 31, 2011
  2. 2/4 Use uint32_t for unpack-objects countersDan McGee, Mar 31, 2011
  3. 3/4 Use uint32_t for index-pack countersDan McGee, Mar 31, 2011
  4. 4/4 Unify pack header checking between index-pack and unpack-objectsDan McGee, Mar 31, 2011
  5. Junio C HamanoApr 1, 2011
  6. Dan McGeeApr 1, 2011

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.