Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+5 -9
+5 -9
scripts/lib/kdoc/kdoc_parser.py
··· 476 476 self.push_parameter(ln, decl_type, param, dtype, 477 477 arg, declaration_name) 478 478 479 - def check_sections(self, ln, decl_name, decl_type, sectcheck, prmscheck): 479 + def check_sections(self, ln, decl_name, decl_type, sectcheck): 480 480 """ 481 481 Check for errors inside sections, emitting warnings if not found 482 482 parameters are described. 483 483 """ 484 484 485 485 sects = sectcheck.split() 486 - prms = prmscheck.split() 487 486 488 487 for sx in range(len(sects)): # pylint: disable=C0200 489 488 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]: 492 491 err = False 493 492 break 494 493 ··· 752 753 753 754 self.create_parameter_list(ln, decl_type, members, ';', 754 755 declaration_name) 755 - self.check_sections(ln, declaration_name, decl_type, 756 - self.entry.sectcheck, ' '.join(self.entry.parameterlist)) 756 + self.check_sections(ln, declaration_name, decl_type, self.entry.sectcheck) 757 757 758 758 # Adjust declaration for better display 759 759 declaration = KernRe(r'([\{;])').sub(r'\1\n', declaration) ··· 1030 1032 f"expecting prototype for {self.entry.identifier}(). Prototype was for {declaration_name}() instead") 1031 1033 return 1032 1034 1033 - prms = " ".join(self.entry.parameterlist) 1034 - self.check_sections(ln, declaration_name, "function", 1035 - self.entry.sectcheck, prms) 1035 + self.check_sections(ln, declaration_name, "function", self.entry.sectcheck) 1036 1036 1037 1037 self.check_return_section(ln, declaration_name, return_type) 1038 1038