Re: [PATCH 2/2] commit-slab.h: avoid duplicated global static variables
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2016, 17:17 UTC
- Message-ID
- <xmqqpophc15o.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <57A9E614.6050601@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 9 quoted lines
> * like function declarations. I.e., the expansion of > * > * define_commit_slab(indegree, int); > * > - * ends in 'static int stat_indegreerealloc;'. This would otherwise > + * ends in 'struct indegree;'. This would otherwise > * be a syntax error according (at least) to ISO C. It's hard to > * catch because GCC silently parses it by default. > */
I briefly wondered what "otherwise" and "it" in "silently parses it" refer to; it is having a hanging semicolon after the definition of the *_peek() function, i.e.
...
static int *indegree_peek(...)
{
return indegree_at_peek(s, c, 0);
}
;so all is fine.
Needless to say, using "struct slabname;" is indeed a much nicer solution you found to the original issue. Thanks.