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

Re: [PATCH v2 1/1] Use size_t instead of 'unsigned long' for data in memory

From
Derrick Stolee <stolee@gmail.com>
Date
Nov 21, 2018, 11:55 UTC
Message-ID
<17c472c4-34be-390d-947f-ff998398295c@gmail.com>
In-Reply-To
<20181120050456.16715-1-tboegi@web.de>
On 11/20/2018 12:04 AM, tboegi@web.de wrote:
Show 9 quoted lines
> From: Torsten Bögershausen <tboegi@web.de>
>
> Currently the length of data which is stored in memory is stored
> in "unsigned long" at many places in the code base.
> This is OK when both "unsigned long" and size_t are 32 bits,
> (and is OK when both are 64 bits).
> On a 64 bit Windows system am "unsigned long" is 32 bit, and
> that may be too short to measure the size of objects in memory,
> a size_t is the natural choice.

Is this change enough to store 4GB files on Windows? Or is there more to do?

Show 8 quoted lines
> Thanks for all the comments on V1.
> Changes since V1:
> - Make the motivation somewhat clearer in the commit message
> - Rebase to the November 19 pu
>
> What we really need for this patch to fly are this branches:
> mk/use-size-t-in-zlib
> tb/print-size-t-with-uintmax-format

I believe communicating these direct dependencies is the correct way to go, and the rebase you mentioned is unnecessary (instead, test with a merge).

Hopefully the patch applies on top of a merge of those branches.
Show 7 quoted lines
> @@ -529,7 +530,7 @@ static void *unpack_raw_entry(struct object_entry *obj,
>   }
>   
>   static void *unpack_data(struct object_entry *obj,
> -			 int (*consume)(const unsigned char *, unsigned long, void *),
> +			 int (*consume)(const unsigned char *, size_t, void *),
>   			 void *cb_data)

This is the only instance that is not paired directly with a variable name like "size", "sz", or "len". However, it appears to be correct from context.

Thanks for this!
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Previous: tboegi@web.deNext: Thomas Braun
Message 9 of 13 in “Use size_t instead of unsigned long”
  1. 1/1 Use size_t instead of unsigned longtboegi@web.de, Nov 17, 2018
  2. Derrick StoleeNov 18, 2018
  3. Junio C HamanoNov 18, 2018
  4. Torsten BögershausenNov 19, 2018
  5. René ScharfeNov 19, 2018
  6. Torsten BögershausenNov 19, 2018
  7. Junio C HamanoNov 20, 2018
  8. 1/1 Use size_t instead of 'unsigned long' for data in memorytboegi@web.de, Nov 20, 2018
  9. Derrick StoleeNov 21, 2018
  10. Thomas BraunJan 16, 2019
  11. Torsten BögershausenJan 19, 2019
  12. Thomas BraunJan 22, 2019
  13. 1/1 Use size_t instead of 'unsigned long' for data in memorytboegi@web.de, Apr 13, 2019

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.