diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-10-15 15:26:24 -0400 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2013-10-15 15:29:36 -0400 |
commit | 77fcc8fa47d63f58b2c3f6216a0493e42f6d44b3 (patch) | |
tree | a04156a5c255217eac6d5d195073fe8795f9ba19 /giscanner | |
parent | 002c4b9550e5a5db746b3f8f9a8dc5748cf338cb (diff) | |
download | gobject-introspection-77fcc8fa47d63f58b2c3f6216a0493e42f6d44b3.tar.gz |
sourcescanner: Avoid scanning files when doing a macro scan
We already know the condition will be TRUE.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/sourcescanner.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c index 90db2946..830d21cd 100644 --- a/giscanner/sourcescanner.c +++ b/giscanner/sourcescanner.c @@ -262,11 +262,9 @@ gi_source_scanner_set_macro_scan (GISourceScanner *scanner, scanner->macro_scan = macro_scan; } -void -gi_source_scanner_add_symbol (GISourceScanner *scanner, - GISourceSymbol *symbol) +static gboolean +already_has_current_file (GISourceScanner *scanner) { - gboolean found_filename = FALSE; GList *l; GFile *current_file; @@ -278,15 +276,24 @@ gi_source_scanner_add_symbol (GISourceScanner *scanner, GFile *file = g_file_new_for_path (l->data); if (g_file_equal (file, current_file)) - { - found_filename = TRUE; + { g_object_unref (file); - break; - } + return TRUE; + } + g_object_unref (file); } - if (found_filename || scanner->macro_scan) + g_object_unref (current_file); + + return FALSE; +} + +void +gi_source_scanner_add_symbol (GISourceScanner *scanner, + GISourceSymbol *symbol) +{ + if (scanner->macro_scan || already_has_current_file (scanner)) scanner->symbols = g_slist_prepend (scanner->symbols, gi_source_symbol_ref (symbol)); g_assert (symbol->source_filename != NULL); @@ -308,8 +315,6 @@ gi_source_scanner_add_symbol (GISourceScanner *scanner, default: break; } - - g_object_unref (current_file); } GSList * |