[PATCH v2 03/25] moveconfig: Use re.fullmatch() to avoid extra check

Alper Nebi Yasak alpernebiyasak at gmail.com
Thu Mar 3 22:07:59 CET 2022


On 24/02/2022 02:00, Simon Glass wrote:
> Simplify the code by using the available function.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v2:
> - Add new patch to use re.fullmatch() to avoid extra check
> 
>  tools/moveconfig.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>

> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
> index dea60f4661..4b0e2e250b 100755
> --- a/tools/moveconfig.py
> +++ b/tools/moveconfig.py
> @@ -1610,8 +1610,8 @@ def defconfig_matches(configs, re_match):
>          bool: True if any CONFIG matches the regex
>      """
>      for cfg in configs:
> -        m_cfg = re_match.match(cfg)
> -        if m_cfg and m_cfg.span()[1] == len(cfg):
> +        m_cfg = re_match.fullmatch(cfg)
> +        if m_cfg:

Could skip the variable entirely.

>              return True
>      return False
>  


More information about the U-Boot mailing list