{"action":"created","comment":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/comments/75038571","id":75038571,"diff_hunk":"@@ -1295,26 +1295,41 @@ send_management_packet(struct sol_lwm2m_server *server,\n     return -ENOMEM;\n }\n \n-/**\n- * This checks if the path has the following form: /2/0/1\n- */\n-static bool\n-is_resource_set(const char *path)\n+enum lwm2m_path_props {\n+    PATH_IS_INVALID = (1 << 0),\n+    PATH_HAS_OBJECT =  (1 << 1),\n+    PATH_HAS_INSTANCE = (1 << 2),\n+    PATH_HAS_RESOURCE = (1 << 3)\n+};\n+\n+static enum lwm2m_path_props\n+get_path_props(const char *path)\n {\n-    size_t i;\n-    uint8_t slashes;\n-    const char *last_slash;\n+    size_t i, slashes;\n+    enum lwm2m_path_props props = PATH_IS_INVALID;\n \n     for (i = 0, slashes = 0; path[i]; i++) {\n         if (path[i] == '/') {\n-            last_slash = path + i;\n+            props =  props << 1;\n             slashes++;\n+            if (slashes > 3) {\n+                SOL_WRN(\"The path '%s' has an invalid format.\"\n+                    \" Expected: /Object/Instance/Resource\", path);\n+                return PATH_IS_INVALID;\n+            }\n+        } else if (!isdigit(path[i])) {\n+            SOL_WRN(\"The path '%s' contains a nondigit character: '%c'\",\n+                path, path[i]);\n+            return PATH_IS_INVALID;\n         }\n     }\n \n-    if (slashes < 3 || *(last_slash + 1) == '\\0')\n-        return false;\n-    return true;\n+    if (i - slashes == 0) {","path":"src/lib/comms/sol-lwm2m-server.c","position":45,"original_position":45,"commit_id":"4ee60b823320ce7791e9435ae0102acb72fd22ba","original_commit_id":"4ee60b823320ce7791e9435ae0102acb72fd22ba","user":{"login":"bsmelo","id":15204241,"avatar_url":"https://avatars.githubusercontent.com/u/15204241?v=3","gravatar_id":"","url":"https://api.github.com/users/bsmelo","html_url":"https://github.com/bsmelo","followers_url":"https://api.github.com/users/bsmelo/followers","following_url":"https://api.github.com/users/bsmelo/following{/other_user}","gists_url":"https://api.github.com/users/bsmelo/gists{/gist_id}","starred_url":"https://api.github.com/users/bsmelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsmelo/subscriptions","organizations_url":"https://api.github.com/users/bsmelo/orgs","repos_url":"https://api.github.com/users/bsmelo/repos","events_url":"https://api.github.com/users/bsmelo/events{/privacy}","received_events_url":"https://api.github.com/users/bsmelo/received_events","type":"User","site_admin":false},"body":"Since this means \"The `path` is only formed by `slashes` and has no digits\", wouldn't it be easier to read an `if (i == slashes)`?","created_at":"2016-08-16T23:17:08Z","updated_at":"2016-08-16T23:17:08Z","html_url":"https://github.com/solettaproject/soletta/pull/2290#discussion_r75038571","pull_request_url":"https://api.github.com/repos/solettaproject/soletta/pulls/2290","_links":{"self":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/comments/75038571"},"html":{"href":"https://github.com/solettaproject/soletta/pull/2290#discussion_r75038571"},"pull_request":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/2290"}}},"pull_request":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/2290","id":81527223,"html_url":"https://github.com/solettaproject/soletta/pull/2290","diff_url":"https://github.com/solettaproject/soletta/pull/2290.diff","patch_url":"https://github.com/solettaproject/soletta/pull/2290.patch","issue_url":"https://api.github.com/repos/solettaproject/soletta/issues/2290","number":2290,"state":"open","locked":false,"title":"Fixes lwm2m","user":{"login":"cabelitos","id":984610,"avatar_url":"https://avatars.githubusercontent.com/u/984610?v=3","gravatar_id":"","url":"https://api.github.com/users/cabelitos","html_url":"https://github.com/cabelitos","followers_url":"https://api.github.com/users/cabelitos/followers","following_url":"https://api.github.com/users/cabelitos/following{/other_user}","gists_url":"https://api.github.com/users/cabelitos/gists{/gist_id}","starred_url":"https://api.github.com/users/cabelitos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cabelitos/subscriptions","organizations_url":"https://api.github.com/users/cabelitos/orgs","repos_url":"https://api.github.com/users/cabelitos/repos","events_url":"https://api.github.com/users/cabelitos/events{/privacy}","received_events_url":"https://api.github.com/users/cabelitos/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-16T19:10:19Z","updated_at":"2016-08-16T23:17:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebe6311eb79d6b699296e4de06b4b1d0c413d050","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/solettaproject/soletta/pulls/2290/commits","review_comments_url":"https://api.github.com/repos/solettaproject/soletta/pulls/2290/comments","review_comment_url":"https://api.github.com/repos/solettaproject/soletta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solettaproject/soletta/issues/2290/comments","statuses_url":"https://api.github.com/repos/solettaproject/soletta/statuses/4ee60b823320ce7791e9435ae0102acb72fd22ba","head":{"label":"cabelitos:fixes-lwm2m","ref":"fixes-lwm2m","sha":"4ee60b823320ce7791e9435ae0102acb72fd22ba","user":{"login":"cabelitos","id":984610,"avatar_url":"https://avatars.githubusercontent.com/u/984610?v=3","gravatar_id":"","url":"https://api.github.com/users/cabelitos","html_url":"https://github.com/cabelitos","followers_url":"https://api.github.com/users/cabelitos/followers","following_url":"https://api.github.com/users/cabelitos/following{/other_user}","gists_url":"https://api.github.com/users/cabelitos/gists{/gist_id}","starred_url":"https://api.github.com/users/cabelitos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cabelitos/subscriptions","organizations_url":"https://api.github.com/users/cabelitos/orgs","repos_url":"https://api.github.com/users/cabelitos/repos","events_url":"https://api.github.com/users/cabelitos/events{/privacy}","received_events_url":"https://api.github.com/users/cabelitos/received_events","type":"User","site_admin":false},"repo":{"id":37933311,"name":"soletta","full_name":"cabelitos/soletta","owner":{"login":"cabelitos","id":984610,"avatar_url":"https://avatars.githubusercontent.com/u/984610?v=3","gravatar_id":"","url":"https://api.github.com/users/cabelitos","html_url":"https://github.com/cabelitos","followers_url":"https://api.github.com/users/cabelitos/followers","following_url":"https://api.github.com/users/cabelitos/following{/other_user}","gists_url":"https://api.github.com/users/cabelitos/gists{/gist_id}","starred_url":"https://api.github.com/users/cabelitos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cabelitos/subscriptions","organizations_url":"https://api.github.com/users/cabelitos/orgs","repos_url":"https://api.github.com/users/cabelitos/repos","events_url":"https://api.github.com/users/cabelitos/events{/privacy}","received_events_url":"https://api.github.com/users/cabelitos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cabelitos/soletta","description":"Soletta Project is a framework for making IoT devices.  With Soletta Project's libraries developers can easily write software for devices that control actuators/sensors and communicate using standard technologies. It enables adding smartness even on the smallest edge devices.  ","fork":true,"url":"https://api.github.com/repos/cabelitos/soletta","forks_url":"https://api.github.com/repos/cabelitos/soletta/forks","keys_url":"https://api.github.com/repos/cabelitos/soletta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cabelitos/soletta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cabelitos/soletta/teams","hooks_url":"https://api.github.com/repos/cabelitos/soletta/hooks","issue_events_url":"https://api.github.com/repos/cabelitos/soletta/issues/events{/number}","events_url":"https://api.github.com/repos/cabelitos/soletta/events","assignees_url":"https://api.github.com/repos/cabelitos/soletta/assignees{/user}","branches_url":"https://api.github.com/repos/cabelitos/soletta/branches{/branch}","tags_url":"https://api.github.com/repos/cabelitos/soletta/tags","blobs_url":"https://api.github.com/repos/cabelitos/soletta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cabelitos/soletta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cabelitos/soletta/git/refs{/sha}","trees_url":"https://api.github.com/repos/cabelitos/soletta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cabelitos/soletta/statuses/{sha}","languages_url":"https://api.github.com/repos/cabelitos/soletta/languages","stargazers_url":"https://api.github.com/repos/cabelitos/soletta/stargazers","contributors_url":"https://api.github.com/repos/cabelitos/soletta/contributors","subscribers_url":"https://api.github.com/repos/cabelitos/soletta/subscribers","subscription_url":"https://api.github.com/repos/cabelitos/soletta/subscription","commits_url":"https://api.github.com/repos/cabelitos/soletta/commits{/sha}","git_commits_url":"https://api.github.com/repos/cabelitos/soletta/git/commits{/sha}","comments_url":"https://api.github.com/repos/cabelitos/soletta/comments{/number}","issue_comment_url":"https://api.github.com/repos/cabelitos/soletta/issues/comments{/number}","contents_url":"https://api.github.com/repos/cabelitos/soletta/contents/{+path}","compare_url":"https://api.github.com/repos/cabelitos/soletta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cabelitos/soletta/merges","archive_url":"https://api.github.com/repos/cabelitos/soletta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cabelitos/soletta/downloads","issues_url":"https://api.github.com/repos/cabelitos/soletta/issues{/number}","pulls_url":"https://api.github.com/repos/cabelitos/soletta/pulls{/number}","milestones_url":"https://api.github.com/repos/cabelitos/soletta/milestones{/number}","notifications_url":"https://api.github.com/repos/cabelitos/soletta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cabelitos/soletta/labels{/name}","releases_url":"https://api.github.com/repos/cabelitos/soletta/releases{/id}","deployments_url":"https://api.github.com/repos/cabelitos/soletta/deployments","created_at":"2015-06-23T17:19:15Z","updated_at":"2016-02-02T19:26:17Z","pushed_at":"2016-08-16T20:30:51Z","git_url":"git://github.com/cabelitos/soletta.git","ssh_url":"git@github.com:cabelitos/soletta.git","clone_url":"https://github.com/cabelitos/soletta.git","svn_url":"https://github.com/cabelitos/soletta","homepage":"","size":22541,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"solettaproject:master","ref":"master","sha":"f1959fd33190f31599c87a21b0ef5e88ee5cc425","user":{"login":"solettaproject","id":12736897,"avatar_url":"https://avatars.githubusercontent.com/u/12736897?v=3","gravatar_id":"","url":"https://api.github.com/users/solettaproject","html_url":"https://github.com/solettaproject","followers_url":"https://api.github.com/users/solettaproject/followers","following_url":"https://api.github.com/users/solettaproject/following{/other_user}","gists_url":"https://api.github.com/users/solettaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/solettaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solettaproject/subscriptions","organizations_url":"https://api.github.com/users/solettaproject/orgs","repos_url":"https://api.github.com/users/solettaproject/repos","events_url":"https://api.github.com/users/solettaproject/events{/privacy}","received_events_url":"https://api.github.com/users/solettaproject/received_events","type":"Organization","site_admin":false},"repo":{"id":37087063,"name":"soletta","full_name":"solettaproject/soletta","owner":{"login":"solettaproject","id":12736897,"avatar_url":"https://avatars.githubusercontent.com/u/12736897?v=3","gravatar_id":"","url":"https://api.github.com/users/solettaproject","html_url":"https://github.com/solettaproject","followers_url":"https://api.github.com/users/solettaproject/followers","following_url":"https://api.github.com/users/solettaproject/following{/other_user}","gists_url":"https://api.github.com/users/solettaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/solettaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solettaproject/subscriptions","organizations_url":"https://api.github.com/users/solettaproject/orgs","repos_url":"https://api.github.com/users/solettaproject/repos","events_url":"https://api.github.com/users/solettaproject/events{/privacy}","received_events_url":"https://api.github.com/users/solettaproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solettaproject/soletta","description":"Soletta Project is a framework for making IoT devices.  With Soletta Project's libraries developers can easily write software for devices that control actuators/sensors and communicate using standard technologies. It enables adding smartness even on the smallest edge devices.  ","fork":false,"url":"https://api.github.com/repos/solettaproject/soletta","forks_url":"https://api.github.com/repos/solettaproject/soletta/forks","keys_url":"https://api.github.com/repos/solettaproject/soletta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solettaproject/soletta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solettaproject/soletta/teams","hooks_url":"https://api.github.com/repos/solettaproject/soletta/hooks","issue_events_url":"https://api.github.com/repos/solettaproject/soletta/issues/events{/number}","events_url":"https://api.github.com/repos/solettaproject/soletta/events","assignees_url":"https://api.github.com/repos/solettaproject/soletta/assignees{/user}","branches_url":"https://api.github.com/repos/solettaproject/soletta/branches{/branch}","tags_url":"https://api.github.com/repos/solettaproject/soletta/tags","blobs_url":"https://api.github.com/repos/solettaproject/soletta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solettaproject/soletta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solettaproject/soletta/git/refs{/sha}","trees_url":"https://api.github.com/repos/solettaproject/soletta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solettaproject/soletta/statuses/{sha}","languages_url":"https://api.github.com/repos/solettaproject/soletta/languages","stargazers_url":"https://api.github.com/repos/solettaproject/soletta/stargazers","contributors_url":"https://api.github.com/repos/solettaproject/soletta/contributors","subscribers_url":"https://api.github.com/repos/solettaproject/soletta/subscribers","subscription_url":"https://api.github.com/repos/solettaproject/soletta/subscription","commits_url":"https://api.github.com/repos/solettaproject/soletta/commits{/sha}","git_commits_url":"https://api.github.com/repos/solettaproject/soletta/git/commits{/sha}","comments_url":"https://api.github.com/repos/solettaproject/soletta/comments{/number}","issue_comment_url":"https://api.github.com/repos/solettaproject/soletta/issues/comments{/number}","contents_url":"https://api.github.com/repos/solettaproject/soletta/contents/{+path}","compare_url":"https://api.github.com/repos/solettaproject/soletta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solettaproject/soletta/merges","archive_url":"https://api.github.com/repos/solettaproject/soletta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solettaproject/soletta/downloads","issues_url":"https://api.github.com/repos/solettaproject/soletta/issues{/number}","pulls_url":"https://api.github.com/repos/solettaproject/soletta/pulls{/number}","milestones_url":"https://api.github.com/repos/solettaproject/soletta/milestones{/number}","notifications_url":"https://api.github.com/repos/solettaproject/soletta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solettaproject/soletta/labels{/name}","releases_url":"https://api.github.com/repos/solettaproject/soletta/releases{/id}","deployments_url":"https://api.github.com/repos/solettaproject/soletta/deployments","created_at":"2015-06-08T19:13:18Z","updated_at":"2016-08-11T12:40:07Z","pushed_at":"2016-08-16T20:30:52Z","git_url":"git://github.com/solettaproject/soletta.git","ssh_url":"git@github.com:solettaproject/soletta.git","clone_url":"https://github.com/solettaproject/soletta.git","svn_url":"https://github.com/solettaproject/soletta","homepage":"http://solettaproject.org","size":31057,"stargazers_count":119,"watchers_count":119,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":92,"mirror_url":null,"open_issues_count":107,"forks":92,"open_issues":107,"watchers":119,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/2290"},"html":{"href":"https://github.com/solettaproject/soletta/pull/2290"},"issue":{"href":"https://api.github.com/repos/solettaproject/soletta/issues/2290"},"comments":{"href":"https://api.github.com/repos/solettaproject/soletta/issues/2290/comments"},"review_comments":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/2290/comments"},"review_comment":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/2290/commits"},"statuses":{"href":"https://api.github.com/repos/solettaproject/soletta/statuses/4ee60b823320ce7791e9435ae0102acb72fd22ba"}}}}
{"actor":{"display_login":"bsmelo"}}