summaryrefslogtreecommitdiff
path: root/giscanner/scannermain.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-04-24 17:41:49 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-05-07 15:36:09 +0200
commitb70fe6a5649ed037f2554ae13067fd9929d841f8 (patch)
treeaf8559063bef610538eef48c01c8ae71c2b61bd3 /giscanner/scannermain.py
parentbeadfeff33302a3012fb5df1a7197cb4fac8f6f6 (diff)
downloadgobject-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/scannermain.py')
-rwxr-xr-xgiscanner/scannermain.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index b068f6fb..deefcf99 100755
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -38,7 +38,7 @@ from giscanner.girparser import GIRParser
from giscanner.girwriter import GIRWriter
from giscanner.maintransformer import MainTransformer
from giscanner.shlibs import resolve_shlibs
-from giscanner.sourcescanner import SourceScanner
+from giscanner.sourcescanner import SourceScanner, ALL_EXTS
from giscanner.transformer import Transformer
from . import utils
@@ -253,10 +253,7 @@ def extract_filenames(args):
for arg in args:
# We don't support real C++ parsing yet, but we should be able
# to understand C API implemented in C++ files.
- if (arg.endswith('.c') or arg.endswith('.cpp') or
- arg.endswith('.cc') or arg.endswith('.cxx') or
- arg.endswith('.h') or arg.endswith('.hpp') or
- arg.endswith('.hxx')):
+ if os.path.splitext(arg)[1] in ALL_EXTS:
if not os.path.exists(arg):
_error('%s: no such a file or directory' % (arg, ))
# Make absolute, because we do comparisons inside scannerparser.c