Skip to content

Commit 061a1c1

Browse files
author
Jonathan Corbet
committed
docs: kdoc: remove the brcount floor in process_proto_type()
Putting the floor under brcount does not change the output in any way, just remove it. Change the termination test from ==0 to <=0 to prevent infinite loops in case somebody does something truly wacko in the code. Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Tested-by: Akira Yokosawa <akiyks@gmail.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/20250703184403.274408-4-corbet@lwn.net
1 parent 8078e0e commit 061a1c1

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,9 +1609,7 @@ def process_proto_type(self, ln, line):
16091609
self.entry.brcount += r.group(2).count('{')
16101610
self.entry.brcount -= r.group(2).count('}')
16111611

1612-
self.entry.brcount = max(self.entry.brcount, 0)
1613-
1614-
if r.group(2) == ';' and self.entry.brcount == 0:
1612+
if r.group(2) == ';' and self.entry.brcount <= 0:
16151613
self.dump_declaration(ln, self.entry.prototype)
16161614
self.reset_state(ln)
16171615
break

0 commit comments

Comments
 (0)