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
This commit is contained in:
Jonathan Corbet
2025-07-03 12:43:59 -06:00
parent 8078e0ed1f
commit 061a1c1a27

View File

@@ -1609,9 +1609,7 @@ class KernelDoc:
self.entry.brcount += r.group(2).count('{')
self.entry.brcount -= r.group(2).count('}')
self.entry.brcount = max(self.entry.brcount, 0)
if r.group(2) == ';' and self.entry.brcount == 0:
if r.group(2) == ';' and self.entry.brcount <= 0:
self.dump_declaration(ln, self.entry.prototype)
self.reset_state(ln)
break