{"action":"created","comment":{"url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/comments/54581884","id":54581884,"diff_hunk":"@@ -443,6 +443,61 @@ modelica_metatype listAppend(modelica_metatype lst1,modelica_metatype lst2)\n   return MMC_TAGPTR(res);\n }\n \n+modelica_metatype listAppendTail(modelica_metatype lst1, modelica_metatype tail1, modelica_metatype lst2, modelica_metatype *outTail)\n+{\n+  struct mmc_cons_struct *res = NULL;\n+  struct mmc_cons_struct *p = NULL;\n+  modelica_metatype tail2;\n+  int length;\n+  int i;\n+  modelica_metatype head = MMC_UNTAGPTR(lst1);\n+\n+  if (MMC_NILTEST(lst2)) { /* If lst2 is empty, simply return lst1 and old tail of lst1*/\n+    *outTail = tail1;\n+    return lst1;\n+  }\n+  if (MMC_NILTEST(lst1)) { /* If lst1 is empty, simply return lst1 and old tail of empty lst1 */\n+    *outTail = tail1;\n+    return lst2;\n+  }\n+  length = listLength(lst2);\n+  if (MMC_NILTEST(tail1)) {\n+    // copy list one if not already done for this instance\n+    int length1 = listLength(lst1);\n+    res = (struct mmc_cons_struct*)mmc_alloc_words( length1+length * 3 ); /* Do one single big alloc. It's cheaper */\n+    head = res;\n+    for (i=0; i<length1; i++) { /* Write all except the last element... */\n+      p = res+i;\n+      p->header = MMC_STRUCTHDR(2, MMC_CONS_CTOR);\n+      p->data[0] = MMC_CAR(lst1);\n+      p->data[1] = MMC_TAGPTR(res+i+1);\n+      lst1 = MMC_CDR(lst1);\n+    }\n+    res = res + i;\n+  } else {\n+    res = (struct mmc_cons_struct*)mmc_alloc_words( length * 3 ); /* Do one single big alloc. It's cheaper */\n+    p = MMC_UNTAGPTR(tail1);\n+    p->data[1] = MMC_TAGPTR(res);\n+  }\n+\n+  // copy list two\n+  for (i=0; i<length-1; i++) {","path":"SimulationRuntime/c/meta/meta_modelica_builtin.c","position":42,"original_position":42,"commit_id":"2ccdaff3bd03eea2e80c3e03ef6a2927fa996bde","original_commit_id":"2ccdaff3bd03eea2e80c3e03ef6a2927fa996bde","user":{"login":"sjoelund","id":3016460,"avatar_url":"https://avatars.githubusercontent.com/u/3016460?v=3","gravatar_id":"","url":"https://api.github.com/users/sjoelund","html_url":"https://github.com/sjoelund","followers_url":"https://api.github.com/users/sjoelund/followers","following_url":"https://api.github.com/users/sjoelund/following{/other_user}","gists_url":"https://api.github.com/users/sjoelund/gists{/gist_id}","starred_url":"https://api.github.com/users/sjoelund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjoelund/subscriptions","organizations_url":"https://api.github.com/users/sjoelund/orgs","repos_url":"https://api.github.com/users/sjoelund/repos","events_url":"https://api.github.com/users/sjoelund/events{/privacy}","received_events_url":"https://api.github.com/users/sjoelund/received_events","type":"User","site_admin":false},"body":"Copying should be done manually in a dangerous function. Most use-cases won't need this copy","created_at":"2016-03-01T15:24:18Z","updated_at":"2016-03-01T15:24:18Z","html_url":"https://github.com/OpenModelica/OMCompiler/pull/481#discussion_r54581884","pull_request_url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481","_links":{"self":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/comments/54581884"},"html":{"href":"https://github.com/OpenModelica/OMCompiler/pull/481#discussion_r54581884"},"pull_request":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481"}}},"pull_request":{"url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481","id":61247275,"html_url":"https://github.com/OpenModelica/OMCompiler/pull/481","diff_url":"https://github.com/OpenModelica/OMCompiler/pull/481.diff","patch_url":"https://github.com/OpenModelica/OMCompiler/pull/481.patch","issue_url":"https://api.github.com/repos/OpenModelica/OMCompiler/issues/481","number":481,"state":"open","locked":false,"title":"Implement MetaModelica.Dangerous.listAppendTail()","user":{"login":"hkiel","id":9904830,"avatar_url":"https://avatars.githubusercontent.com/u/9904830?v=3","gravatar_id":"","url":"https://api.github.com/users/hkiel","html_url":"https://github.com/hkiel","followers_url":"https://api.github.com/users/hkiel/followers","following_url":"https://api.github.com/users/hkiel/following{/other_user}","gists_url":"https://api.github.com/users/hkiel/gists{/gist_id}","starred_url":"https://api.github.com/users/hkiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkiel/subscriptions","organizations_url":"https://api.github.com/users/hkiel/orgs","repos_url":"https://api.github.com/users/hkiel/repos","events_url":"https://api.github.com/users/hkiel/events{/privacy}","received_events_url":"https://api.github.com/users/hkiel/received_events","type":"User","site_admin":false},"body":"it is a fast and not memory consuming alternative to construct lists using \"listAppend\" method.\r\nSample implementation of some functions given.\r\n\r\nShould be able to improve [ticket 3685](https://trac.openmodelica.org/OpenModelica/ticket/3685)","created_at":"2016-03-01T14:13:23Z","updated_at":"2016-03-01T15:24:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e775a08ca38d1378a7ef28f102fb50263adfdb1a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481/commits","review_comments_url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481/comments","review_comment_url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenModelica/OMCompiler/issues/481/comments","statuses_url":"https://api.github.com/repos/OpenModelica/OMCompiler/statuses/2ccdaff3bd03eea2e80c3e03ef6a2927fa996bde","head":{"label":"hkiel:listAppendTail","ref":"listAppendTail","sha":"2ccdaff3bd03eea2e80c3e03ef6a2927fa996bde","user":{"login":"hkiel","id":9904830,"avatar_url":"https://avatars.githubusercontent.com/u/9904830?v=3","gravatar_id":"","url":"https://api.github.com/users/hkiel","html_url":"https://github.com/hkiel","followers_url":"https://api.github.com/users/hkiel/followers","following_url":"https://api.github.com/users/hkiel/following{/other_user}","gists_url":"https://api.github.com/users/hkiel/gists{/gist_id}","starred_url":"https://api.github.com/users/hkiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkiel/subscriptions","organizations_url":"https://api.github.com/users/hkiel/orgs","repos_url":"https://api.github.com/users/hkiel/repos","events_url":"https://api.github.com/users/hkiel/events{/privacy}","received_events_url":"https://api.github.com/users/hkiel/received_events","type":"User","site_admin":false},"repo":{"id":48178120,"name":"OMCompiler","full_name":"hkiel/OMCompiler","owner":{"login":"hkiel","id":9904830,"avatar_url":"https://avatars.githubusercontent.com/u/9904830?v=3","gravatar_id":"","url":"https://api.github.com/users/hkiel","html_url":"https://github.com/hkiel","followers_url":"https://api.github.com/users/hkiel/followers","following_url":"https://api.github.com/users/hkiel/following{/other_user}","gists_url":"https://api.github.com/users/hkiel/gists{/gist_id}","starred_url":"https://api.github.com/users/hkiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkiel/subscriptions","organizations_url":"https://api.github.com/users/hkiel/orgs","repos_url":"https://api.github.com/users/hkiel/repos","events_url":"https://api.github.com/users/hkiel/events{/privacy}","received_events_url":"https://api.github.com/users/hkiel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hkiel/OMCompiler","description":"The OpenModelica Compiler is the core of the OpenModelica project, which is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.","fork":true,"url":"https://api.github.com/repos/hkiel/OMCompiler","forks_url":"https://api.github.com/repos/hkiel/OMCompiler/forks","keys_url":"https://api.github.com/repos/hkiel/OMCompiler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hkiel/OMCompiler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hkiel/OMCompiler/teams","hooks_url":"https://api.github.com/repos/hkiel/OMCompiler/hooks","issue_events_url":"https://api.github.com/repos/hkiel/OMCompiler/issues/events{/number}","events_url":"https://api.github.com/repos/hkiel/OMCompiler/events","assignees_url":"https://api.github.com/repos/hkiel/OMCompiler/assignees{/user}","branches_url":"https://api.github.com/repos/hkiel/OMCompiler/branches{/branch}","tags_url":"https://api.github.com/repos/hkiel/OMCompiler/tags","blobs_url":"https://api.github.com/repos/hkiel/OMCompiler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hkiel/OMCompiler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hkiel/OMCompiler/git/refs{/sha}","trees_url":"https://api.github.com/repos/hkiel/OMCompiler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hkiel/OMCompiler/statuses/{sha}","languages_url":"https://api.github.com/repos/hkiel/OMCompiler/languages","stargazers_url":"https://api.github.com/repos/hkiel/OMCompiler/stargazers","contributors_url":"https://api.github.com/repos/hkiel/OMCompiler/contributors","subscribers_url":"https://api.github.com/repos/hkiel/OMCompiler/subscribers","subscription_url":"https://api.github.com/repos/hkiel/OMCompiler/subscription","commits_url":"https://api.github.com/repos/hkiel/OMCompiler/commits{/sha}","git_commits_url":"https://api.github.com/repos/hkiel/OMCompiler/git/commits{/sha}","comments_url":"https://api.github.com/repos/hkiel/OMCompiler/comments{/number}","issue_comment_url":"https://api.github.com/repos/hkiel/OMCompiler/issues/comments{/number}","contents_url":"https://api.github.com/repos/hkiel/OMCompiler/contents/{+path}","compare_url":"https://api.github.com/repos/hkiel/OMCompiler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hkiel/OMCompiler/merges","archive_url":"https://api.github.com/repos/hkiel/OMCompiler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hkiel/OMCompiler/downloads","issues_url":"https://api.github.com/repos/hkiel/OMCompiler/issues{/number}","pulls_url":"https://api.github.com/repos/hkiel/OMCompiler/pulls{/number}","milestones_url":"https://api.github.com/repos/hkiel/OMCompiler/milestones{/number}","notifications_url":"https://api.github.com/repos/hkiel/OMCompiler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hkiel/OMCompiler/labels{/name}","releases_url":"https://api.github.com/repos/hkiel/OMCompiler/releases{/id}","deployments_url":"https://api.github.com/repos/hkiel/OMCompiler/deployments","created_at":"2015-12-17T14:14:17Z","updated_at":"2016-02-10T14:30:58Z","pushed_at":"2016-03-01T14:50:49Z","git_url":"git://github.com/hkiel/OMCompiler.git","ssh_url":"git@github.com:hkiel/OMCompiler.git","clone_url":"https://github.com/hkiel/OMCompiler.git","svn_url":"https://github.com/hkiel/OMCompiler","homepage":"https://trac.openmodelica.org/OpenModelica","size":65891,"stargazers_count":0,"watchers_count":0,"language":"Modelica","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenModelica:master","ref":"master","sha":"3f4477c825273f991216782723c2f006fd92db4b","user":{"login":"OpenModelica","id":4006504,"avatar_url":"https://avatars.githubusercontent.com/u/4006504?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenModelica","html_url":"https://github.com/OpenModelica","followers_url":"https://api.github.com/users/OpenModelica/followers","following_url":"https://api.github.com/users/OpenModelica/following{/other_user}","gists_url":"https://api.github.com/users/OpenModelica/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenModelica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenModelica/subscriptions","organizations_url":"https://api.github.com/users/OpenModelica/orgs","repos_url":"https://api.github.com/users/OpenModelica/repos","events_url":"https://api.github.com/users/OpenModelica/events{/privacy}","received_events_url":"https://api.github.com/users/OpenModelica/received_events","type":"Organization","site_admin":false},"repo":{"id":35014743,"name":"OMCompiler","full_name":"OpenModelica/OMCompiler","owner":{"login":"OpenModelica","id":4006504,"avatar_url":"https://avatars.githubusercontent.com/u/4006504?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenModelica","html_url":"https://github.com/OpenModelica","followers_url":"https://api.github.com/users/OpenModelica/followers","following_url":"https://api.github.com/users/OpenModelica/following{/other_user}","gists_url":"https://api.github.com/users/OpenModelica/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenModelica/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenModelica/subscriptions","organizations_url":"https://api.github.com/users/OpenModelica/orgs","repos_url":"https://api.github.com/users/OpenModelica/repos","events_url":"https://api.github.com/users/OpenModelica/events{/privacy}","received_events_url":"https://api.github.com/users/OpenModelica/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenModelica/OMCompiler","description":"The OpenModelica Compiler is the core of the OpenModelica project, which is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.","fork":false,"url":"https://api.github.com/repos/OpenModelica/OMCompiler","forks_url":"https://api.github.com/repos/OpenModelica/OMCompiler/forks","keys_url":"https://api.github.com/repos/OpenModelica/OMCompiler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenModelica/OMCompiler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenModelica/OMCompiler/teams","hooks_url":"https://api.github.com/repos/OpenModelica/OMCompiler/hooks","issue_events_url":"https://api.github.com/repos/OpenModelica/OMCompiler/issues/events{/number}","events_url":"https://api.github.com/repos/OpenModelica/OMCompiler/events","assignees_url":"https://api.github.com/repos/OpenModelica/OMCompiler/assignees{/user}","branches_url":"https://api.github.com/repos/OpenModelica/OMCompiler/branches{/branch}","tags_url":"https://api.github.com/repos/OpenModelica/OMCompiler/tags","blobs_url":"https://api.github.com/repos/OpenModelica/OMCompiler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenModelica/OMCompiler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenModelica/OMCompiler/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenModelica/OMCompiler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenModelica/OMCompiler/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenModelica/OMCompiler/languages","stargazers_url":"https://api.github.com/repos/OpenModelica/OMCompiler/stargazers","contributors_url":"https://api.github.com/repos/OpenModelica/OMCompiler/contributors","subscribers_url":"https://api.github.com/repos/OpenModelica/OMCompiler/subscribers","subscription_url":"https://api.github.com/repos/OpenModelica/OMCompiler/subscription","commits_url":"https://api.github.com/repos/OpenModelica/OMCompiler/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenModelica/OMCompiler/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenModelica/OMCompiler/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenModelica/OMCompiler/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenModelica/OMCompiler/contents/{+path}","compare_url":"https://api.github.com/repos/OpenModelica/OMCompiler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenModelica/OMCompiler/merges","archive_url":"https://api.github.com/repos/OpenModelica/OMCompiler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenModelica/OMCompiler/downloads","issues_url":"https://api.github.com/repos/OpenModelica/OMCompiler/issues{/number}","pulls_url":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenModelica/OMCompiler/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenModelica/OMCompiler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenModelica/OMCompiler/labels{/name}","releases_url":"https://api.github.com/repos/OpenModelica/OMCompiler/releases{/id}","deployments_url":"https://api.github.com/repos/OpenModelica/OMCompiler/deployments","created_at":"2015-05-04T04:53:52Z","updated_at":"2016-02-01T04:43:18Z","pushed_at":"2016-03-01T15:10:24Z","git_url":"git://github.com/OpenModelica/OMCompiler.git","ssh_url":"git@github.com:OpenModelica/OMCompiler.git","clone_url":"https://github.com/OpenModelica/OMCompiler.git","svn_url":"https://github.com/OpenModelica/OMCompiler","homepage":"https://trac.openmodelica.org/OpenModelica","size":74232,"stargazers_count":12,"watchers_count":12,"language":"Modelica","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":6,"forks":37,"open_issues":6,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481"},"html":{"href":"https://github.com/OpenModelica/OMCompiler/pull/481"},"issue":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/issues/481"},"comments":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/issues/481/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/pulls/481/commits"},"statuses":{"href":"https://api.github.com/repos/OpenModelica/OMCompiler/statuses/2ccdaff3bd03eea2e80c3e03ef6a2927fa996bde"}}}}