Merge branch 'jc/c99-var-decl-in-for-loop'
Weather balloon to find compilers that do not grok variable declaration in the for() loop. * jc/c99-var-decl-in-for-loop: revision: use C99 declaration of variable in for() loop
This commit is contained in:
11
revision.c
11
revision.c
@ -44,10 +44,15 @@ static inline int want_ancestry(const struct rev_info *revs);
|
||||
|
||||
void show_object_with_name(FILE *out, struct object *obj, const char *name)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
fprintf(out, "%s ", oid_to_hex(&obj->oid));
|
||||
for (p = name; *p && *p != '\n'; p++)
|
||||
/*
|
||||
* This "for (const char *p = ..." is made as a first step towards
|
||||
* making use of such declarations elsewhere in our codebase. If
|
||||
* it causes compilation problems on your platform, please report
|
||||
* it to the Git mailing list at git@vger.kernel.org. In the meantime,
|
||||
* adding -std=gnu99 to CFLAGS may help if you are with older GCC.
|
||||
*/
|
||||
for (const char *p = name; *p && *p != '\n'; p++)
|
||||
fputc(*p, out);
|
||||
fputc('\n', out);
|
||||
}
|
||||
|
Reference in New Issue
Block a user