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: micro-optimize KernRe

Switch KernRe::add_regex() to a try..except block to avoid looking up each
regex twice.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>

+2 -4
+2 -4
scripts/lib/kdoc/kdoc_re.py
··· 29 29 """ 30 30 Adds a new regex or re-use it from the cache. 31 31 """ 32 - 33 - if string in re_cache: 32 + try: 34 33 self.regex = re_cache[string] 35 - else: 34 + except KeyError: 36 35 self.regex = re.compile(string, flags=flags) 37 - 38 36 if self.cache: 39 37 re_cache[string] = self.regex 40 38