{"action":"created","comment":{"url":"https://api.github.com/repos/geany/geany/pulls/comments/140633591","pull_request_review_id":64739676,"id":140633591,"diff_hunk":"@@ -1147,21 +1126,46 @@ static void parents_table_tree_value_free(gpointer data)\n \n \n /* adds a new element in the parent table if its key is known. */\n-static void update_parents_table(GHashTable *table, const TMTag *tag, const gchar *parent_name,\n-\t\tconst GtkTreeIter *iter)\n+static void update_parents_table(GHashTable *table, const TMTag *tag, const GtkTreeIter *iter)\n {\n+\tconst gchar *name;\n+\tgchar *name_free = NULL;\n \tGTree *tree;\n-\tif (g_hash_table_lookup_extended(table, tag->name, NULL, (gpointer *) &tree) &&\n-\t\t! utils_str_equal(parent_name, tag->name) /* prevent Foo::Foo from making parent = child */)\n+\n+\tif (EMPTY(tag->scope))\n+\t{\n+\t\t/* simple case, just use the tag name */\n+\t\tname = tag->name;","path":"src/symbols.c","position":50,"original_position":50,"commit_id":"6522332ba9d54da7d750b1f2d719b07af6e861cf","original_commit_id":"6522332ba9d54da7d750b1f2d719b07af6e861cf","user":{"login":"techee","id":713965,"avatar_url":"https://avatars0.githubusercontent.com/u/713965?v=4","gravatar_id":"","url":"https://api.github.com/users/techee","html_url":"https://github.com/techee","followers_url":"https://api.github.com/users/techee/followers","following_url":"https://api.github.com/users/techee/following{/other_user}","gists_url":"https://api.github.com/users/techee/gists{/gist_id}","starred_url":"https://api.github.com/users/techee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techee/subscriptions","organizations_url":"https://api.github.com/users/techee/orgs","repos_url":"https://api.github.com/users/techee/repos","events_url":"https://api.github.com/users/techee/events{/privacy}","received_events_url":"https://api.github.com/users/techee/received_events","type":"User","site_admin":false},"body":"What about doing g_strdup(tag->name) here and once more below and completely eliminating the name_free variable?","created_at":"2017-09-23T13:37:32Z","updated_at":"2017-09-23T13:37:32Z","html_url":"https://github.com/geany/geany/pull/1598#discussion_r140633591","pull_request_url":"https://api.github.com/repos/geany/geany/pulls/1598","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/geany/geany/pulls/comments/140633591"},"html":{"href":"https://github.com/geany/geany/pull/1598#discussion_r140633591"},"pull_request":{"href":"https://api.github.com/repos/geany/geany/pulls/1598"}}},"pull_request":{"url":"https://api.github.com/repos/geany/geany/pulls/1598","id":138992979,"html_url":"https://github.com/geany/geany/pull/1598","diff_url":"https://github.com/geany/geany/pull/1598.diff","patch_url":"https://github.com/geany/geany/pull/1598.patch","issue_url":"https://api.github.com/repos/geany/geany/issues/1598","number":1598,"state":"open","locked":false,"title":"Fix the symbols tree hierarchy when several tags have the same name","user":{"login":"b4n","id":793526,"avatar_url":"https://avatars2.githubusercontent.com/u/793526?v=4","gravatar_id":"","url":"https://api.github.com/users/b4n","html_url":"https://github.com/b4n","followers_url":"https://api.github.com/users/b4n/followers","following_url":"https://api.github.com/users/b4n/following{/other_user}","gists_url":"https://api.github.com/users/b4n/gists{/gist_id}","starred_url":"https://api.github.com/users/b4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b4n/subscriptions","organizations_url":"https://api.github.com/users/b4n/orgs","repos_url":"https://api.github.com/users/b4n/repos","events_url":"https://api.github.com/users/b4n/events{/privacy}","received_events_url":"https://api.github.com/users/b4n/received_events","type":"User","site_admin":false},"body":"Fix the symbols tree hierarchy by considering the whole scope when adding a tag, avoiding choosing the wrong parent when several tags have the same name.  Until now, to avoid such misbehavior we only used to choose the parent candidate that appeared last (line-wise) before the child.  It works in most typical situations as generally tag names are fairly unique, and children appear right after their parent.\r\n\r\nHowever, there are cases that are trickier and cannot be handled that way.  In the following valid C++ snippet, it is impossible to know whether `function` should be listed under the namespace `A` or the\r\nclass `A` without looking at its full scope:\r\n\r\n```C++\r\nnamespace A {\r\n    namespace B {\r\n        class A {\r\n            void method() {}\r\n        };\r\n    };\r\n    void function() {}\r\n};\r\n```\r\n\r\nAnd it is a real-world problem for some parsers like the JSON parser that generates numeric indices for array elements name, often leading to several possibly close duplicates.\r\n\r\nAdditionally, to prevent trying to set a tag as its own parent, the code guarded against accepting a parent if the child had the same name, lading to incorrect hierarchy for `method` in cases like this:\r\n\r\n```C++\r\nnamespace A {\r\n    class A {\r\n        void method() {}\r\n    };\r\n};\r\n```\r\n\r\nSo to fix this, consider the whole hierarchy of a tag for choosing its parent, when that information is available from the parser.\r\n\r\nFixes #1583.","created_at":"2017-09-02T00:35:06Z","updated_at":"2017-09-23T13:37:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74f292534567d871d0074ceab41357cc565d1215","assignee":{"login":"b4n","id":793526,"avatar_url":"https://avatars2.githubusercontent.com/u/793526?v=4","gravatar_id":"","url":"https://api.github.com/users/b4n","html_url":"https://github.com/b4n","followers_url":"https://api.github.com/users/b4n/followers","following_url":"https://api.github.com/users/b4n/following{/other_user}","gists_url":"https://api.github.com/users/b4n/gists{/gist_id}","starred_url":"https://api.github.com/users/b4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b4n/subscriptions","organizations_url":"https://api.github.com/users/b4n/orgs","repos_url":"https://api.github.com/users/b4n/repos","events_url":"https://api.github.com/users/b4n/events{/privacy}","received_events_url":"https://api.github.com/users/b4n/received_events","type":"User","site_admin":false},"assignees":[{"login":"b4n","id":793526,"avatar_url":"https://avatars2.githubusercontent.com/u/793526?v=4","gravatar_id":"","url":"https://api.github.com/users/b4n","html_url":"https://github.com/b4n","followers_url":"https://api.github.com/users/b4n/followers","following_url":"https://api.github.com/users/b4n/following{/other_user}","gists_url":"https://api.github.com/users/b4n/gists{/gist_id}","starred_url":"https://api.github.com/users/b4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b4n/subscriptions","organizations_url":"https://api.github.com/users/b4n/orgs","repos_url":"https://api.github.com/users/b4n/repos","events_url":"https://api.github.com/users/b4n/events{/privacy}","received_events_url":"https://api.github.com/users/b4n/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/geany/geany/milestones/9","html_url":"https://github.com/geany/geany/milestone/9","labels_url":"https://api.github.com/repos/geany/geany/milestones/9/labels","id":2374171,"number":9,"title":"1.32","description":"","creator":{"login":"frlan","id":1010248,"avatar_url":"https://avatars2.githubusercontent.com/u/1010248?v=4","gravatar_id":"","url":"https://api.github.com/users/frlan","html_url":"https://github.com/frlan","followers_url":"https://api.github.com/users/frlan/followers","following_url":"https://api.github.com/users/frlan/following{/other_user}","gists_url":"https://api.github.com/users/frlan/gists{/gist_id}","starred_url":"https://api.github.com/users/frlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frlan/subscriptions","organizations_url":"https://api.github.com/users/frlan/orgs","repos_url":"https://api.github.com/users/frlan/repos","events_url":"https://api.github.com/users/frlan/events{/privacy}","received_events_url":"https://api.github.com/users/frlan/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":11,"state":"open","created_at":"2017-03-09T10:48:32Z","updated_at":"2017-09-22T17:48:18Z","due_on":"2017-11-05T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/geany/geany/pulls/1598/commits","review_comments_url":"https://api.github.com/repos/geany/geany/pulls/1598/comments","review_comment_url":"https://api.github.com/repos/geany/geany/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geany/geany/issues/1598/comments","statuses_url":"https://api.github.com/repos/geany/geany/statuses/6522332ba9d54da7d750b1f2d719b07af6e861cf","head":{"label":"b4n:symbols/more-robust-hierarchy","ref":"symbols/more-robust-hierarchy","sha":"6522332ba9d54da7d750b1f2d719b07af6e861cf","user":{"login":"b4n","id":793526,"avatar_url":"https://avatars2.githubusercontent.com/u/793526?v=4","gravatar_id":"","url":"https://api.github.com/users/b4n","html_url":"https://github.com/b4n","followers_url":"https://api.github.com/users/b4n/followers","following_url":"https://api.github.com/users/b4n/following{/other_user}","gists_url":"https://api.github.com/users/b4n/gists{/gist_id}","starred_url":"https://api.github.com/users/b4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b4n/subscriptions","organizations_url":"https://api.github.com/users/b4n/orgs","repos_url":"https://api.github.com/users/b4n/repos","events_url":"https://api.github.com/users/b4n/events{/privacy}","received_events_url":"https://api.github.com/users/b4n/received_events","type":"User","site_admin":false},"repo":{"id":2737453,"name":"geany","full_name":"b4n/geany","owner":{"login":"b4n","id":793526,"avatar_url":"https://avatars2.githubusercontent.com/u/793526?v=4","gravatar_id":"","url":"https://api.github.com/users/b4n","html_url":"https://github.com/b4n","followers_url":"https://api.github.com/users/b4n/followers","following_url":"https://api.github.com/users/b4n/following{/other_user}","gists_url":"https://api.github.com/users/b4n/gists{/gist_id}","starred_url":"https://api.github.com/users/b4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b4n/subscriptions","organizations_url":"https://api.github.com/users/b4n/orgs","repos_url":"https://api.github.com/users/b4n/repos","events_url":"https://api.github.com/users/b4n/events{/privacy}","received_events_url":"https://api.github.com/users/b4n/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/b4n/geany","description":"A fast and lightweight IDE","fork":true,"url":"https://api.github.com/repos/b4n/geany","forks_url":"https://api.github.com/repos/b4n/geany/forks","keys_url":"https://api.github.com/repos/b4n/geany/keys{/key_id}","collaborators_url":"https://api.github.com/repos/b4n/geany/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/b4n/geany/teams","hooks_url":"https://api.github.com/repos/b4n/geany/hooks","issue_events_url":"https://api.github.com/repos/b4n/geany/issues/events{/number}","events_url":"https://api.github.com/repos/b4n/geany/events","assignees_url":"https://api.github.com/repos/b4n/geany/assignees{/user}","branches_url":"https://api.github.com/repos/b4n/geany/branches{/branch}","tags_url":"https://api.github.com/repos/b4n/geany/tags","blobs_url":"https://api.github.com/repos/b4n/geany/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/b4n/geany/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/b4n/geany/git/refs{/sha}","trees_url":"https://api.github.com/repos/b4n/geany/git/trees{/sha}","statuses_url":"https://api.github.com/repos/b4n/geany/statuses/{sha}","languages_url":"https://api.github.com/repos/b4n/geany/languages","stargazers_url":"https://api.github.com/repos/b4n/geany/stargazers","contributors_url":"https://api.github.com/repos/b4n/geany/contributors","subscribers_url":"https://api.github.com/repos/b4n/geany/subscribers","subscription_url":"https://api.github.com/repos/b4n/geany/subscription","commits_url":"https://api.github.com/repos/b4n/geany/commits{/sha}","git_commits_url":"https://api.github.com/repos/b4n/geany/git/commits{/sha}","comments_url":"https://api.github.com/repos/b4n/geany/comments{/number}","issue_comment_url":"https://api.github.com/repos/b4n/geany/issues/comments{/number}","contents_url":"https://api.github.com/repos/b4n/geany/contents/{+path}","compare_url":"https://api.github.com/repos/b4n/geany/compare/{base}...{head}","merges_url":"https://api.github.com/repos/b4n/geany/merges","archive_url":"https://api.github.com/repos/b4n/geany/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/b4n/geany/downloads","issues_url":"https://api.github.com/repos/b4n/geany/issues{/number}","pulls_url":"https://api.github.com/repos/b4n/geany/pulls{/number}","milestones_url":"https://api.github.com/repos/b4n/geany/milestones{/number}","notifications_url":"https://api.github.com/repos/b4n/geany/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/b4n/geany/labels{/name}","releases_url":"https://api.github.com/repos/b4n/geany/releases{/id}","deployments_url":"https://api.github.com/repos/b4n/geany/deployments","created_at":"2011-11-08T21:50:08Z","updated_at":"2016-02-28T09:10:20Z","pushed_at":"2017-09-18T19:54:31Z","git_url":"git://github.com/b4n/geany.git","ssh_url":"git@github.com:b4n/geany.git","clone_url":"https://github.com/b4n/geany.git","svn_url":"https://github.com/b4n/geany","homepage":"http://www.geany.org","size":55380,"stargazers_count":7,"watchers_count":7,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"geany:master","ref":"master","sha":"76c69a9bac4eeb11dc65483820b2b8a62c351b76","user":{"login":"geany","id":1108795,"avatar_url":"https://avatars2.githubusercontent.com/u/1108795?v=4","gravatar_id":"","url":"https://api.github.com/users/geany","html_url":"https://github.com/geany","followers_url":"https://api.github.com/users/geany/followers","following_url":"https://api.github.com/users/geany/following{/other_user}","gists_url":"https://api.github.com/users/geany/gists{/gist_id}","starred_url":"https://api.github.com/users/geany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geany/subscriptions","organizations_url":"https://api.github.com/users/geany/orgs","repos_url":"https://api.github.com/users/geany/repos","events_url":"https://api.github.com/users/geany/events{/privacy}","received_events_url":"https://api.github.com/users/geany/received_events","type":"Organization","site_admin":false},"repo":{"id":2532922,"name":"geany","full_name":"geany/geany","owner":{"login":"geany","id":1108795,"avatar_url":"https://avatars2.githubusercontent.com/u/1108795?v=4","gravatar_id":"","url":"https://api.github.com/users/geany","html_url":"https://github.com/geany","followers_url":"https://api.github.com/users/geany/followers","following_url":"https://api.github.com/users/geany/following{/other_user}","gists_url":"https://api.github.com/users/geany/gists{/gist_id}","starred_url":"https://api.github.com/users/geany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geany/subscriptions","organizations_url":"https://api.github.com/users/geany/orgs","repos_url":"https://api.github.com/users/geany/repos","events_url":"https://api.github.com/users/geany/events{/privacy}","received_events_url":"https://api.github.com/users/geany/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geany/geany","description":"A fast and lightweight IDE","fork":false,"url":"https://api.github.com/repos/geany/geany","forks_url":"https://api.github.com/repos/geany/geany/forks","keys_url":"https://api.github.com/repos/geany/geany/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geany/geany/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geany/geany/teams","hooks_url":"https://api.github.com/repos/geany/geany/hooks","issue_events_url":"https://api.github.com/repos/geany/geany/issues/events{/number}","events_url":"https://api.github.com/repos/geany/geany/events","assignees_url":"https://api.github.com/repos/geany/geany/assignees{/user}","branches_url":"https://api.github.com/repos/geany/geany/branches{/branch}","tags_url":"https://api.github.com/repos/geany/geany/tags","blobs_url":"https://api.github.com/repos/geany/geany/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geany/geany/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geany/geany/git/refs{/sha}","trees_url":"https://api.github.com/repos/geany/geany/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geany/geany/statuses/{sha}","languages_url":"https://api.github.com/repos/geany/geany/languages","stargazers_url":"https://api.github.com/repos/geany/geany/stargazers","contributors_url":"https://api.github.com/repos/geany/geany/contributors","subscribers_url":"https://api.github.com/repos/geany/geany/subscribers","subscription_url":"https://api.github.com/repos/geany/geany/subscription","commits_url":"https://api.github.com/repos/geany/geany/commits{/sha}","git_commits_url":"https://api.github.com/repos/geany/geany/git/commits{/sha}","comments_url":"https://api.github.com/repos/geany/geany/comments{/number}","issue_comment_url":"https://api.github.com/repos/geany/geany/issues/comments{/number}","contents_url":"https://api.github.com/repos/geany/geany/contents/{+path}","compare_url":"https://api.github.com/repos/geany/geany/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geany/geany/merges","archive_url":"https://api.github.com/repos/geany/geany/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geany/geany/downloads","issues_url":"https://api.github.com/repos/geany/geany/issues{/number}","pulls_url":"https://api.github.com/repos/geany/geany/pulls{/number}","milestones_url":"https://api.github.com/repos/geany/geany/milestones{/number}","notifications_url":"https://api.github.com/repos/geany/geany/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geany/geany/labels{/name}","releases_url":"https://api.github.com/repos/geany/geany/releases{/id}","deployments_url":"https://api.github.com/repos/geany/geany/deployments","created_at":"2011-10-07T14:25:32Z","updated_at":"2017-09-23T07:08:54Z","pushed_at":"2017-09-22T09:36:52Z","git_url":"git://github.com/geany/geany.git","ssh_url":"git@github.com:geany/geany.git","clone_url":"https://github.com/geany/geany.git","svn_url":"https://github.com/geany/geany","homepage":"http://www.geany.org","size":54436,"stargazers_count":1020,"watchers_count":1020,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":333,"mirror_url":null,"open_issues_count":573,"forks":333,"open_issues":573,"watchers":1020,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geany/geany/pulls/1598"},"html":{"href":"https://github.com/geany/geany/pull/1598"},"issue":{"href":"https://api.github.com/repos/geany/geany/issues/1598"},"comments":{"href":"https://api.github.com/repos/geany/geany/issues/1598/comments"},"review_comments":{"href":"https://api.github.com/repos/geany/geany/pulls/1598/comments"},"review_comment":{"href":"https://api.github.com/repos/geany/geany/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geany/geany/pulls/1598/commits"},"statuses":{"href":"https://api.github.com/repos/geany/geany/statuses/6522332ba9d54da7d750b1f2d719b07af6e861cf"}},"author_association":"OWNER"}}
{"actor":{"display_login":"techee"}}