From a1bee94502dc4bf1a7e0cd694669180c2ad4b14f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 6 Sep 2021 17:21:16 +0200 Subject: [PATCH] build: pass a tuple of alternatives to str.endswith() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://docs.python.org/3/library/stdtypes.html#str.endswith One function call should be faster than three function calls per file. PR-URL: https://github.com/nodejs/node/pull/40017 Reviewed-By: Richard Lau Reviewed-By: Michaël Zasso Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Shingo Inoue Reviewed-By: Tobias Nießen Reviewed-By: Darshan Sen --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 9327d6e5f5da06..6efb98c2316f08 100755 --- a/configure.py +++ b/configure.py @@ -1512,7 +1512,7 @@ def glob_to_var(dir_base, dir_sub, patch_dir): for ent in files: (path, dirs, files) = ent for file in files: - if file.endswith('.cpp') or file.endswith('.c') or file.endswith('.h'): + if file.endswith(('.cpp', '.c', '.h')): # srcfile uses "slash" as dir separator as its output is consumed by gyp srcfile = '%s/%s' % (dir_sub, file) if patch_dir: