Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sun, 02 Nov 2014 10:40:05 UTC Commit: f35d0b9c0c8f54b75eff4f12bc762cc5ced0d390 https://github.com/geany/geany/commit/f35d0b9c0c8f54b75eff4f12bc762cc5ced0d3...
Log Message: ----------- Move tm_get_current_tag() from tm_workspace to tm_tag
This function has nothing to do with the workspace so it rather belongs to tm_tag.
Modified Paths: -------------- tagmanager/src/tm_tag.c tagmanager/src/tm_tag.h tagmanager/src/tm_workspace.c tagmanager/src/tm_workspace.h
Modified: tagmanager/src/tm_tag.c 41 lines changed, 41 insertions(+), 0 deletions(-) =================================================================== @@ -1126,6 +1126,47 @@ TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name, return (TMTag **) result; }
+/* Returns TMTag which "own" given line + @param line Current line in edited file. + @param file_tags A GPtrArray of edited file TMTag pointers. + @param tag_types the tag types to include in the match + @return TMTag pointers to owner tag. */ +const TMTag * +tm_get_current_tag (GPtrArray * file_tags, const gulong line, const TMTagType tag_types) +{ + TMTag *matching_tag = NULL; + if (file_tags && file_tags->len) + { + guint i; + gulong matching_line = 0; + + for (i = 0; (i < file_tags->len); ++i) + { + TMTag *tag = TM_TAG (file_tags->pdata[i]); + if (tag && tag->type & tag_types && + tag->line <= line && tag->line > matching_line) + { + matching_tag = tag; + matching_line = tag->line; + } + } + } + return matching_tag; +} + +#if 0 +/* Returns TMTag to function or method which "own" given line + @param line Current line in edited file. + @param file_tags A GPtrArray of edited file TMTag pointers. + @return TMTag pointers to owner function. */ +static const TMTag * +tm_get_current_function (GPtrArray * file_tags, const gulong line) +{ + return tm_get_current_tag (file_tags, line, tm_tag_function_t | tm_tag_method_t); +} +#endif + + #ifdef TM_DEBUG /* various debugging functions */
/*
Modified: tagmanager/src/tm_tag.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -183,6 +183,8 @@ TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
void tm_tags_array_free(GPtrArray *tags_array, gboolean free_all);
+const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const TMTagType tag_types); + void tm_tag_unref(TMTag *tag);
TMTag *tm_tag_ref(TMTag *tag);
Modified: tagmanager/src/tm_workspace.c 40 lines changed, 0 insertions(+), 40 deletions(-) =================================================================== @@ -834,35 +834,6 @@ tm_workspace_find_scoped (const char *name, const char *scope, TMTagType type, }
-/* Returns TMTag which "own" given line - @param line Current line in edited file. - @param file_tags A GPtrArray of edited file TMTag pointers. - @param tag_types the tag types to include in the match - @return TMTag pointers to owner tag. */ -const TMTag * -tm_get_current_tag (GPtrArray * file_tags, const gulong line, const TMTagType tag_types) -{ - TMTag *matching_tag = NULL; - if (file_tags && file_tags->len) - { - guint i; - gulong matching_line = 0; - - for (i = 0; (i < file_tags->len); ++i) - { - TMTag *tag = TM_TAG (file_tags->pdata[i]); - if (tag && tag->type & tag_types && - tag->line <= line && tag->line > matching_line) - { - matching_tag = tag; - matching_line = tag->line; - } - } - } - return matching_tag; -} - - static int find_scope_members_tags (const GPtrArray * all, GPtrArray * tags, const langType langJava, const char *name, @@ -1142,17 +1113,6 @@ void tm_workspace_dump(void)
#if 0
-/* Returns TMTag to function or method which "own" given line - @param line Current line in edited file. - @param file_tags A GPtrArray of edited file TMTag pointers. - @return TMTag pointers to owner function. */ -static const TMTag * -tm_get_current_function (GPtrArray * file_tags, const gulong line) -{ - return tm_get_current_tag (file_tags, line, tm_tag_function_t | tm_tag_method_t); -} - - static int find_namespace_members_tags (const GPtrArray * all, GPtrArray * tags, const langType langJava, const char *name,
Modified: tagmanager/src/tm_workspace.h 2 lines changed, 0 insertions(+), 2 deletions(-) =================================================================== @@ -68,8 +68,6 @@ const GPtrArray *tm_workspace_find_scope_members(const GPtrArray *file_tags, gboolean find_global, gboolean no_definitions);
-const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const TMTagType tag_types); - void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* text_buf, gint buf_size);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).