X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=doc%2Fgithub_commits.c;h=9ba36b754018ec6cc63978e6363ccda6ca9d77f7;hb=HEAD;hp=5af01f0d30fab3f94c6e30e5f231f402bc483680;hpb=a00988f6636a4e53b736be8758b63db8d6ca0446;p=jansson.git diff --git a/doc/github_commits.c b/doc/github_commits.c index 5af01f0..9ba36b7 100644 --- a/doc/github_commits.c +++ b/doc/github_commits.c @@ -1,3 +1,10 @@ +/* + * Copyright (c) 2009-2011 Petri Lehtinen + * + * Jansson is free software; you can redistribute it and/or modify + * it under the terms of the MIT license. See LICENSE for details. + */ + #include #include @@ -89,7 +96,7 @@ static char *request(const char *url) int main(int argc, char *argv[]) { - unsigned int i; + size_t i; char *text; char url[URL_SIZE]; @@ -110,7 +117,7 @@ int main(int argc, char *argv[]) if(!text) return 1; - root = json_loads(text, &error); + root = json_loads(text, 0, &error); free(text); if(!root) @@ -120,7 +127,7 @@ int main(int argc, char *argv[]) } commits = json_object_get(root, "commits"); - if(!commits || !json_is_array(commits)) + if(!json_is_array(commits)) { fprintf(stderr, "error: commits is not an array\n"); return 1; @@ -139,14 +146,14 @@ int main(int argc, char *argv[]) } id = json_object_get(commit, "id"); - if(!id || !json_is_string(id)) + if(!json_is_string(id)) { fprintf(stderr, "error: commit %d: id is not a string\n", i + 1); return 1; } message = json_object_get(commit, "message"); - if(!message || !json_is_string(message)) + if(!json_is_string(message)) { fprintf(stderr, "error: commit %d: message is not a string\n", i + 1); return 1;