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: remove the KernelEntry::descr pseudo member

The entry.descr value used in process_name() is not actually a member of
the KernelEntry class; it is a bit of local state. So just manage it
locally.

A trim_whitespace() helper was added to clean up the code slightly.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250606163438.229916-7-corbet@lwn.net

+8 -6
+8 -6
scripts/lib/kdoc/kdoc_parser.py
··· 60 60 61 61 type_param = KernRe(r"\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)", cache=False) 62 62 63 + # 64 + # A little helper to get rid of excess white space 65 + # 66 + multi_space = KernRe(r'\s\s+') 67 + def trim_whitespace(s): 68 + return multi_space.sub(' ', s.strip()) 69 + 63 70 class state: 64 71 """ 65 72 State machine enums ··· 1273 1266 1274 1267 r = KernRe("[-:](.*)") 1275 1268 if r.search(line): 1276 - # strip leading/trailing/multiple spaces 1277 - self.entry.descr = r.group(1).strip(" ") 1278 - 1279 - r = KernRe(r"\s+") 1280 - self.entry.descr = r.sub(" ", self.entry.descr) 1281 - self.entry.declaration_purpose = self.entry.descr 1269 + self.entry.declaration_purpose = trim_whitespace(r.group(1)) 1282 1270 self.state = state.BODY_MAYBE 1283 1271 else: 1284 1272 self.entry.declaration_purpose = ""