{"action":"created","comment":{"url":"https://api.github.com/repos/vstakhov/libucl/pulls/comments/31593638","id":31593638,"diff_hunk":"@@ -966,6 +970,97 @@ ucl_include_file_single (const unsigned char *data, size_t len,\n \tprev_state = parser->state;\n \tparser->state = UCL_STATE_INIT;\n \n+\tif (use_prefix && prefix == NULL) {\n+\t\t/* Auto generate a key name based on the included filename */\n+\t\tprefix = basename(realbuf);\n+\t\text = strrchr(prefix, '.');\n+\t\tif (strcmp(ext, \".conf\") == 0 || strcmp(ext, \".ucl\") == 0) {\n+\t\t\t/* Strip off .conf or .ucl */\n+\t\t\t*ext = '\\0';\n+\t\t}\n+\t}\n+\tif (prefix != NULL) {\n+\t\t/* This is a prefixed include */\n+\t\tcontainer = parser->stack->obj->value.ov;\n+\n+\t\told_obj = __DECONST (ucl_object_t *, ucl_hash_search (container, prefix, strlen(prefix)));\n+\n+\t\tif (strcasecmp(target, \"array\") == 0 && old_obj == NULL) {\n+\t\t\t/* Create an array with key: prefix */\n+\t\t\told_obj = ucl_object_new_full (UCL_ARRAY, priority);\n+\t\t\told_obj->key = prefix;\n+\t\t\told_obj->keylen = strlen(prefix);\n+\t\t\tucl_copy_key_trash(old_obj);\n+\t\t\told_obj->prev = old_obj;\n+\t\t\told_obj->next = NULL;\n+\n+\t\t\tcontainer = ucl_hash_insert_object (container, old_obj,\n+\t\t\t\t\tparser->flags & UCL_PARSER_KEY_LOWERCASE);\n+\t\t\tparser->stack->obj->len ++;\n+\n+\t\t\tnest_obj = ucl_object_new_full (UCL_OBJECT, priority);\n+\t\t\tnest_obj->prev = nest_obj;\n+\t\t\tnest_obj->next = NULL;\n+\n+\t\t\tucl_array_append(old_obj, nest_obj);\n+\t\t}\n+\t\telse if (old_obj == NULL) {\n+\t\t\t/* Create an object with key: prefix */\n+\t\t\tnest_obj = ucl_object_new_full (UCL_OBJECT, priority);\n+\t\t\tnest_obj->key = prefix;\n+\t\t\tnest_obj->keylen = strlen(prefix);\n+\t\t\tucl_copy_key_trash(nest_obj);\n+\t\t\tnest_obj->prev = nest_obj;\n+\t\t\tnest_obj->next = NULL;\n+\n+\t\t\tcontainer = ucl_hash_insert_object (container, nest_obj,\n+\t\t\t\t\tparser->flags & UCL_PARSER_KEY_LOWERCASE);\n+\t\t\tparser->stack->obj->len ++;\n+\t\t}\n+\t\telse if (strcasecmp(target, \"array\") == 0 || ucl_object_type(old_obj) == UCL_ARRAY) {\n+\t\t\tif (ucl_object_type(old_obj) == UCL_ARRAY) {\n+\t\t\t\t/* Append to the existing array */\n+\t\t\t\tnest_obj = ucl_object_new_full (UCL_OBJECT, priority);\n+\t\t\t\tnest_obj->prev = nest_obj;\n+\t\t\t\tnest_obj->next = NULL;\n+\n+\t\t\t\tucl_array_append (old_obj, nest_obj);\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\t/* Convert the object to an array */","path":"src/ucl_util.c","position":94,"original_position":94,"commit_id":"b32d192a3c4589d2cc14ec021f47ed5de3a044c5","original_commit_id":"804ab2337ef422ecaf4aaf65ffb84956eea889be","user":{"login":"allanjude","id":1096028,"avatar_url":"https://avatars.githubusercontent.com/u/1096028?v=3","gravatar_id":"","url":"https://api.github.com/users/allanjude","html_url":"https://github.com/allanjude","followers_url":"https://api.github.com/users/allanjude/followers","following_url":"https://api.github.com/users/allanjude/following{/other_user}","gists_url":"https://api.github.com/users/allanjude/gists{/gist_id}","starred_url":"https://api.github.com/users/allanjude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allanjude/subscriptions","organizations_url":"https://api.github.com/users/allanjude/orgs","repos_url":"https://api.github.com/users/allanjude/repos","events_url":"https://api.github.com/users/allanjude/events{/privacy}","received_events_url":"https://api.github.com/users/allanjude/received_events","type":"User","site_admin":false},"body":"Sorry, I completely missed that. Added","created_at":"2015-06-03T04:50:25Z","updated_at":"2015-06-03T04:50:25Z","html_url":"https://github.com/vstakhov/libucl/pull/91#discussion_r31593638","pull_request_url":"https://api.github.com/repos/vstakhov/libucl/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/vstakhov/libucl/pulls/comments/31593638"},"html":{"href":"https://github.com/vstakhov/libucl/pull/91#discussion_r31593638"},"pull_request":{"href":"https://api.github.com/repos/vstakhov/libucl/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/vstakhov/libucl/pulls/91","id":36691454,"html_url":"https://github.com/vstakhov/libucl/pull/91","diff_url":"https://github.com/vstakhov/libucl/pull/91.diff","patch_url":"https://github.com/vstakhov/libucl/pull/91.patch","issue_url":"https://api.github.com/repos/vstakhov/libucl/issues/91","number":91,"state":"open","locked":false,"title":"Feature/include prefix","user":{"login":"allanjude","id":1096028,"avatar_url":"https://avatars.githubusercontent.com/u/1096028?v=3","gravatar_id":"","url":"https://api.github.com/users/allanjude","html_url":"https://github.com/allanjude","followers_url":"https://api.github.com/users/allanjude/followers","following_url":"https://api.github.com/users/allanjude/following{/other_user}","gists_url":"https://api.github.com/users/allanjude/gists{/gist_id}","starred_url":"https://api.github.com/users/allanjude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allanjude/subscriptions","organizations_url":"https://api.github.com/users/allanjude/orgs","repos_url":"https://api.github.com/users/allanjude/repos","events_url":"https://api.github.com/users/allanjude/events{/privacy}","received_events_url":"https://api.github.com/users/allanjude/received_events","type":"User","site_admin":false},"body":"Allow included files to be loaded into a key, to separate each into their own namespace. If no key is provided, one is automatically generated based on the basename() of the included file (with .conf or .ucl removed from the end of the file name)\r\n","created_at":"2015-06-02T03:17:58Z","updated_at":"2015-06-03T04:50:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2dc08a175a1e60d6fe1bbc2f874a64ba199dfb98","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vstakhov/libucl/pulls/91/commits","review_comments_url":"https://api.github.com/repos/vstakhov/libucl/pulls/91/comments","review_comment_url":"https://api.github.com/repos/vstakhov/libucl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vstakhov/libucl/issues/91/comments","statuses_url":"https://api.github.com/repos/vstakhov/libucl/statuses/b32d192a3c4589d2cc14ec021f47ed5de3a044c5","head":{"label":"allanjude:feature/include_nest","ref":"feature/include_nest","sha":"b32d192a3c4589d2cc14ec021f47ed5de3a044c5","user":{"login":"allanjude","id":1096028,"avatar_url":"https://avatars.githubusercontent.com/u/1096028?v=3","gravatar_id":"","url":"https://api.github.com/users/allanjude","html_url":"https://github.com/allanjude","followers_url":"https://api.github.com/users/allanjude/followers","following_url":"https://api.github.com/users/allanjude/following{/other_user}","gists_url":"https://api.github.com/users/allanjude/gists{/gist_id}","starred_url":"https://api.github.com/users/allanjude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allanjude/subscriptions","organizations_url":"https://api.github.com/users/allanjude/orgs","repos_url":"https://api.github.com/users/allanjude/repos","events_url":"https://api.github.com/users/allanjude/events{/privacy}","received_events_url":"https://api.github.com/users/allanjude/received_events","type":"User","site_admin":false},"repo":{"id":26193729,"name":"libucl","full_name":"allanjude/libucl","owner":{"login":"allanjude","id":1096028,"avatar_url":"https://avatars.githubusercontent.com/u/1096028?v=3","gravatar_id":"","url":"https://api.github.com/users/allanjude","html_url":"https://github.com/allanjude","followers_url":"https://api.github.com/users/allanjude/followers","following_url":"https://api.github.com/users/allanjude/following{/other_user}","gists_url":"https://api.github.com/users/allanjude/gists{/gist_id}","starred_url":"https://api.github.com/users/allanjude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allanjude/subscriptions","organizations_url":"https://api.github.com/users/allanjude/orgs","repos_url":"https://api.github.com/users/allanjude/repos","events_url":"https://api.github.com/users/allanjude/events{/privacy}","received_events_url":"https://api.github.com/users/allanjude/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/allanjude/libucl","description":"Universal configuration library parser","fork":true,"url":"https://api.github.com/repos/allanjude/libucl","forks_url":"https://api.github.com/repos/allanjude/libucl/forks","keys_url":"https://api.github.com/repos/allanjude/libucl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allanjude/libucl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allanjude/libucl/teams","hooks_url":"https://api.github.com/repos/allanjude/libucl/hooks","issue_events_url":"https://api.github.com/repos/allanjude/libucl/issues/events{/number}","events_url":"https://api.github.com/repos/allanjude/libucl/events","assignees_url":"https://api.github.com/repos/allanjude/libucl/assignees{/user}","branches_url":"https://api.github.com/repos/allanjude/libucl/branches{/branch}","tags_url":"https://api.github.com/repos/allanjude/libucl/tags","blobs_url":"https://api.github.com/repos/allanjude/libucl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allanjude/libucl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allanjude/libucl/git/refs{/sha}","trees_url":"https://api.github.com/repos/allanjude/libucl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allanjude/libucl/statuses/{sha}","languages_url":"https://api.github.com/repos/allanjude/libucl/languages","stargazers_url":"https://api.github.com/repos/allanjude/libucl/stargazers","contributors_url":"https://api.github.com/repos/allanjude/libucl/contributors","subscribers_url":"https://api.github.com/repos/allanjude/libucl/subscribers","subscription_url":"https://api.github.com/repos/allanjude/libucl/subscription","commits_url":"https://api.github.com/repos/allanjude/libucl/commits{/sha}","git_commits_url":"https://api.github.com/repos/allanjude/libucl/git/commits{/sha}","comments_url":"https://api.github.com/repos/allanjude/libucl/comments{/number}","issue_comment_url":"https://api.github.com/repos/allanjude/libucl/issues/comments{/number}","contents_url":"https://api.github.com/repos/allanjude/libucl/contents/{+path}","compare_url":"https://api.github.com/repos/allanjude/libucl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allanjude/libucl/merges","archive_url":"https://api.github.com/repos/allanjude/libucl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allanjude/libucl/downloads","issues_url":"https://api.github.com/repos/allanjude/libucl/issues{/number}","pulls_url":"https://api.github.com/repos/allanjude/libucl/pulls{/number}","milestones_url":"https://api.github.com/repos/allanjude/libucl/milestones{/number}","notifications_url":"https://api.github.com/repos/allanjude/libucl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allanjude/libucl/labels{/name}","releases_url":"https://api.github.com/repos/allanjude/libucl/releases{/id}","created_at":"2014-11-04T23:33:52Z","updated_at":"2015-04-18T20:04:22Z","pushed_at":"2015-06-03T04:49:40Z","git_url":"git://github.com/allanjude/libucl.git","ssh_url":"git@github.com:allanjude/libucl.git","clone_url":"https://github.com/allanjude/libucl.git","svn_url":"https://github.com/allanjude/libucl","homepage":null,"size":3352,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"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":1,"default_branch":"master"}},"base":{"label":"vstakhov:master","ref":"master","sha":"8718d0ec17ca9017249dc618b91d9e76c3f67c14","user":{"login":"vstakhov","id":487344,"avatar_url":"https://avatars.githubusercontent.com/u/487344?v=3","gravatar_id":"","url":"https://api.github.com/users/vstakhov","html_url":"https://github.com/vstakhov","followers_url":"https://api.github.com/users/vstakhov/followers","following_url":"https://api.github.com/users/vstakhov/following{/other_user}","gists_url":"https://api.github.com/users/vstakhov/gists{/gist_id}","starred_url":"https://api.github.com/users/vstakhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstakhov/subscriptions","organizations_url":"https://api.github.com/users/vstakhov/orgs","repos_url":"https://api.github.com/users/vstakhov/repos","events_url":"https://api.github.com/users/vstakhov/events{/privacy}","received_events_url":"https://api.github.com/users/vstakhov/received_events","type":"User","site_admin":false},"repo":{"id":13486798,"name":"libucl","full_name":"vstakhov/libucl","owner":{"login":"vstakhov","id":487344,"avatar_url":"https://avatars.githubusercontent.com/u/487344?v=3","gravatar_id":"","url":"https://api.github.com/users/vstakhov","html_url":"https://github.com/vstakhov","followers_url":"https://api.github.com/users/vstakhov/followers","following_url":"https://api.github.com/users/vstakhov/following{/other_user}","gists_url":"https://api.github.com/users/vstakhov/gists{/gist_id}","starred_url":"https://api.github.com/users/vstakhov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vstakhov/subscriptions","organizations_url":"https://api.github.com/users/vstakhov/orgs","repos_url":"https://api.github.com/users/vstakhov/repos","events_url":"https://api.github.com/users/vstakhov/events{/privacy}","received_events_url":"https://api.github.com/users/vstakhov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vstakhov/libucl","description":"Universal configuration library parser","fork":false,"url":"https://api.github.com/repos/vstakhov/libucl","forks_url":"https://api.github.com/repos/vstakhov/libucl/forks","keys_url":"https://api.github.com/repos/vstakhov/libucl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vstakhov/libucl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vstakhov/libucl/teams","hooks_url":"https://api.github.com/repos/vstakhov/libucl/hooks","issue_events_url":"https://api.github.com/repos/vstakhov/libucl/issues/events{/number}","events_url":"https://api.github.com/repos/vstakhov/libucl/events","assignees_url":"https://api.github.com/repos/vstakhov/libucl/assignees{/user}","branches_url":"https://api.github.com/repos/vstakhov/libucl/branches{/branch}","tags_url":"https://api.github.com/repos/vstakhov/libucl/tags","blobs_url":"https://api.github.com/repos/vstakhov/libucl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vstakhov/libucl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vstakhov/libucl/git/refs{/sha}","trees_url":"https://api.github.com/repos/vstakhov/libucl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vstakhov/libucl/statuses/{sha}","languages_url":"https://api.github.com/repos/vstakhov/libucl/languages","stargazers_url":"https://api.github.com/repos/vstakhov/libucl/stargazers","contributors_url":"https://api.github.com/repos/vstakhov/libucl/contributors","subscribers_url":"https://api.github.com/repos/vstakhov/libucl/subscribers","subscription_url":"https://api.github.com/repos/vstakhov/libucl/subscription","commits_url":"https://api.github.com/repos/vstakhov/libucl/commits{/sha}","git_commits_url":"https://api.github.com/repos/vstakhov/libucl/git/commits{/sha}","comments_url":"https://api.github.com/repos/vstakhov/libucl/comments{/number}","issue_comment_url":"https://api.github.com/repos/vstakhov/libucl/issues/comments{/number}","contents_url":"https://api.github.com/repos/vstakhov/libucl/contents/{+path}","compare_url":"https://api.github.com/repos/vstakhov/libucl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vstakhov/libucl/merges","archive_url":"https://api.github.com/repos/vstakhov/libucl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vstakhov/libucl/downloads","issues_url":"https://api.github.com/repos/vstakhov/libucl/issues{/number}","pulls_url":"https://api.github.com/repos/vstakhov/libucl/pulls{/number}","milestones_url":"https://api.github.com/repos/vstakhov/libucl/milestones{/number}","notifications_url":"https://api.github.com/repos/vstakhov/libucl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vstakhov/libucl/labels{/name}","releases_url":"https://api.github.com/repos/vstakhov/libucl/releases{/id}","created_at":"2013-10-11T01:04:47Z","updated_at":"2015-05-31T15:46:24Z","pushed_at":"2015-06-03T04:49:41Z","git_url":"git://github.com/vstakhov/libucl.git","ssh_url":"git@github.com:vstakhov/libucl.git","clone_url":"https://github.com/vstakhov/libucl.git","svn_url":"https://github.com/vstakhov/libucl","homepage":null,"size":4541,"stargazers_count":481,"watchers_count":481,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":24,"forks":29,"open_issues":24,"watchers":481,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vstakhov/libucl/pulls/91"},"html":{"href":"https://github.com/vstakhov/libucl/pull/91"},"issue":{"href":"https://api.github.com/repos/vstakhov/libucl/issues/91"},"comments":{"href":"https://api.github.com/repos/vstakhov/libucl/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/vstakhov/libucl/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/vstakhov/libucl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vstakhov/libucl/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/vstakhov/libucl/statuses/b32d192a3c4589d2cc14ec021f47ed5de3a044c5"}}}}