diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-04-24 17:41:49 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-05-07 15:36:09 +0200 |
commit | b70fe6a5649ed037f2554ae13067fd9929d841f8 (patch) | |
tree | af8559063bef610538eef48c01c8ae71c2b61bd3 /giscanner/sourcescanner.py | |
parent | beadfeff33302a3012fb5df1a7197cb4fac8f6f6 (diff) | |
download | gobject-introspection-b70fe6a5649ed037f2554ae13067fd9929d841f8.tar.gz |
giscanner: Define source and header filename extensions only once
Enables us to to use a more effecient list membership test
instead of testing the end of some string multiple times.
https://bugzilla.gnome.org/show_bug.cgi?id=699533
Diffstat (limited to 'giscanner/sourcescanner.py')
-rw-r--r-- | giscanner/sourcescanner.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py index bd84a605..a1103a10 100644 --- a/giscanner/sourcescanner.py +++ b/giscanner/sourcescanner.py @@ -32,6 +32,10 @@ with LibtoolImporter(None, None): else: from giscanner._giscanner import SourceScanner as CSourceScanner +HEADER_EXTS = ['.h', '.hpp', '.hxx'] +SOURCE_EXTS = ['.c', '.cpp', '.cc', '.cxx'] +ALL_EXTS = SOURCE_EXTS + HEADER_EXTS + (CSYMBOL_TYPE_INVALID, CSYMBOL_TYPE_ELLIPSIS, CSYMBOL_TYPE_CONST, @@ -241,8 +245,7 @@ class SourceScanner(object): headers = [] for filename in filenames: - if (filename.endswith('.c') or filename.endswith('.cpp') or - filename.endswith('.cc') or filename.endswith('.cxx')): + if os.path.splitext(filename)[1] in SOURCE_EXTS: filename = os.path.abspath(filename) self._scanner.lex_filename(filename) else: |