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

Simon Glass sjg at chromium.org
Thu Feb 24 00:00:18 CET 2022


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(-)

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:
             return True
     return False
 
-- 
2.35.1.574.g5d30c73bfb-goog



More information about the U-Boot mailing list