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

Re: [PATCH] oidset: don't return value from oidset_init

From
Johannes Sixt <j6t@kdbg.org>
Date
Jan 9, 2018, 07:33 UTC
Message-ID
<63acb4e5-4ebe-0fc3-a9ba-8141cceeee0c@kdbg.org>
In-Reply-To
<xmqqincc6if3.fsf@gitster.mtv.corp.google.com>
Am 09.01.2018 um 00:26 schrieb Junio C Hamano:
Show 20 quoted lines
> Thomas Gummerer <t.gummerer@gmail.com> writes:
> 
>> c3a9ad3117 ("oidset: add iterator methods to oidset", 2017-11-21)
>> introduced a 'oidset_init()' function in oidset.h, which has void as
>> return type, but returns an expression.
>> ...
>> diff --git a/oidset.h b/oidset.h
>> index 783abceccd..40ec5f87fe 100644
>> --- a/oidset.h
>> +++ b/oidset.h
>> @@ -27,7 +27,7 @@ struct oidset {
>>   
>>   static inline void oidset_init(struct oidset *set, size_t initial_size)
>>   {
>> -	return oidmap_init(&set->map, initial_size);
>> +	oidmap_init(&set->map, initial_size);
>>   }
> 
> Makes sense.  Perhaps "inline" hids this from error-checking
> compilers, I wonder?

outmap_init returns void itself. It is a modern language feature, I guess, that this void "value" can be forwarded in a return statement.

-- Hannes
Previous: Junio C Hamano
Message 3 of 3 in “oidset: don't return value from oidset_init”
  1. oidset: don't return value from oidset_initThomas Gummerer, Jan 7, 2018
  2. Junio C HamanoJan 8, 2018
  3. Johannes SixtJan 9, 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.