Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: GitHub noreply@github.com Date: Sun, 04 Sep 2022 13:20:08 UTC Commit: 2b424581dc45caafd72b1f06583eca9d3480398c https://github.com/geany/geany/commit/2b424581dc45caafd72b1f06583eca9d348039...
Log Message: ----------- Merge pull request #3273 from techee/anon_rename_fix3
Fix renaming tag type containing anonymous type
Modified Paths: -------------- src/tagmanager/tm_ctags.c
Modified: src/tagmanager/tm_ctags.c 12 lines changed, 9 insertions(+), 3 deletions(-) =================================================================== @@ -380,18 +380,24 @@ 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;" */ + * of an anonymous struct such as "struct {} a[2], *b, c;" */ 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; + gchar *pos;
/* 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) + var_tag->var_type && (pos = strstr(var_tag->var_type, orig_name))) { + GString *str = g_string_new(var_tag->var_type); + gssize p = pos - var_tag->var_type; + g_string_erase(str, p, strlen(orig_name)); + g_string_insert(str, p, new_name); g_free(var_tag->var_type); - var_tag->var_type = g_strdup(new_name); + var_tag->var_type = str->str; + g_string_free(str, FALSE); } else break;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).