Skip to content

Commit efacdf8

Browse files
author
Jonathan Corbet
committed
docs: kdoc: use self.entry.parameterlist directly in check_sections()
Callers of check_sections() join parameterlist into a single string, which is then immediately split back into the original list. Rather than do all that, just use parameterlist directly in check_sections(). Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 172bee3 commit efacdf8

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

scripts/lib/kdoc/kdoc_parser.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -476,19 +476,18 @@ def create_parameter_list(self, ln, decl_type, args,
476476
self.push_parameter(ln, decl_type, param, dtype,
477477
arg, declaration_name)
478478

479-
def check_sections(self, ln, decl_name, decl_type, sectcheck, prmscheck):
479+
def check_sections(self, ln, decl_name, decl_type, sectcheck):
480480
"""
481481
Check for errors inside sections, emitting warnings if not found
482482
parameters are described.
483483
"""
484484

485485
sects = sectcheck.split()
486-
prms = prmscheck.split()
487486

488487
for sx in range(len(sects)): # pylint: disable=C0200
489488
err = True
490-
for px in range(len(prms)): # pylint: disable=C0200
491-
if prms[px] == sects[sx]:
489+
for param in self.entry.parameterlist:
490+
if param == sects[sx]:
492491
err = False
493492
break
494493

@@ -753,8 +752,7 @@ def dump_struct(self, ln, proto):
753752

754753
self.create_parameter_list(ln, decl_type, members, ';',
755754
declaration_name)
756-
self.check_sections(ln, declaration_name, decl_type,
757-
self.entry.sectcheck, ' '.join(self.entry.parameterlist))
755+
self.check_sections(ln, declaration_name, decl_type, self.entry.sectcheck)
758756

759757
# Adjust declaration for better display
760758
declaration = KernRe(r'([\{;])').sub(r'\1\n', declaration)
@@ -1032,9 +1030,7 @@ def dump_function(self, ln, prototype):
10321030
f"expecting prototype for {self.entry.identifier}(). Prototype was for {declaration_name}() instead")
10331031
return
10341032

1035-
prms = " ".join(self.entry.parameterlist)
1036-
self.check_sections(ln, declaration_name, "function",
1037-
self.entry.sectcheck, prms)
1033+
self.check_sections(ln, declaration_name, "function", self.entry.sectcheck)
10381034

10391035
self.check_return_section(ln, declaration_name, return_type)
10401036

0 commit comments

Comments
 (0)