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

Re: [PATCH] reftable: pass pq_entry by address

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 15, 2022, 02:27 UTC
Message-ID
<xmqqsfktpe2o.fsf@gitster.g>
In-Reply-To
<18337ea407a.10c144c52599576.4708941661785569426@elijahpepe.com>
Elijah Conners <business@elijahpepe.com> writes:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>  > Do we have any hard guidance like "do not pass an data item whose
>  > size is larger than 64 bytes" in our coding guidelines?  If not,
>  > make sure that the reference to 64 bytes does not look like one.
> While we don't have hard guidance like that, putting an object that exceeds 64 bytes on the stack is dangerous.
>
>  > In any case, wouldn't it make sense to make the "we pass reference
>  > not because we want to let the callee modify the value, but because
>  > the callee deep in the callchain wants to copy the contents out of
>  > it" parameter a pointer to a constant? 
> Yes. I overlooked that making this change. Feel free to make that change, otherwise I'll do it myself.

OK, will wait for an updated patch that corrects the proposed log message (i.e. not to say "size is larger than 64 bytes hence this is bad") with a const pointer.

Note that this project tries to avoid piling "oops the previous one was wrong, and this is a fix" patches on top of earlier patch that are faulty or suboptimal. Instead "v2" and later patches are written as if an earlier iteration never happened, i.e. allowing the author to pretend to be perfect human ;-).

Thanks.
Previous: Han-Wen NienhuysNext: Elijah Conners
Message 8 of 9 in “reftable: pass pq_entry by address”
  1. reftable: pass pq_entry by addressElijah Conners, Sep 13, 2022
  2. Han-Wen NienhuysSep 13, 2022
  3. Junio C HamanoSep 13, 2022
  4. Elijah ConnersSep 13, 2022
  5. Han-Wen NienhuysSep 13, 2022
  6. Elijah ConnersSep 13, 2022
  7. Han-Wen NienhuysSep 15, 2022
  8. Junio C HamanoSep 15, 2022
  9. reftable: use const with the pq_entry paramElijah Conners, Sep 14, 2022

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.