[gobject-introspection] sourcescanner: Avoid scanning files when doing a macro scan
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] sourcescanner: Avoid scanning files when doing a macro scan
- Date: Tue, 15 Oct 2013 22:56:19 +0000 (UTC)
commit 77fcc8fa47d63f58b2c3f6216a0493e42f6d44b3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Oct 15 15:26:24 2013 -0400
sourcescanner: Avoid scanning files when doing a macro scan
We already know the condition will be TRUE.
giscanner/sourcescanner.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c
index 90db294..830d21c 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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]