CodingGuidelines: allow declaring variables in for loops
Since44ba10d671
(revision: use C99 declaration of variable in for() loop, 2021-11-14) released with v2.35.0 we've had a variable declared with in a for loop. Since then we've had inadvertent follow-ups to that with at leastcb2607759e
(merge-ort: store more specific conflict information, 2022-06-18) released with v2.38.0. As November 2022 is within the window of this upcoming release, let's update the guideline to allow this. We can have the promised "revisit" discussion while this patch cooks, and drop it if it turns out that it is still premature, which is not expected to happen at this moment. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
442c27dde7
commit
82dd01d81b
@ -47,13 +47,6 @@ static inline int want_ancestry(const struct rev_info *revs);
|
||||
void show_object_with_name(FILE *out, struct object *obj, const char *name)
|
||||
{
|
||||
fprintf(out, "%s ", oid_to_hex(&obj->oid));
|
||||
/*
|
||||
* 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