[geany/geany] 4cfe71: Merge branch 'tm/faster-current-tag'

Colomban Wendling git-noreply at xxxxx
Fri Aug 1 15:34:24 UTC 2014


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Fri, 01 Aug 2014 15:34:24 UTC
Commit:      4cfe71a487dfabdc3a4ce79bfa924567101c8838
             https://github.com/geany/geany/commit/4cfe71a487dfabdc3a4ce79bfa924567101c8838

Log Message:
-----------
Merge branch 'tm/faster-current-tag'

This makes tm_get_current_tag() roughly 4.5 times faster.


Modified Paths:
--------------
    tagmanager/src/tm_workspace.c

Modified: tagmanager/src/tm_workspace.c
14 lines changed, 5 insertions(+), 9 deletions(-)
===================================================================
@@ -745,27 +745,23 @@ tm_workspace_find_scoped (const char *name, const char *scope, gint type,
 const TMTag *
 tm_get_current_tag (GPtrArray * file_tags, const gulong line, const guint tag_types)
 {
-	GPtrArray *const local = tm_tags_extract (file_tags, tag_types);
 	TMTag *matching_tag = NULL;
-	if (local && local->len)
+	if (file_tags && file_tags->len)
 	{
 		guint i;
 		gulong matching_line = 0;
-		glong delta;
 
-		for (i = 0; (i < local->len); ++i)
+		for (i = 0; (i < file_tags->len); ++i)
 		{
-			TMTag *tag = TM_TAG (local->pdata[i]);
-			delta = line - tag->atts.entry.line;
-			if (delta >= 0 && (gulong)delta < line - matching_line)
+			TMTag *tag = TM_TAG (file_tags->pdata[i]);
+			if (tag && tag->type & tag_types &&
+				tag->atts.entry.line <= line && tag->atts.entry.line > matching_line)
 			{
 				matching_tag = tag;
 				matching_line = tag->atts.entry.line;
 			}
 		}
 	}
-	if (local)
-		g_ptr_array_free (local, TRUE);
 	return matching_tag;
 }
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list