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

Re: [PATCH v3 5/8] evolve: Add the change-table structure

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 29, 2019, 18:02 UTC
Message-ID
<xmqqef8v8hqp.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPL8ZiuKnvQd1tpbsT+xn2Dt0rMs_ggQKOSz_vMda3i1V1YfHQ@mail.gmail.com>
Stefan Xenos <sxenos@google.com> writes:
Show 9 quoted lines
> Sorry, folks. I normally can't do any open source work on weekdays.
> That also includes writing responses on the mailing list, so there
> will normally be a week or two lag for me to iterate on this sort of
> thing.
>
> Feel free to either include this fix or revert my patch if there's a
> problem with it - just let me know what you selected. I'll roll with
> it and either resubmit with the requested changes or submit the
> requested changes as follow-ups.

I think double casting Dscho did was not his ideal "fix" but he did it as a mere workaround to force the 'pu' branch to compile. And I also agree with him that the double casting workaround is too ugly to live, compared to a union he suggests. So I'd rather kick the branch out of 'pu' for now.

Thanks, both.
Show 54 quoted lines
>
>   - Stefan
>
> On Mon, Jan 28, 2019 at 3:08 PM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
>>
>> Hi Junio,
>>
>> On Mon, 28 Jan 2019, Johannes Schindelin wrote:
>>
>> > On Sun, 27 Jan 2019, sxenos@google.com wrote:
>> >
>> > > +   new_item->util = (void*)index;
>> >
>> > This is not good. You are using a `long` here. The 80s called and want
>> > their now-obsolete data types back.
>> >
>> > If you want a data type that can take an integer but also a pointer, use
>> > `intptr_t` instead.
>> >
>> > But even that is not good practice. What you really want here is to use a
>> > union of the data types that you want to store in that `util` field.
>> >
>> > This is not merely academic, your code causes compile errors on Windows:
>> >
>> > https://dev.azure.com/gitgitgadget/git/_build/results?buildId=400&view=logs&jobId=fd490c07-0b22-5182-fac9-6d67fe1e939b&taskId=ce91d5d6-0c55-50f5-8ab9-6695c03ab102&lineStart=430&lineEnd=440&colStart=1&colEnd=1
>>
>> Since Stefan did not grace us with an answer, Junio, could I ask you to
>> squash this in (which is by no means a satisfactory fix, but it is a
>> stopgap to get `pu` building again)?
>>
>> -- snipsnap --
>> diff --git a/change-table.c b/change-table.c
>> index 2e0d935de846..197ce2783532 100644
>> --- a/change-table.c
>> +++ b/change-table.c
>> @@ -103,7 +103,7 @@ void change_table_add(struct change_table *to_modify, const char *refname,
>>         new_head->hidden = starts_with(refname, "refs/hiddenmetas/");
>>
>>         new_item = string_list_insert(&to_modify->refname_to_change_head, refname);
>> -       new_item->util = (void*)index;
>> +       new_item->util = (void *)(intptr_t)index;
>>         // Use pointers to the copy of the string we're retaining locally
>>         refname = new_item->string;
>>
>> @@ -201,6 +201,6 @@ struct change_head* get_change_head(struct change_table *heads,
>>                 return NULL;
>>         }
>>
>> -       index = (long)item->util;
>> +       index = (long)(intptr_t)item->util;
>>         return &(heads->heads.array[index]);
>>  }
>>
Previous: Stefan XenosNext: Stefan Xenos
Message 11 of 15 in “technical doc: add a design doc for the evolve command”
  1. 1/8 technical doc: add a design doc for the evolve commandsxenos@google.com, Jan 27, 2019
  2. 2/8 sha1-array: Implement oid_array_readonly_containssxenos@google.com, Jan 27, 2019
  3. Junio C HamanoJan 28, 2019
  4. 3/8 ref-filter: Add the metas namespace to ref-filtersxenos@google.com, Jan 27, 2019
  5. 4/8 evolve: Add support for parsing metacommitssxenos@google.com, Jan 27, 2019
  6. Junio C HamanoJan 28, 2019
  7. 5/8 evolve: Add the change-table structuresxenos@google.com, Jan 27, 2019
  8. Johannes SchindelinJan 28, 2019
  9. Johannes SchindelinJan 28, 2019
  10. Stefan XenosJan 28, 2019
  11. Junio C HamanoJan 29, 2019
  12. Stefan XenosJan 29, 2019
  13. 6/8 evolve: Add support for writing metacommitssxenos@google.com, Jan 27, 2019
  14. 7/8 evolve: Implement the git change commandsxenos@google.com, Jan 27, 2019
  15. 8/8 evolve: Add the git change list commandsxenos@google.com, Jan 27, 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.