{"action":"created","comment":{"url":"https://api.github.com/repos/premake/premake-core/pulls/comments/209145479","pull_request_review_id":145104409,"id":209145479,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTE0NTQ3OQ==","diff_hunk":"@@ -8,128 +8,124 @@\n #include <ctype.h>\n #include <string.h>\n \n-// isspace custom version (visual c++'s one doesn't like utf8 characters)\n-static int is_space(char c)\n-{\n-\treturn  (c >= 9 && c <= 13) || c == 32;\n-}\n+#define\tIS_SEP(__c)\t\t\t((__c) == '/' || (__c) == '\\\\')\n \n-static void* normalize_substring(const char* str, const char* endPtr, char* writePtr) {\n-\tconst char* const source = str;\n-\tconst char* const writeBegin = writePtr;\n-\tconst char* ptr;\n-\tchar last = 0;\n-\tchar ch;\n+#define IS_UPPER_ALPHA(__c)\t((__c) >= 'A' && (__c) <= 'Z')\n+#define IS_LOWER_ALPHA(__c)\t((__c) >= 'a' && (__c) <= 'z')\n+#define IS_ALPHA(__c)\t\t(IS_UPPER_ALPHA(__c) || IS_LOWER_ALPHA(__c))\n \n-\twhile (str != endPtr) {\n-\t\tch = (*str);\n+#define IS_SPACE(__c)\t\t((__c >= '\\t' && __c <= '\\r') || __c == ' ')\n \n-\t\t/* make sure we're using '/' for all separators */\n-\t\tif (ch == '\\\\') {\n-\t\t\tch = '/';\n-\t\t}\n+static void* normalize_substring(const char* srcPtr, const char* srcEnd, char* dstPtr) {\n \n-\t\t/* filter out .. except when it's part of the file or folder name */\n-\t\tif (ch == '.' && last == '.' && *(str - 2) == '/' && (*(str + 1) == '/' || str + 1 == endPtr)) {\n-\t\t\tlast = 0;\n-\n-\t\t\tptr = writePtr - 3;\n-\t\t\twhile (ptr >= writeBegin) {\n-\t\t\t\t/* break on '/' except when it's '/../' */\n-\t\t\t\tif (ptr[0] == '/' && !(ptr[1] == '.' && ptr[2] == '.' && ptr[3] == '/')) {\n-\t\t\t\t\twritePtr -= writePtr - ptr;\n-\n-\t\t\t\t\t/* special fix for cases, when '..' is the last chars in path i.e. d:\\game\\.., this should be converted into d:\\,\n-\t\t\t\t\tbut without this case, it will be converted into d: */\n-\t\t\t\t\tif (writePtr - 1 >= writeBegin && *(writePtr - 1) == ':' && str + 1 == endPtr) {\n-\t\t\t\t\t\t++writePtr;\n-\t\t\t\t\t}\n-\t\t\t\t\tbreak;\n-\t\t\t\t}\n-\t\t\t\t--ptr;\n-\t\t\t}\n+#define IS_END(__p)\t\t\t(__p >= srcEnd || *__p == '\\0')\n+#define IS_SEP_OR_END(__p)\t(IS_END(__p) || IS_SEP(*__p))\n \n-\t\t\tif (ptr < writeBegin) {\n-\t\t\t\t*(writePtr++) = ch;\n-\t\t\t}\n+\t// Handle Windows absolute paths\n+\tif (IS_ALPHA(srcPtr[0]) && srcPtr[1] == ':')\n+\t{\n+\t\t*(dstPtr++) = srcPtr[0];\n+\t\t*(dstPtr++) = ':';\n+\n+\t\tsrcPtr += 2;\n+\t}\n \n-\t\t\t++str;\n-\t\t\tcontinue;\n+\t// Handle path starting with a sep (C:/ or /)\n+\tif (IS_SEP(*srcPtr))\n+\t{\n+\t\t++srcPtr;\n+\t\t*(dstPtr++) = '/';\n+\t\t// Handle path starting with //\n+\t\tif (IS_SEP(*srcPtr))\n+\t\t{\n+\t\t\t++srcPtr;\n+\t\t\t*(dstPtr++) = '/';\n \t\t}\n+\t}\n \n-\t\t/* filter out /./ */\n-\t\tif (ch == '/' && last == '.') {\n-\t\t\tptr = str - 2;\n-\t\t\tif (*ptr == '/') {\t// there is no need to check whether ptr >= source since all the leading ./ will be skipped in path_normalize\n-\t\t\t\tif (ptr - 1 < source || *(ptr - 1) != ':') {\n-\t\t\t\t\t--writePtr;\n-\t\t\t\t}\n+\tconst char * const dstRoot = dstPtr;\n+\tunsigned int folderDepth = 0;","path":"src/host/path_normalize.c","position":88,"original_position":88,"commit_id":"493ac83bbc272ca9fed236e43e5bcb5782c7d8bc","original_commit_id":"493ac83bbc272ca9fed236e43e5bcb5782c7d8bc","user":{"login":"samsinsane","id":11887457,"node_id":"MDQ6VXNlcjExODg3NDU3","avatar_url":"https://avatars2.githubusercontent.com/u/11887457?v=4","gravatar_id":"","url":"https://api.github.com/users/samsinsane","html_url":"https://github.com/samsinsane","followers_url":"https://api.github.com/users/samsinsane/followers","following_url":"https://api.github.com/users/samsinsane/following{/other_user}","gists_url":"https://api.github.com/users/samsinsane/gists{/gist_id}","starred_url":"https://api.github.com/users/samsinsane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samsinsane/subscriptions","organizations_url":"https://api.github.com/users/samsinsane/orgs","repos_url":"https://api.github.com/users/samsinsane/repos","events_url":"https://api.github.com/users/samsinsane/events{/privacy}","received_events_url":"https://api.github.com/users/samsinsane/received_events","type":"User","site_admin":false},"body":"These probably need to be at the top of the function - some people build Premake with compilers that don't support this. I can't recall what, but we've had issues opened about it before - it might be older versions of VS.","created_at":"2018-08-10T05:05:27Z","updated_at":"2018-08-10T05:31:55Z","html_url":"https://github.com/premake/premake-core/pull/1132#discussion_r209145479","pull_request_url":"https://api.github.com/repos/premake/premake-core/pulls/1132","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/premake/premake-core/pulls/comments/209145479"},"html":{"href":"https://github.com/premake/premake-core/pull/1132#discussion_r209145479"},"pull_request":{"href":"https://api.github.com/repos/premake/premake-core/pulls/1132"}}},"pull_request":{"url":"https://api.github.com/repos/premake/premake-core/pulls/1132","id":199724499,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5NzI0NDk5","html_url":"https://github.com/premake/premake-core/pull/1132","diff_url":"https://github.com/premake/premake-core/pull/1132.diff","patch_url":"https://github.com/premake/premake-core/pull/1132.patch","issue_url":"https://api.github.com/repos/premake/premake-core/issues/1132","number":1132,"state":"open","locked":false,"title":"Refactor path.normalize and handle path ending with .","user":{"login":"tdesveauxPKFX","id":33718714,"node_id":"MDQ6VXNlcjMzNzE4NzE0","avatar_url":"https://avatars1.githubusercontent.com/u/33718714?v=4","gravatar_id":"","url":"https://api.github.com/users/tdesveauxPKFX","html_url":"https://github.com/tdesveauxPKFX","followers_url":"https://api.github.com/users/tdesveauxPKFX/followers","following_url":"https://api.github.com/users/tdesveauxPKFX/following{/other_user}","gists_url":"https://api.github.com/users/tdesveauxPKFX/gists{/gist_id}","starred_url":"https://api.github.com/users/tdesveauxPKFX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdesveauxPKFX/subscriptions","organizations_url":"https://api.github.com/users/tdesveauxPKFX/orgs","repos_url":"https://api.github.com/users/tdesveauxPKFX/repos","events_url":"https://api.github.com/users/tdesveauxPKFX/events{/privacy}","received_events_url":"https://api.github.com/users/tdesveauxPKFX/received_events","type":"User","site_admin":false},"body":"Related to #1121 ","created_at":"2018-07-06T11:48:53Z","updated_at":"2018-08-10T05:31:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ecf40e3b3e40090161b4e09d3bd663e5d6a9848","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/premake/premake-core/pulls/1132/commits","review_comments_url":"https://api.github.com/repos/premake/premake-core/pulls/1132/comments","review_comment_url":"https://api.github.com/repos/premake/premake-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/premake/premake-core/issues/1132/comments","statuses_url":"https://api.github.com/repos/premake/premake-core/statuses/493ac83bbc272ca9fed236e43e5bcb5782c7d8bc","head":{"label":"tdesveauxPKFX:host/normalize","ref":"host/normalize","sha":"493ac83bbc272ca9fed236e43e5bcb5782c7d8bc","user":{"login":"tdesveauxPKFX","id":33718714,"node_id":"MDQ6VXNlcjMzNzE4NzE0","avatar_url":"https://avatars1.githubusercontent.com/u/33718714?v=4","gravatar_id":"","url":"https://api.github.com/users/tdesveauxPKFX","html_url":"https://github.com/tdesveauxPKFX","followers_url":"https://api.github.com/users/tdesveauxPKFX/followers","following_url":"https://api.github.com/users/tdesveauxPKFX/following{/other_user}","gists_url":"https://api.github.com/users/tdesveauxPKFX/gists{/gist_id}","starred_url":"https://api.github.com/users/tdesveauxPKFX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdesveauxPKFX/subscriptions","organizations_url":"https://api.github.com/users/tdesveauxPKFX/orgs","repos_url":"https://api.github.com/users/tdesveauxPKFX/repos","events_url":"https://api.github.com/users/tdesveauxPKFX/events{/privacy}","received_events_url":"https://api.github.com/users/tdesveauxPKFX/received_events","type":"User","site_admin":false},"repo":{"id":114768477,"node_id":"MDEwOlJlcG9zaXRvcnkxMTQ3Njg0Nzc=","name":"premake-core","full_name":"tdesveauxPKFX/premake-core","owner":{"login":"tdesveauxPKFX","id":33718714,"node_id":"MDQ6VXNlcjMzNzE4NzE0","avatar_url":"https://avatars1.githubusercontent.com/u/33718714?v=4","gravatar_id":"","url":"https://api.github.com/users/tdesveauxPKFX","html_url":"https://github.com/tdesveauxPKFX","followers_url":"https://api.github.com/users/tdesveauxPKFX/followers","following_url":"https://api.github.com/users/tdesveauxPKFX/following{/other_user}","gists_url":"https://api.github.com/users/tdesveauxPKFX/gists{/gist_id}","starred_url":"https://api.github.com/users/tdesveauxPKFX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdesveauxPKFX/subscriptions","organizations_url":"https://api.github.com/users/tdesveauxPKFX/orgs","repos_url":"https://api.github.com/users/tdesveauxPKFX/repos","events_url":"https://api.github.com/users/tdesveauxPKFX/events{/privacy}","received_events_url":"https://api.github.com/users/tdesveauxPKFX/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tdesveauxPKFX/premake-core","description":"Premake","fork":true,"url":"https://api.github.com/repos/tdesveauxPKFX/premake-core","forks_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/forks","keys_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/teams","hooks_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/hooks","issue_events_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/issues/events{/number}","events_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/events","assignees_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/assignees{/user}","branches_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/branches{/branch}","tags_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/tags","blobs_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/statuses/{sha}","languages_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/languages","stargazers_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/stargazers","contributors_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/contributors","subscribers_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/subscribers","subscription_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/subscription","commits_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/contents/{+path}","compare_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/merges","archive_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/downloads","issues_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/issues{/number}","pulls_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/pulls{/number}","milestones_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/milestones{/number}","notifications_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/labels{/name}","releases_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/releases{/id}","deployments_url":"https://api.github.com/repos/tdesveauxPKFX/premake-core/deployments","created_at":"2017-12-19T13:29:35Z","updated_at":"2017-12-19T13:29:43Z","pushed_at":"2018-07-19T20:56:09Z","git_url":"git://github.com/tdesveauxPKFX/premake-core.git","ssh_url":"git@github.com:tdesveauxPKFX/premake-core.git","clone_url":"https://github.com/tdesveauxPKFX/premake-core.git","svn_url":"https://github.com/tdesveauxPKFX/premake-core","homepage":"https://premake.github.io/","size":25708,"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,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"premake:master","ref":"master","sha":"fec912ddac933fe96a440868f5ad5f663d1052cd","user":{"login":"premake","id":11135954,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMTM1OTU0","avatar_url":"https://avatars0.githubusercontent.com/u/11135954?v=4","gravatar_id":"","url":"https://api.github.com/users/premake","html_url":"https://github.com/premake","followers_url":"https://api.github.com/users/premake/followers","following_url":"https://api.github.com/users/premake/following{/other_user}","gists_url":"https://api.github.com/users/premake/gists{/gist_id}","starred_url":"https://api.github.com/users/premake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/premake/subscriptions","organizations_url":"https://api.github.com/users/premake/orgs","repos_url":"https://api.github.com/users/premake/repos","events_url":"https://api.github.com/users/premake/events{/privacy}","received_events_url":"https://api.github.com/users/premake/received_events","type":"Organization","site_admin":false},"repo":{"id":32634405,"node_id":"MDEwOlJlcG9zaXRvcnkzMjYzNDQwNQ==","name":"premake-core","full_name":"premake/premake-core","owner":{"login":"premake","id":11135954,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMTM1OTU0","avatar_url":"https://avatars0.githubusercontent.com/u/11135954?v=4","gravatar_id":"","url":"https://api.github.com/users/premake","html_url":"https://github.com/premake","followers_url":"https://api.github.com/users/premake/followers","following_url":"https://api.github.com/users/premake/following{/other_user}","gists_url":"https://api.github.com/users/premake/gists{/gist_id}","starred_url":"https://api.github.com/users/premake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/premake/subscriptions","organizations_url":"https://api.github.com/users/premake/orgs","repos_url":"https://api.github.com/users/premake/repos","events_url":"https://api.github.com/users/premake/events{/privacy}","received_events_url":"https://api.github.com/users/premake/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/premake/premake-core","description":"Premake","fork":false,"url":"https://api.github.com/repos/premake/premake-core","forks_url":"https://api.github.com/repos/premake/premake-core/forks","keys_url":"https://api.github.com/repos/premake/premake-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/premake/premake-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/premake/premake-core/teams","hooks_url":"https://api.github.com/repos/premake/premake-core/hooks","issue_events_url":"https://api.github.com/repos/premake/premake-core/issues/events{/number}","events_url":"https://api.github.com/repos/premake/premake-core/events","assignees_url":"https://api.github.com/repos/premake/premake-core/assignees{/user}","branches_url":"https://api.github.com/repos/premake/premake-core/branches{/branch}","tags_url":"https://api.github.com/repos/premake/premake-core/tags","blobs_url":"https://api.github.com/repos/premake/premake-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/premake/premake-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/premake/premake-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/premake/premake-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/premake/premake-core/statuses/{sha}","languages_url":"https://api.github.com/repos/premake/premake-core/languages","stargazers_url":"https://api.github.com/repos/premake/premake-core/stargazers","contributors_url":"https://api.github.com/repos/premake/premake-core/contributors","subscribers_url":"https://api.github.com/repos/premake/premake-core/subscribers","subscription_url":"https://api.github.com/repos/premake/premake-core/subscription","commits_url":"https://api.github.com/repos/premake/premake-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/premake/premake-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/premake/premake-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/premake/premake-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/premake/premake-core/contents/{+path}","compare_url":"https://api.github.com/repos/premake/premake-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/premake/premake-core/merges","archive_url":"https://api.github.com/repos/premake/premake-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/premake/premake-core/downloads","issues_url":"https://api.github.com/repos/premake/premake-core/issues{/number}","pulls_url":"https://api.github.com/repos/premake/premake-core/pulls{/number}","milestones_url":"https://api.github.com/repos/premake/premake-core/milestones{/number}","notifications_url":"https://api.github.com/repos/premake/premake-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/premake/premake-core/labels{/name}","releases_url":"https://api.github.com/repos/premake/premake-core/releases{/id}","deployments_url":"https://api.github.com/repos/premake/premake-core/deployments","created_at":"2015-03-21T14:08:15Z","updated_at":"2018-08-10T05:00:19Z","pushed_at":"2018-08-10T05:00:16Z","git_url":"git://github.com/premake/premake-core.git","ssh_url":"git@github.com:premake/premake-core.git","clone_url":"https://github.com/premake/premake-core.git","svn_url":"https://github.com/premake/premake-core","homepage":"https://premake.github.io/","size":25737,"stargazers_count":957,"watchers_count":957,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":249,"mirror_url":null,"archived":false,"open_issues_count":137,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":249,"open_issues":137,"watchers":957,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/premake/premake-core/pulls/1132"},"html":{"href":"https://github.com/premake/premake-core/pull/1132"},"issue":{"href":"https://api.github.com/repos/premake/premake-core/issues/1132"},"comments":{"href":"https://api.github.com/repos/premake/premake-core/issues/1132/comments"},"review_comments":{"href":"https://api.github.com/repos/premake/premake-core/pulls/1132/comments"},"review_comment":{"href":"https://api.github.com/repos/premake/premake-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/premake/premake-core/pulls/1132/commits"},"statuses":{"href":"https://api.github.com/repos/premake/premake-core/statuses/493ac83bbc272ca9fed236e43e5bcb5782c7d8bc"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"samsinsane"}}