{"action":"created","comment":{"url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/comments/41859474","id":41859474,"diff_hunk":"@@ -82,38 +84,43 @@ lua_mongo_collection_count (lua_State *L)\n     bson_error_t error;\n     bool throw_error = false;\n \n-    collection = (collection_t *)luaL_checkudata(L, 1, \"lua_mongoc_collection\");\n+    int query_index = 2;\n+    int skip_index = 3;\n+    int limit_index = 4;\n+\n \n-    if (!(lua_isnil(L, 2))) {\n-        if (!(lua_table_to_bson(L, &query, 2, false, &error))) {\n-            throw_error = true;\n+    collection = (collection_t *) luaL_checkudata(L, 1, \"lua_mongoc_collection\");\n+\n+    if (!(lua_isnil(L, query_index))) {\n+        throw_error = !(lua_table_to_bson(L, &query, query_index, false, &error));\n+        if (throw_error) {\n             goto DONE;\n         }\n     }\n \n-    if (!(lua_isnumber(L, 3))) {\n-        throw_error = true;\n-        strncpy (error.message, \"skip parameter must be a number\", sizeof (error.message));\n+    throw_error = !(lua_isnumber(L, skip_index));\n+    if (throw_error) {\n+        strncpy (error.message, \"skip parameter must be a number\", sizeof(error.message));\n         goto DONE;\n     }\n \n-    if (!(lua_isnumber(L, 4))) {\n+    if (!(lua_isnumber(L, limit_index))) {\n         luaL_error(L, \"limit parameter must be a number\");\n     }\n \n-    skip = lua_tonumber(L, 3);\n-    limit = lua_tonumber(L, 4);\n+    skip = lua_tonumber(L, skip_index);\n+    limit = lua_tonumber(L, limit_index);\n \n-    count = mongoc_collection_count (collection->c_collection,\n-                                     MONGOC_QUERY_NONE, &query,\n-                                     skip, limit, NULL, &error);\n+    count = mongoc_collection_count(collection->c_collection,\n+                                    MONGOC_QUERY_NONE, &query,\n+                                    skip, limit, NULL, &error);\n \n     if (count < 0) {\n         throw_error = true;\n         goto DONE;\n     }\n \n-DONE:\n+    DONE:","path":"c_wrapper/lua-mongoc-collection.c","position":108,"original_position":108,"commit_id":"07fbf5898d7bd6b2dc5cbcbc32029c6d9d5bbf92","original_commit_id":"07fbf5898d7bd6b2dc5cbcbc32029c6d9d5bbf92","user":{"login":"ajdavis","id":84101,"avatar_url":"https://avatars.githubusercontent.com/u/84101?v=3","gravatar_id":"","url":"https://api.github.com/users/ajdavis","html_url":"https://github.com/ajdavis","followers_url":"https://api.github.com/users/ajdavis/followers","following_url":"https://api.github.com/users/ajdavis/following{/other_user}","gists_url":"https://api.github.com/users/ajdavis/gists{/gist_id}","starred_url":"https://api.github.com/users/ajdavis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajdavis/subscriptions","organizations_url":"https://api.github.com/users/ajdavis/orgs","repos_url":"https://api.github.com/users/ajdavis/repos","events_url":"https://api.github.com/users/ajdavis/events{/privacy}","received_events_url":"https://api.github.com/users/ajdavis/received_events","type":"User","site_admin":false},"body":"Sigh: https://youtrack.jetbrains.com/issue/CPP-204","created_at":"2015-10-13T12:34:09Z","updated_at":"2015-10-13T12:34:09Z","html_url":"https://github.com/mongodb-labs/mongorover/pull/26#discussion_r41859474","pull_request_url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26","_links":{"self":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/comments/41859474"},"html":{"href":"https://github.com/mongodb-labs/mongorover/pull/26#discussion_r41859474"},"pull_request":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26"}}},"pull_request":{"url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26","id":47488607,"html_url":"https://github.com/mongodb-labs/mongorover/pull/26","diff_url":"https://github.com/mongodb-labs/mongorover/pull/26.diff","patch_url":"https://github.com/mongodb-labs/mongorover/pull/26.patch","issue_url":"https://api.github.com/repos/mongodb-labs/mongorover/issues/26","number":26,"state":"open","locked":false,"title":"made index variables in the c layer for better readability, code re…","user":{"login":"christopherjwang","id":4838266,"avatar_url":"https://avatars.githubusercontent.com/u/4838266?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherjwang","html_url":"https://github.com/christopherjwang","followers_url":"https://api.github.com/users/christopherjwang/followers","following_url":"https://api.github.com/users/christopherjwang/following{/other_user}","gists_url":"https://api.github.com/users/christopherjwang/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherjwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherjwang/subscriptions","organizations_url":"https://api.github.com/users/christopherjwang/orgs","repos_url":"https://api.github.com/users/christopherjwang/repos","events_url":"https://api.github.com/users/christopherjwang/events{/privacy}","received_events_url":"https://api.github.com/users/christopherjwang/received_events","type":"User","site_admin":false},"body":"…formatted in c layer as well, throw_error code style consistency","created_at":"2015-10-13T03:52:54Z","updated_at":"2015-10-13T12:34:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52479e0b4103a8449b0695c1ca0846fa4127bcb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26/commits","review_comments_url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26/comments","review_comment_url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mongodb-labs/mongorover/issues/26/comments","statuses_url":"https://api.github.com/repos/mongodb-labs/mongorover/statuses/07fbf5898d7bd6b2dc5cbcbc32029c6d9d5bbf92","head":{"label":"christopherjwang:code_reformat","ref":"code_reformat","sha":"07fbf5898d7bd6b2dc5cbcbc32029c6d9d5bbf92","user":{"login":"christopherjwang","id":4838266,"avatar_url":"https://avatars.githubusercontent.com/u/4838266?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherjwang","html_url":"https://github.com/christopherjwang","followers_url":"https://api.github.com/users/christopherjwang/followers","following_url":"https://api.github.com/users/christopherjwang/following{/other_user}","gists_url":"https://api.github.com/users/christopherjwang/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherjwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherjwang/subscriptions","organizations_url":"https://api.github.com/users/christopherjwang/orgs","repos_url":"https://api.github.com/users/christopherjwang/repos","events_url":"https://api.github.com/users/christopherjwang/events{/privacy}","received_events_url":"https://api.github.com/users/christopherjwang/received_events","type":"User","site_admin":false},"repo":{"id":39034541,"name":"mongorover","full_name":"christopherjwang/mongorover","owner":{"login":"christopherjwang","id":4838266,"avatar_url":"https://avatars.githubusercontent.com/u/4838266?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherjwang","html_url":"https://github.com/christopherjwang","followers_url":"https://api.github.com/users/christopherjwang/followers","following_url":"https://api.github.com/users/christopherjwang/following{/other_user}","gists_url":"https://api.github.com/users/christopherjwang/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherjwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherjwang/subscriptions","organizations_url":"https://api.github.com/users/christopherjwang/orgs","repos_url":"https://api.github.com/users/christopherjwang/repos","events_url":"https://api.github.com/users/christopherjwang/events{/privacy}","received_events_url":"https://api.github.com/users/christopherjwang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christopherjwang/mongorover","description":" Intern project - Mongo driver for the Lua programming language","fork":true,"url":"https://api.github.com/repos/christopherjwang/mongorover","forks_url":"https://api.github.com/repos/christopherjwang/mongorover/forks","keys_url":"https://api.github.com/repos/christopherjwang/mongorover/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christopherjwang/mongorover/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christopherjwang/mongorover/teams","hooks_url":"https://api.github.com/repos/christopherjwang/mongorover/hooks","issue_events_url":"https://api.github.com/repos/christopherjwang/mongorover/issues/events{/number}","events_url":"https://api.github.com/repos/christopherjwang/mongorover/events","assignees_url":"https://api.github.com/repos/christopherjwang/mongorover/assignees{/user}","branches_url":"https://api.github.com/repos/christopherjwang/mongorover/branches{/branch}","tags_url":"https://api.github.com/repos/christopherjwang/mongorover/tags","blobs_url":"https://api.github.com/repos/christopherjwang/mongorover/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christopherjwang/mongorover/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christopherjwang/mongorover/git/refs{/sha}","trees_url":"https://api.github.com/repos/christopherjwang/mongorover/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christopherjwang/mongorover/statuses/{sha}","languages_url":"https://api.github.com/repos/christopherjwang/mongorover/languages","stargazers_url":"https://api.github.com/repos/christopherjwang/mongorover/stargazers","contributors_url":"https://api.github.com/repos/christopherjwang/mongorover/contributors","subscribers_url":"https://api.github.com/repos/christopherjwang/mongorover/subscribers","subscription_url":"https://api.github.com/repos/christopherjwang/mongorover/subscription","commits_url":"https://api.github.com/repos/christopherjwang/mongorover/commits{/sha}","git_commits_url":"https://api.github.com/repos/christopherjwang/mongorover/git/commits{/sha}","comments_url":"https://api.github.com/repos/christopherjwang/mongorover/comments{/number}","issue_comment_url":"https://api.github.com/repos/christopherjwang/mongorover/issues/comments{/number}","contents_url":"https://api.github.com/repos/christopherjwang/mongorover/contents/{+path}","compare_url":"https://api.github.com/repos/christopherjwang/mongorover/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christopherjwang/mongorover/merges","archive_url":"https://api.github.com/repos/christopherjwang/mongorover/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christopherjwang/mongorover/downloads","issues_url":"https://api.github.com/repos/christopherjwang/mongorover/issues{/number}","pulls_url":"https://api.github.com/repos/christopherjwang/mongorover/pulls{/number}","milestones_url":"https://api.github.com/repos/christopherjwang/mongorover/milestones{/number}","notifications_url":"https://api.github.com/repos/christopherjwang/mongorover/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christopherjwang/mongorover/labels{/name}","releases_url":"https://api.github.com/repos/christopherjwang/mongorover/releases{/id}","created_at":"2015-07-13T20:04:45Z","updated_at":"2015-07-13T20:04:46Z","pushed_at":"2015-10-13T03:51:15Z","git_url":"git://github.com/christopherjwang/mongorover.git","ssh_url":"git@github.com:christopherjwang/mongorover.git","clone_url":"https://github.com/christopherjwang/mongorover.git","svn_url":"https://github.com/christopherjwang/mongorover","homepage":null,"size":278,"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":"mongodb-labs:master","ref":"master","sha":"1d714bb0dda86088c60e32f4ec86d12c2b379d68","user":{"login":"mongodb-labs","id":2118794,"avatar_url":"https://avatars.githubusercontent.com/u/2118794?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb-labs","html_url":"https://github.com/mongodb-labs","followers_url":"https://api.github.com/users/mongodb-labs/followers","following_url":"https://api.github.com/users/mongodb-labs/following{/other_user}","gists_url":"https://api.github.com/users/mongodb-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb-labs/subscriptions","organizations_url":"https://api.github.com/users/mongodb-labs/orgs","repos_url":"https://api.github.com/users/mongodb-labs/repos","events_url":"https://api.github.com/users/mongodb-labs/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":34905978,"name":"mongorover","full_name":"mongodb-labs/mongorover","owner":{"login":"mongodb-labs","id":2118794,"avatar_url":"https://avatars.githubusercontent.com/u/2118794?v=3","gravatar_id":"","url":"https://api.github.com/users/mongodb-labs","html_url":"https://github.com/mongodb-labs","followers_url":"https://api.github.com/users/mongodb-labs/followers","following_url":"https://api.github.com/users/mongodb-labs/following{/other_user}","gists_url":"https://api.github.com/users/mongodb-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/mongodb-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mongodb-labs/subscriptions","organizations_url":"https://api.github.com/users/mongodb-labs/orgs","repos_url":"https://api.github.com/users/mongodb-labs/repos","events_url":"https://api.github.com/users/mongodb-labs/events{/privacy}","received_events_url":"https://api.github.com/users/mongodb-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mongodb-labs/mongorover","description":" Intern project - Mongo driver for the Lua programming language","fork":false,"url":"https://api.github.com/repos/mongodb-labs/mongorover","forks_url":"https://api.github.com/repos/mongodb-labs/mongorover/forks","keys_url":"https://api.github.com/repos/mongodb-labs/mongorover/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mongodb-labs/mongorover/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mongodb-labs/mongorover/teams","hooks_url":"https://api.github.com/repos/mongodb-labs/mongorover/hooks","issue_events_url":"https://api.github.com/repos/mongodb-labs/mongorover/issues/events{/number}","events_url":"https://api.github.com/repos/mongodb-labs/mongorover/events","assignees_url":"https://api.github.com/repos/mongodb-labs/mongorover/assignees{/user}","branches_url":"https://api.github.com/repos/mongodb-labs/mongorover/branches{/branch}","tags_url":"https://api.github.com/repos/mongodb-labs/mongorover/tags","blobs_url":"https://api.github.com/repos/mongodb-labs/mongorover/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mongodb-labs/mongorover/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mongodb-labs/mongorover/git/refs{/sha}","trees_url":"https://api.github.com/repos/mongodb-labs/mongorover/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mongodb-labs/mongorover/statuses/{sha}","languages_url":"https://api.github.com/repos/mongodb-labs/mongorover/languages","stargazers_url":"https://api.github.com/repos/mongodb-labs/mongorover/stargazers","contributors_url":"https://api.github.com/repos/mongodb-labs/mongorover/contributors","subscribers_url":"https://api.github.com/repos/mongodb-labs/mongorover/subscribers","subscription_url":"https://api.github.com/repos/mongodb-labs/mongorover/subscription","commits_url":"https://api.github.com/repos/mongodb-labs/mongorover/commits{/sha}","git_commits_url":"https://api.github.com/repos/mongodb-labs/mongorover/git/commits{/sha}","comments_url":"https://api.github.com/repos/mongodb-labs/mongorover/comments{/number}","issue_comment_url":"https://api.github.com/repos/mongodb-labs/mongorover/issues/comments{/number}","contents_url":"https://api.github.com/repos/mongodb-labs/mongorover/contents/{+path}","compare_url":"https://api.github.com/repos/mongodb-labs/mongorover/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mongodb-labs/mongorover/merges","archive_url":"https://api.github.com/repos/mongodb-labs/mongorover/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mongodb-labs/mongorover/downloads","issues_url":"https://api.github.com/repos/mongodb-labs/mongorover/issues{/number}","pulls_url":"https://api.github.com/repos/mongodb-labs/mongorover/pulls{/number}","milestones_url":"https://api.github.com/repos/mongodb-labs/mongorover/milestones{/number}","notifications_url":"https://api.github.com/repos/mongodb-labs/mongorover/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mongodb-labs/mongorover/labels{/name}","releases_url":"https://api.github.com/repos/mongodb-labs/mongorover/releases{/id}","created_at":"2015-05-01T14:14:03Z","updated_at":"2015-07-22T00:57:27Z","pushed_at":"2015-10-13T03:52:55Z","git_url":"git://github.com/mongodb-labs/mongorover.git","ssh_url":"git@github.com:mongodb-labs/mongorover.git","clone_url":"https://github.com/mongodb-labs/mongorover.git","svn_url":"https://github.com/mongodb-labs/mongorover","homepage":null,"size":343,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26"},"html":{"href":"https://github.com/mongodb-labs/mongorover/pull/26"},"issue":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/issues/26"},"comments":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/issues/26/comments"},"review_comments":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26/comments"},"review_comment":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/pulls/26/commits"},"statuses":{"href":"https://api.github.com/repos/mongodb-labs/mongorover/statuses/07fbf5898d7bd6b2dc5cbcbc32029c6d9d5bbf92"}}}}