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

Re: [PATCH] prio-queue: use size_t rather than int for size

From
Jeff King <peff@peff.net>
Date
Dec 27, 2024, 14:34 UTC
Message-ID
<20241227143440.GB88306@coredump.intra.peff.net>
In-Reply-To
<Z25-PaOQg7lAeyxx@pks.im>
On Fri, Dec 27, 2024 at 11:15:31AM +0100, Patrick Steinhardt wrote:
Show 9 quoted lines
> On Fri, Dec 20, 2024 at 03:49:49AM -0500, Jeff King wrote:
> [snip]
> >   4. The insertion_ctr variable is currently unsigned, but can likewise
> >      grow (it is actually worse, because adding and removing an element
> >      many times will keep increasing the counter, even though "nr" does
> >      not). I've bumped that to size_t here, as well.
> 
> I agree that bumping it to `size_t` would be sensible, but it doesn't
> look like you actually followed through with that change, as...

Doh, good catch. I had backed it out temporarily to confirm that it was a problem even before the patch, but accidentally ended up with the wrong state in the commit.

Show 5 quoted lines
> I was surprised by how few callers there are required any changes due to
> `.nr` changing. I scanned through the code and found one more instance
> where we have to adapt code, in commit-reach.c:queue_has_nonstale(). The
> compiler does not generate warnings for this case because the file isn't
> -Wsign-compare clean yet.
Makes sense.
> Anyway, I see that the patch has landed in "master" already. Let me send
> a follow-up patch series to fix both issues.
Thanks!
-Peff
Previous: Patrick Steinhardt
Message 6 of 6 in “prio-queue: use size_t rather than int for size”
  1. prio-queue: use size_t rather than int for sizeJeff King, Dec 20, 2024
  2. Jeff KingDec 20, 2024
  3. Junio C HamanoDec 20, 2024
  4. Jeff KingDec 20, 2024
  5. Patrick SteinhardtDec 27, 2024
  6. Jeff KingDec 27, 2024

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.