{"action":"created","comment":{"url":"https://api.github.com/repos/andy64734/DAC/pulls/comments/176823472","pull_request_review_id":106599841,"id":176823472,"diff_hunk":"@@ -5,61 +5,66 @@\n  *      Author: sharana\n  *      Description: Program to initiate a ring buffer.\n  */\n-#include\"ringbuffer.h\"\n-#include<inttypes.h>\n+#include \"ringbuffer.h\"\n+#include <inttypes.h>\n+#include <stdbool.h>\n /*\n  * Here we have a method put characters into the buffer.\n  * @param buffer it is a structure type to access the correct ring buffer.\n  * @param element it is the character.\n  */\n-void put(RingBuffer* buffer, char element){\n+bool put(RingBuffer* buffer, char element)\n+{\n \t//Check space\n-\t if(hasSpace(&buffer)== 1)\n-\t    {\t//adding element to the buffer\n-\t        buffer->buffer[buffer->put] = element;\n-\t        buffer->put = (buffer->put + 1) % BUF_SIZE;\n-\t    }else{\n-\t    \t//it it is at the get\n-\t            buffer->get = (buffer->get + 1) % BUF_SIZE;\n-\t            buffer->buffer[buffer->get] = element;\n-\n-\t        }\n-\t    }\n+\t if(hasSpace(&buffer) != 0)\n+\t {\t//adding element to the buffer\n+\t        buffer->buffer[buffer->tail] = element;\n+\t        buffer->tail = (buffer->tail + 1) % BUF_SIZE;\n+\t        return true;\n+\t }else{\n+\t\t // drop the pact\n+\t\t \treturn false;\n+\t      }\n+}\n /*\n  * Here we have a method to get and remove characters into the buffer.\n  * @param buffer it is a structure type to access the correct ring buffer.\n  */\n-char get(RingBuffer* buffer){\n+char get(RingBuffer* buffer)\n+{\n \t//check space\n-\tif(hasElement(&buffer)== 1){\n-\t\t//get character from the  buffer\n-\tchar element = buffer->buffer[buffer->get];\n-\t//adjusting get\n-\tbuffer->get = (buffer->get+1) % BUF_SIZE;\n-\treturn element;\n-\n+\tif(hasElement(&buffer) != 0)\n+\t{\t//get character from the  buffer\n+\t\t\tchar element = buffer->buffer[buffer->tail];\n+\t\t//adjusting get\n+\t\t\tbuffer->tail = (buffer->tail+1) % BUF_SIZE;\n+\t\t\treturn element;\n \t}\n+\n }\n /*\n  * Returns true (non-zero) if there is room for one element in buffer\n  * @param buffer it is a structure type to access the correct ring buffer.\n  */\n-int hasSpace(RingBuffer * buffer){\n-\tif((((buffer->put + 1) % BUF_SIZE)) == buffer->get){\n+int hasSpace(RingBuffer* buffer)\n+{\n+\tif((((buffer->tail + 1) % BUF_SIZE)) == buffer->head)\n+\t{\n \t\treturn 0;\n \t}else{\n \t\treturn 1;\n-\t}\n+\t\t }\n }\n \n /*\n  * return true (non-zero) if there is at least one element in buffer\n  * @param buffer it is a structure type to access the correct ring buffer.\n  */\n int hasElement(RingBuffer * buffer){\n-\tif(buffer->get==buffer->put){\n-\t\t\treturn 0;\n-\t\t}else{\n-\t\t\treturn 1;\n-\t\t}\n+\tif(buffer->head==buffer->tail)\n+\t{\n+\t\treturn 0;\n+\t}else{","path":"DAC/src/ringbuffer.c","position":null,"original_position":93,"commit_id":"0c77e1a456add8a7125219ab0e417ae569d12e77","original_commit_id":"0c77e1a456add8a7125219ab0e417ae569d12e77","user":{"login":"andy64734","id":22990652,"avatar_url":"https://avatars2.githubusercontent.com/u/22990652?v=4","gravatar_id":"","url":"https://api.github.com/users/andy64734","html_url":"https://github.com/andy64734","followers_url":"https://api.github.com/users/andy64734/followers","following_url":"https://api.github.com/users/andy64734/following{/other_user}","gists_url":"https://api.github.com/users/andy64734/gists{/gist_id}","starred_url":"https://api.github.com/users/andy64734/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy64734/subscriptions","organizations_url":"https://api.github.com/users/andy64734/orgs","repos_url":"https://api.github.com/users/andy64734/repos","events_url":"https://api.github.com/users/andy64734/events{/privacy}","received_events_url":"https://api.github.com/users/andy64734/received_events","type":"User","site_admin":false},"body":"My spacing method uses new lines for each curly bracket, and the word else.\r\n```c\r\n}\r\nelse\r\n{\r\n```\r\nand not\r\n```c\r\n}else{\r\n```","created_at":"2018-03-23T18:16:23Z","updated_at":"2018-03-23T18:21:13Z","html_url":"https://github.com/andy64734/DAC/pull/1#discussion_r176823472","pull_request_url":"https://api.github.com/repos/andy64734/DAC/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/andy64734/DAC/pulls/comments/176823472"},"html":{"href":"https://github.com/andy64734/DAC/pull/1#discussion_r176823472"},"pull_request":{"href":"https://api.github.com/repos/andy64734/DAC/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/andy64734/DAC/pulls/1","id":175607990,"html_url":"https://github.com/andy64734/DAC/pull/1","diff_url":"https://github.com/andy64734/DAC/pull/1.diff","patch_url":"https://github.com/andy64734/DAC/pull/1.patch","issue_url":"https://api.github.com/repos/andy64734/DAC/issues/1","number":1,"state":"open","locked":false,"title":"RingBuffer_Ashwin_imp Mod","user":{"login":"Sharana1","id":31698862,"avatar_url":"https://avatars3.githubusercontent.com/u/31698862?v=4","gravatar_id":"","url":"https://api.github.com/users/Sharana1","html_url":"https://github.com/Sharana1","followers_url":"https://api.github.com/users/Sharana1/followers","following_url":"https://api.github.com/users/Sharana1/following{/other_user}","gists_url":"https://api.github.com/users/Sharana1/gists{/gist_id}","starred_url":"https://api.github.com/users/Sharana1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sharana1/subscriptions","organizations_url":"https://api.github.com/users/Sharana1/orgs","repos_url":"https://api.github.com/users/Sharana1/repos","events_url":"https://api.github.com/users/Sharana1/events{/privacy}","received_events_url":"https://api.github.com/users/Sharana1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-16T18:07:41Z","updated_at":"2018-03-23T18:21:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae2295b00f9d24251de6f97b5b0253ad95c0d047","assignee":{"login":"Sharana1","id":31698862,"avatar_url":"https://avatars3.githubusercontent.com/u/31698862?v=4","gravatar_id":"","url":"https://api.github.com/users/Sharana1","html_url":"https://github.com/Sharana1","followers_url":"https://api.github.com/users/Sharana1/followers","following_url":"https://api.github.com/users/Sharana1/following{/other_user}","gists_url":"https://api.github.com/users/Sharana1/gists{/gist_id}","starred_url":"https://api.github.com/users/Sharana1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sharana1/subscriptions","organizations_url":"https://api.github.com/users/Sharana1/orgs","repos_url":"https://api.github.com/users/Sharana1/repos","events_url":"https://api.github.com/users/Sharana1/events{/privacy}","received_events_url":"https://api.github.com/users/Sharana1/received_events","type":"User","site_admin":false},"assignees":[{"login":"Sharana1","id":31698862,"avatar_url":"https://avatars3.githubusercontent.com/u/31698862?v=4","gravatar_id":"","url":"https://api.github.com/users/Sharana1","html_url":"https://github.com/Sharana1","followers_url":"https://api.github.com/users/Sharana1/followers","following_url":"https://api.github.com/users/Sharana1/following{/other_user}","gists_url":"https://api.github.com/users/Sharana1/gists{/gist_id}","starred_url":"https://api.github.com/users/Sharana1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sharana1/subscriptions","organizations_url":"https://api.github.com/users/Sharana1/orgs","repos_url":"https://api.github.com/users/Sharana1/repos","events_url":"https://api.github.com/users/Sharana1/events{/privacy}","received_events_url":"https://api.github.com/users/Sharana1/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andy64734/DAC/pulls/1/commits","review_comments_url":"https://api.github.com/repos/andy64734/DAC/pulls/1/comments","review_comment_url":"https://api.github.com/repos/andy64734/DAC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andy64734/DAC/issues/1/comments","statuses_url":"https://api.github.com/repos/andy64734/DAC/statuses/0c77e1a456add8a7125219ab0e417ae569d12e77","head":{"label":"andy64734:sharana","ref":"sharana","sha":"0c77e1a456add8a7125219ab0e417ae569d12e77","user":{"login":"andy64734","id":22990652,"avatar_url":"https://avatars2.githubusercontent.com/u/22990652?v=4","gravatar_id":"","url":"https://api.github.com/users/andy64734","html_url":"https://github.com/andy64734","followers_url":"https://api.github.com/users/andy64734/followers","following_url":"https://api.github.com/users/andy64734/following{/other_user}","gists_url":"https://api.github.com/users/andy64734/gists{/gist_id}","starred_url":"https://api.github.com/users/andy64734/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy64734/subscriptions","organizations_url":"https://api.github.com/users/andy64734/orgs","repos_url":"https://api.github.com/users/andy64734/repos","events_url":"https://api.github.com/users/andy64734/events{/privacy}","received_events_url":"https://api.github.com/users/andy64734/received_events","type":"User","site_admin":false},"repo":{"id":123609580,"name":"DAC","full_name":"andy64734/DAC","owner":{"login":"andy64734","id":22990652,"avatar_url":"https://avatars2.githubusercontent.com/u/22990652?v=4","gravatar_id":"","url":"https://api.github.com/users/andy64734","html_url":"https://github.com/andy64734","followers_url":"https://api.github.com/users/andy64734/followers","following_url":"https://api.github.com/users/andy64734/following{/other_user}","gists_url":"https://api.github.com/users/andy64734/gists{/gist_id}","starred_url":"https://api.github.com/users/andy64734/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy64734/subscriptions","organizations_url":"https://api.github.com/users/andy64734/orgs","repos_url":"https://api.github.com/users/andy64734/repos","events_url":"https://api.github.com/users/andy64734/events{/privacy}","received_events_url":"https://api.github.com/users/andy64734/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andy64734/DAC","description":null,"fork":false,"url":"https://api.github.com/repos/andy64734/DAC","forks_url":"https://api.github.com/repos/andy64734/DAC/forks","keys_url":"https://api.github.com/repos/andy64734/DAC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andy64734/DAC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andy64734/DAC/teams","hooks_url":"https://api.github.com/repos/andy64734/DAC/hooks","issue_events_url":"https://api.github.com/repos/andy64734/DAC/issues/events{/number}","events_url":"https://api.github.com/repos/andy64734/DAC/events","assignees_url":"https://api.github.com/repos/andy64734/DAC/assignees{/user}","branches_url":"https://api.github.com/repos/andy64734/DAC/branches{/branch}","tags_url":"https://api.github.com/repos/andy64734/DAC/tags","blobs_url":"https://api.github.com/repos/andy64734/DAC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andy64734/DAC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andy64734/DAC/git/refs{/sha}","trees_url":"https://api.github.com/repos/andy64734/DAC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andy64734/DAC/statuses/{sha}","languages_url":"https://api.github.com/repos/andy64734/DAC/languages","stargazers_url":"https://api.github.com/repos/andy64734/DAC/stargazers","contributors_url":"https://api.github.com/repos/andy64734/DAC/contributors","subscribers_url":"https://api.github.com/repos/andy64734/DAC/subscribers","subscription_url":"https://api.github.com/repos/andy64734/DAC/subscription","commits_url":"https://api.github.com/repos/andy64734/DAC/commits{/sha}","git_commits_url":"https://api.github.com/repos/andy64734/DAC/git/commits{/sha}","comments_url":"https://api.github.com/repos/andy64734/DAC/comments{/number}","issue_comment_url":"https://api.github.com/repos/andy64734/DAC/issues/comments{/number}","contents_url":"https://api.github.com/repos/andy64734/DAC/contents/{+path}","compare_url":"https://api.github.com/repos/andy64734/DAC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andy64734/DAC/merges","archive_url":"https://api.github.com/repos/andy64734/DAC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andy64734/DAC/downloads","issues_url":"https://api.github.com/repos/andy64734/DAC/issues{/number}","pulls_url":"https://api.github.com/repos/andy64734/DAC/pulls{/number}","milestones_url":"https://api.github.com/repos/andy64734/DAC/milestones{/number}","notifications_url":"https://api.github.com/repos/andy64734/DAC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andy64734/DAC/labels{/name}","releases_url":"https://api.github.com/repos/andy64734/DAC/releases{/id}","deployments_url":"https://api.github.com/repos/andy64734/DAC/deployments","created_at":"2018-03-02T17:29:59Z","updated_at":"2018-03-02T17:35:29Z","pushed_at":"2018-03-23T18:12:18Z","git_url":"git://github.com/andy64734/DAC.git","ssh_url":"git@github.com:andy64734/DAC.git","clone_url":"https://github.com/andy64734/DAC.git","svn_url":"https://github.com/andy64734/DAC","homepage":null,"size":44504,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"andy64734:master","ref":"master","sha":"4ace0f27d075dac2ff156908a1c849b357578758","user":{"login":"andy64734","id":22990652,"avatar_url":"https://avatars2.githubusercontent.com/u/22990652?v=4","gravatar_id":"","url":"https://api.github.com/users/andy64734","html_url":"https://github.com/andy64734","followers_url":"https://api.github.com/users/andy64734/followers","following_url":"https://api.github.com/users/andy64734/following{/other_user}","gists_url":"https://api.github.com/users/andy64734/gists{/gist_id}","starred_url":"https://api.github.com/users/andy64734/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy64734/subscriptions","organizations_url":"https://api.github.com/users/andy64734/orgs","repos_url":"https://api.github.com/users/andy64734/repos","events_url":"https://api.github.com/users/andy64734/events{/privacy}","received_events_url":"https://api.github.com/users/andy64734/received_events","type":"User","site_admin":false},"repo":{"id":123609580,"name":"DAC","full_name":"andy64734/DAC","owner":{"login":"andy64734","id":22990652,"avatar_url":"https://avatars2.githubusercontent.com/u/22990652?v=4","gravatar_id":"","url":"https://api.github.com/users/andy64734","html_url":"https://github.com/andy64734","followers_url":"https://api.github.com/users/andy64734/followers","following_url":"https://api.github.com/users/andy64734/following{/other_user}","gists_url":"https://api.github.com/users/andy64734/gists{/gist_id}","starred_url":"https://api.github.com/users/andy64734/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy64734/subscriptions","organizations_url":"https://api.github.com/users/andy64734/orgs","repos_url":"https://api.github.com/users/andy64734/repos","events_url":"https://api.github.com/users/andy64734/events{/privacy}","received_events_url":"https://api.github.com/users/andy64734/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andy64734/DAC","description":null,"fork":false,"url":"https://api.github.com/repos/andy64734/DAC","forks_url":"https://api.github.com/repos/andy64734/DAC/forks","keys_url":"https://api.github.com/repos/andy64734/DAC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andy64734/DAC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andy64734/DAC/teams","hooks_url":"https://api.github.com/repos/andy64734/DAC/hooks","issue_events_url":"https://api.github.com/repos/andy64734/DAC/issues/events{/number}","events_url":"https://api.github.com/repos/andy64734/DAC/events","assignees_url":"https://api.github.com/repos/andy64734/DAC/assignees{/user}","branches_url":"https://api.github.com/repos/andy64734/DAC/branches{/branch}","tags_url":"https://api.github.com/repos/andy64734/DAC/tags","blobs_url":"https://api.github.com/repos/andy64734/DAC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andy64734/DAC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andy64734/DAC/git/refs{/sha}","trees_url":"https://api.github.com/repos/andy64734/DAC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andy64734/DAC/statuses/{sha}","languages_url":"https://api.github.com/repos/andy64734/DAC/languages","stargazers_url":"https://api.github.com/repos/andy64734/DAC/stargazers","contributors_url":"https://api.github.com/repos/andy64734/DAC/contributors","subscribers_url":"https://api.github.com/repos/andy64734/DAC/subscribers","subscription_url":"https://api.github.com/repos/andy64734/DAC/subscription","commits_url":"https://api.github.com/repos/andy64734/DAC/commits{/sha}","git_commits_url":"https://api.github.com/repos/andy64734/DAC/git/commits{/sha}","comments_url":"https://api.github.com/repos/andy64734/DAC/comments{/number}","issue_comment_url":"https://api.github.com/repos/andy64734/DAC/issues/comments{/number}","contents_url":"https://api.github.com/repos/andy64734/DAC/contents/{+path}","compare_url":"https://api.github.com/repos/andy64734/DAC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andy64734/DAC/merges","archive_url":"https://api.github.com/repos/andy64734/DAC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andy64734/DAC/downloads","issues_url":"https://api.github.com/repos/andy64734/DAC/issues{/number}","pulls_url":"https://api.github.com/repos/andy64734/DAC/pulls{/number}","milestones_url":"https://api.github.com/repos/andy64734/DAC/milestones{/number}","notifications_url":"https://api.github.com/repos/andy64734/DAC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andy64734/DAC/labels{/name}","releases_url":"https://api.github.com/repos/andy64734/DAC/releases{/id}","deployments_url":"https://api.github.com/repos/andy64734/DAC/deployments","created_at":"2018-03-02T17:29:59Z","updated_at":"2018-03-02T17:35:29Z","pushed_at":"2018-03-23T18:12:18Z","git_url":"git://github.com/andy64734/DAC.git","ssh_url":"git@github.com:andy64734/DAC.git","clone_url":"https://github.com/andy64734/DAC.git","svn_url":"https://github.com/andy64734/DAC","homepage":null,"size":44504,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/andy64734/DAC/pulls/1"},"html":{"href":"https://github.com/andy64734/DAC/pull/1"},"issue":{"href":"https://api.github.com/repos/andy64734/DAC/issues/1"},"comments":{"href":"https://api.github.com/repos/andy64734/DAC/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/andy64734/DAC/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/andy64734/DAC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andy64734/DAC/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/andy64734/DAC/statuses/0c77e1a456add8a7125219ab0e417ae569d12e77"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"andy64734"}}