Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: GitHub noreply@github.com Date: Fri, 13 May 2022 00:43:13 UTC Commit: 76f5349ecae260bfcea6fb8bf578ae10e6a67aec https://github.com/geany/geany/commit/76f5349ecae260bfcea6fb8bf578ae10e6a67a...
Log Message: ----------- Merge pull request #3196 from techee/anon_rename_fix2
Fix renaming of variables with anonymous type
Modified Paths: -------------- src/tagmanager/tm_ctags.c
Modified: src/tagmanager/tm_ctags.c 20 lines changed, 20 insertions(+), 0 deletions(-) =================================================================== @@ -370,6 +370,26 @@ static void rename_anon_tags(TMSourceFile *source_file) } }
+ /* We are out of the nesting - the next tags could be variables + * of an anonymous struct such as "struct {} a, b;" */ + while (j < source_file->tags_array->len) + { + TMTag *var_tag = TM_TAG(source_file->tags_array->pdata[j]); + guint var_scope_len = var_tag->scope ? strlen(var_tag->scope) : 0; + + /* Should be at the same scope level as the anon tag */ + if (var_scope_len == scope_len && + g_strcmp0(var_tag->var_type, orig_name) == 0) + { + g_free(var_tag->var_type); + var_tag->var_type = g_strdup(new_name); + } + else + break; + + j++; + } + g_free(orig_name); } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).