{"action":"created","comment":{"url":"https://api.github.com/repos/Statoil/libecl/pulls/comments/138838889","pull_request_review_id":62686600,"id":138838889,"diff_hunk":"@@ -790,6 +790,26 @@ int stringlist_append_matching_elements(stringlist_type * target , const stringl\n   return stringlist_append_matching_elements( target , src , pattern );\n }\n \n+// Warning: this is O(n^2)\n+bool stringlist_unique(const stringlist_type * stringlist )\n+{\n+  int size = stringlist_get_size( stringlist );\n+  if (size <= 1)\n+    return true;\n+\n+  for (int index1=0; index1 < size - 1; index1++) {\n+    const char * s1 = stringlist_iget( stringlist , index1 );\n+    for (int index2=index1 + 1; index2 < size; index2++) {\n+      const char * s2 = stringlist_iget( stringlist , index2 );\n+      if (strcmp(s1,s2) == 0)\n+        return false;\n+    }\n+  }\n+  return true;","path":"lib/util/stringlist.c","position":19,"original_position":19,"commit_id":"b2924aad50d3511af03818dfa88de61a8f547547","original_commit_id":"229960324042ff70c49ea9ca89e767ced55b1955","user":{"login":"pgdr","id":17569537,"avatar_url":"https://avatars0.githubusercontent.com/u/17569537?v=4","gravatar_id":"","url":"https://api.github.com/users/pgdr","html_url":"https://github.com/pgdr","followers_url":"https://api.github.com/users/pgdr/followers","following_url":"https://api.github.com/users/pgdr/following{/other_user}","gists_url":"https://api.github.com/users/pgdr/gists{/gist_id}","starred_url":"https://api.github.com/users/pgdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgdr/subscriptions","organizations_url":"https://api.github.com/users/pgdr/orgs","repos_url":"https://api.github.com/users/pgdr/repos","events_url":"https://api.github.com/users/pgdr/events{/privacy}","received_events_url":"https://api.github.com/users/pgdr/received_events","type":"User","site_admin":false},"body":"```c\r\nbool stringlist_unique(const stringlist_type* lst)\r\n{\r\n  stringlist* cpy = stringlist_alloc_shallow_copy(lst);\r\n  stringlist_sort(cpy, strcmp);\r\n  int size = stringlist_get_size(cpy);\r\n  for (int i = 0; index1 < size - 1; i++) {\r\n    const char* s1 = stringlist_iget(cpy, i);\r\n    const char* s2 = stringlist_iget(cpy, i+1);\r\n    if (strcmp(s1,s2) == 0)\r\n      return false;\r\n  }\r\n  return true;\r\n}\r\n```\r\nWouldn't this be almost simpler to write and read, _and_ you get `O(n log n)`?","created_at":"2017-09-14T09:15:54Z","updated_at":"2017-09-14T09:15:54Z","html_url":"https://github.com/Statoil/libecl/pull/181#discussion_r138838889","pull_request_url":"https://api.github.com/repos/Statoil/libecl/pulls/181","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Statoil/libecl/pulls/comments/138838889"},"html":{"href":"https://github.com/Statoil/libecl/pull/181#discussion_r138838889"},"pull_request":{"href":"https://api.github.com/repos/Statoil/libecl/pulls/181"}}},"pull_request":{"url":"https://api.github.com/repos/Statoil/libecl/pulls/181","id":140361918,"html_url":"https://github.com/Statoil/libecl/pull/181","diff_url":"https://github.com/Statoil/libecl/pull/181.diff","patch_url":"https://github.com/Statoil/libecl/pull/181.patch","issue_url":"https://api.github.com/repos/Statoil/libecl/issues/181","number":181,"state":"open","locked":false,"title":"Stringlist unique","user":{"login":"joakim-hove","id":1321665,"avatar_url":"https://avatars3.githubusercontent.com/u/1321665?v=4","gravatar_id":"","url":"https://api.github.com/users/joakim-hove","html_url":"https://github.com/joakim-hove","followers_url":"https://api.github.com/users/joakim-hove/followers","following_url":"https://api.github.com/users/joakim-hove/following{/other_user}","gists_url":"https://api.github.com/users/joakim-hove/gists{/gist_id}","starred_url":"https://api.github.com/users/joakim-hove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakim-hove/subscriptions","organizations_url":"https://api.github.com/users/joakim-hove/orgs","repos_url":"https://api.github.com/users/joakim-hove/repos","events_url":"https://api.github.com/users/joakim-hove/events{/privacy}","received_events_url":"https://api.github.com/users/joakim-hove/received_events","type":"User","site_admin":false},"body":"**Task**\r\nSmall utility function required in libres to check if all elements in a stringlist are unique.\r\n\r\n**Approach**\r\nO(n^2) sorting :-1: \r\n\r\n\r\n**Pre un-WIP checklist**\r\n- [x] Statoil tests pass locally\r\n","created_at":"2017-09-11T15:18:24Z","updated_at":"2017-09-14T09:15:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"173866759287a30aa5cadb380a22b2792e996715","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Statoil/libecl/pulls/181/commits","review_comments_url":"https://api.github.com/repos/Statoil/libecl/pulls/181/comments","review_comment_url":"https://api.github.com/repos/Statoil/libecl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Statoil/libecl/issues/181/comments","statuses_url":"https://api.github.com/repos/Statoil/libecl/statuses/b2924aad50d3511af03818dfa88de61a8f547547","head":{"label":"joakim-hove:stringlist-unique","ref":"stringlist-unique","sha":"b2924aad50d3511af03818dfa88de61a8f547547","user":{"login":"joakim-hove","id":1321665,"avatar_url":"https://avatars3.githubusercontent.com/u/1321665?v=4","gravatar_id":"","url":"https://api.github.com/users/joakim-hove","html_url":"https://github.com/joakim-hove","followers_url":"https://api.github.com/users/joakim-hove/followers","following_url":"https://api.github.com/users/joakim-hove/following{/other_user}","gists_url":"https://api.github.com/users/joakim-hove/gists{/gist_id}","starred_url":"https://api.github.com/users/joakim-hove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakim-hove/subscriptions","organizations_url":"https://api.github.com/users/joakim-hove/orgs","repos_url":"https://api.github.com/users/joakim-hove/repos","events_url":"https://api.github.com/users/joakim-hove/events{/privacy}","received_events_url":"https://api.github.com/users/joakim-hove/received_events","type":"User","site_admin":false},"repo":{"id":87737918,"name":"libecl","full_name":"joakim-hove/libecl","owner":{"login":"joakim-hove","id":1321665,"avatar_url":"https://avatars3.githubusercontent.com/u/1321665?v=4","gravatar_id":"","url":"https://api.github.com/users/joakim-hove","html_url":"https://github.com/joakim-hove","followers_url":"https://api.github.com/users/joakim-hove/followers","following_url":"https://api.github.com/users/joakim-hove/following{/other_user}","gists_url":"https://api.github.com/users/joakim-hove/gists{/gist_id}","starred_url":"https://api.github.com/users/joakim-hove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joakim-hove/subscriptions","organizations_url":"https://api.github.com/users/joakim-hove/orgs","repos_url":"https://api.github.com/users/joakim-hove/repos","events_url":"https://api.github.com/users/joakim-hove/events{/privacy}","received_events_url":"https://api.github.com/users/joakim-hove/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joakim-hove/libecl","description":null,"fork":true,"url":"https://api.github.com/repos/joakim-hove/libecl","forks_url":"https://api.github.com/repos/joakim-hove/libecl/forks","keys_url":"https://api.github.com/repos/joakim-hove/libecl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joakim-hove/libecl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joakim-hove/libecl/teams","hooks_url":"https://api.github.com/repos/joakim-hove/libecl/hooks","issue_events_url":"https://api.github.com/repos/joakim-hove/libecl/issues/events{/number}","events_url":"https://api.github.com/repos/joakim-hove/libecl/events","assignees_url":"https://api.github.com/repos/joakim-hove/libecl/assignees{/user}","branches_url":"https://api.github.com/repos/joakim-hove/libecl/branches{/branch}","tags_url":"https://api.github.com/repos/joakim-hove/libecl/tags","blobs_url":"https://api.github.com/repos/joakim-hove/libecl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joakim-hove/libecl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joakim-hove/libecl/git/refs{/sha}","trees_url":"https://api.github.com/repos/joakim-hove/libecl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joakim-hove/libecl/statuses/{sha}","languages_url":"https://api.github.com/repos/joakim-hove/libecl/languages","stargazers_url":"https://api.github.com/repos/joakim-hove/libecl/stargazers","contributors_url":"https://api.github.com/repos/joakim-hove/libecl/contributors","subscribers_url":"https://api.github.com/repos/joakim-hove/libecl/subscribers","subscription_url":"https://api.github.com/repos/joakim-hove/libecl/subscription","commits_url":"https://api.github.com/repos/joakim-hove/libecl/commits{/sha}","git_commits_url":"https://api.github.com/repos/joakim-hove/libecl/git/commits{/sha}","comments_url":"https://api.github.com/repos/joakim-hove/libecl/comments{/number}","issue_comment_url":"https://api.github.com/repos/joakim-hove/libecl/issues/comments{/number}","contents_url":"https://api.github.com/repos/joakim-hove/libecl/contents/{+path}","compare_url":"https://api.github.com/repos/joakim-hove/libecl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joakim-hove/libecl/merges","archive_url":"https://api.github.com/repos/joakim-hove/libecl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joakim-hove/libecl/downloads","issues_url":"https://api.github.com/repos/joakim-hove/libecl/issues{/number}","pulls_url":"https://api.github.com/repos/joakim-hove/libecl/pulls{/number}","milestones_url":"https://api.github.com/repos/joakim-hove/libecl/milestones{/number}","notifications_url":"https://api.github.com/repos/joakim-hove/libecl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joakim-hove/libecl/labels{/name}","releases_url":"https://api.github.com/repos/joakim-hove/libecl/releases{/id}","deployments_url":"https://api.github.com/repos/joakim-hove/libecl/deployments","created_at":"2017-04-09T20:46:46Z","updated_at":"2017-04-09T20:46:55Z","pushed_at":"2017-09-13T12:48:18Z","git_url":"git://github.com/joakim-hove/libecl.git","ssh_url":"git@github.com:joakim-hove/libecl.git","clone_url":"https://github.com/joakim-hove/libecl.git","svn_url":"https://github.com/joakim-hove/libecl","homepage":null,"size":19305,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Statoil:master","ref":"master","sha":"1a4c12ba2a4c5791f98b7ec73b850407089e72fa","user":{"login":"Statoil","id":525862,"avatar_url":"https://avatars3.githubusercontent.com/u/525862?v=4","gravatar_id":"","url":"https://api.github.com/users/Statoil","html_url":"https://github.com/Statoil","followers_url":"https://api.github.com/users/Statoil/followers","following_url":"https://api.github.com/users/Statoil/following{/other_user}","gists_url":"https://api.github.com/users/Statoil/gists{/gist_id}","starred_url":"https://api.github.com/users/Statoil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Statoil/subscriptions","organizations_url":"https://api.github.com/users/Statoil/orgs","repos_url":"https://api.github.com/users/Statoil/repos","events_url":"https://api.github.com/users/Statoil/events{/privacy}","received_events_url":"https://api.github.com/users/Statoil/received_events","type":"Organization","site_admin":false},"repo":{"id":85172345,"name":"libecl","full_name":"Statoil/libecl","owner":{"login":"Statoil","id":525862,"avatar_url":"https://avatars3.githubusercontent.com/u/525862?v=4","gravatar_id":"","url":"https://api.github.com/users/Statoil","html_url":"https://github.com/Statoil","followers_url":"https://api.github.com/users/Statoil/followers","following_url":"https://api.github.com/users/Statoil/following{/other_user}","gists_url":"https://api.github.com/users/Statoil/gists{/gist_id}","starred_url":"https://api.github.com/users/Statoil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Statoil/subscriptions","organizations_url":"https://api.github.com/users/Statoil/orgs","repos_url":"https://api.github.com/users/Statoil/repos","events_url":"https://api.github.com/users/Statoil/events{/privacy}","received_events_url":"https://api.github.com/users/Statoil/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Statoil/libecl","description":null,"fork":false,"url":"https://api.github.com/repos/Statoil/libecl","forks_url":"https://api.github.com/repos/Statoil/libecl/forks","keys_url":"https://api.github.com/repos/Statoil/libecl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Statoil/libecl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Statoil/libecl/teams","hooks_url":"https://api.github.com/repos/Statoil/libecl/hooks","issue_events_url":"https://api.github.com/repos/Statoil/libecl/issues/events{/number}","events_url":"https://api.github.com/repos/Statoil/libecl/events","assignees_url":"https://api.github.com/repos/Statoil/libecl/assignees{/user}","branches_url":"https://api.github.com/repos/Statoil/libecl/branches{/branch}","tags_url":"https://api.github.com/repos/Statoil/libecl/tags","blobs_url":"https://api.github.com/repos/Statoil/libecl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Statoil/libecl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Statoil/libecl/git/refs{/sha}","trees_url":"https://api.github.com/repos/Statoil/libecl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Statoil/libecl/statuses/{sha}","languages_url":"https://api.github.com/repos/Statoil/libecl/languages","stargazers_url":"https://api.github.com/repos/Statoil/libecl/stargazers","contributors_url":"https://api.github.com/repos/Statoil/libecl/contributors","subscribers_url":"https://api.github.com/repos/Statoil/libecl/subscribers","subscription_url":"https://api.github.com/repos/Statoil/libecl/subscription","commits_url":"https://api.github.com/repos/Statoil/libecl/commits{/sha}","git_commits_url":"https://api.github.com/repos/Statoil/libecl/git/commits{/sha}","comments_url":"https://api.github.com/repos/Statoil/libecl/comments{/number}","issue_comment_url":"https://api.github.com/repos/Statoil/libecl/issues/comments{/number}","contents_url":"https://api.github.com/repos/Statoil/libecl/contents/{+path}","compare_url":"https://api.github.com/repos/Statoil/libecl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Statoil/libecl/merges","archive_url":"https://api.github.com/repos/Statoil/libecl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Statoil/libecl/downloads","issues_url":"https://api.github.com/repos/Statoil/libecl/issues{/number}","pulls_url":"https://api.github.com/repos/Statoil/libecl/pulls{/number}","milestones_url":"https://api.github.com/repos/Statoil/libecl/milestones{/number}","notifications_url":"https://api.github.com/repos/Statoil/libecl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Statoil/libecl/labels{/name}","releases_url":"https://api.github.com/repos/Statoil/libecl/releases{/id}","deployments_url":"https://api.github.com/repos/Statoil/libecl/deployments","created_at":"2017-03-16T08:39:13Z","updated_at":"2017-09-04T06:35:02Z","pushed_at":"2017-09-13T12:48:19Z","git_url":"git://github.com/Statoil/libecl.git","ssh_url":"git@github.com:Statoil/libecl.git","clone_url":"https://github.com/Statoil/libecl.git","svn_url":"https://github.com/Statoil/libecl","homepage":null,"size":19298,"stargazers_count":10,"watchers_count":10,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":6,"forks":24,"open_issues":6,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Statoil/libecl/pulls/181"},"html":{"href":"https://github.com/Statoil/libecl/pull/181"},"issue":{"href":"https://api.github.com/repos/Statoil/libecl/issues/181"},"comments":{"href":"https://api.github.com/repos/Statoil/libecl/issues/181/comments"},"review_comments":{"href":"https://api.github.com/repos/Statoil/libecl/pulls/181/comments"},"review_comment":{"href":"https://api.github.com/repos/Statoil/libecl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Statoil/libecl/pulls/181/commits"},"statuses":{"href":"https://api.github.com/repos/Statoil/libecl/statuses/b2924aad50d3511af03818dfa88de61a8f547547"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"pgdr"}}