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

Re: [PATCH] oidmap.h: strongly discourage using OIDMAP_INIT directly

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 22, 2017, 20:12 UTC
Message-ID
<xmqqlghur08f.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171222171635.GA230194@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 11 quoted lines
>> -#define OIDMAP_INIT { { NULL } }
>> +/*
>> + * This macro initializes the data structure only incompletely, just enough
>> + * to call oidmap_get() on an empty map. Use oidmap_init() instead.
>> + */
>> +#define OIDMAP_INIT_INCOMPLETELY { { NULL } }
>
> This is one way of approaching the problem.  Couldn't we also take the
> approach like we have with oidset and ensure that when oidmap_get() or
> _put() are called that if the oidmap isn't initialized, we simply do
> that then?
Hmph.  Can you show how the alternative code would look like?
Previous: Brandon WilliamsNext: Brandon Williams
Message 3 of 8 in “oidmap.h: strongly discourage using OIDMAP_INIT directly”
  1. oidmap.h: strongly discourage using OIDMAP_INIT directlyJohannes Schindelin, Dec 22, 2017
  2. Brandon WilliamsDec 22, 2017
  3. Junio C HamanoDec 22, 2017
  4. oidmap: ensure map is initializedBrandon Williams, Dec 22, 2017
  5. Johannes SchindelinDec 23, 2017
  6. Junio C HamanoDec 27, 2017
  7. Johannes SchindelinDec 23, 2017
  8. Jeff HostetlerJan 2, 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.