diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-04-22 15:54:16 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-04-25 12:28:51 -0700 |
commit | 5678468c2cc1f4639c68a95fb71f8212c846459b (patch) | |
tree | eeedb656ffa320932b052043355e297809b90633 /mesonbuild/compilers | |
parent | 8e1670cc60cc853c7ddc81dceb65dc93fa45bfa9 (diff) | |
download | meson-5678468c2cc1f4639c68a95fb71f8212c846459b.zip meson-5678468c2cc1f4639c68a95fb71f8212c846459b.tar.gz meson-5678468c2cc1f4639c68a95fb71f8212c846459b.tar.bz2 |
Don't use len() to test for container emptiness
I ran the numbers once before (it's in the meson history) but it's
*much* faster to *not* use len for testing if a container is empty or
not.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/c.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index da9a5dc..94ef336 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -248,7 +248,7 @@ class CCompiler(Compiler): for d in dirs: files = [f for f in os.listdir(d) if f.endswith('.so') and os.path.isfile(os.path.join(d, f))] # if no files, accept directory and move on - if len(files) == 0: + if not files: retval.append(d) continue file_to_check = os.path.join(d, files[0]) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 79eefd1..87a83e5 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1506,7 +1506,7 @@ def gnulike_default_include_dirs(compiler, lang): break else: paths.append(line[1:]) - if len(paths) == 0: + if not paths: mlog.warning('No include directory found parsing "{cmd}" output'.format(cmd=" ".join(cmd))) return paths |