[geany/geany] f1ce9a: TM: don't needlessly duplicate array when searching for current tag
Colomban Wendling
git-noreply at xxxxx
Fri Aug 1 18:36:43 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Wed, 19 Feb 2014 00:10:07 UTC
Commit: f1ce9afadd743dee5a6184b12eb5125305570d4d
https://github.com/geany/geany/commit/f1ce9afadd743dee5a6184b12eb5125305570d4d
Log Message:
-----------
TM: don't needlessly duplicate array when searching for current tag
Modified Paths:
--------------
tagmanager/src/tm_workspace.c
Modified: tagmanager/src/tm_workspace.c
12 lines changed, 5 insertions(+), 7 deletions(-)
===================================================================
@@ -745,25 +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;
- for (i = 0; (i < local->len); ++i)
+ for (i = 0; (i < file_tags->len); ++i)
{
- TMTag *tag = TM_TAG (local->pdata[i]);
- if (tag->atts.entry.line <= line && tag->atts.entry.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