0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00

build: pass a tuple of alternatives to str.endswith()

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 <rlau@redhat.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Christian Clauss 2021-09-06 17:21:16 +02:00 committed by Michaël Zasso
parent 0e561de643
commit b25a73f26a
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600

View File

@ -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: