Add spec file
[jansson.git] / doc / github_commits.c
index 5af01f0..9ba36b7 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2009-2011 Petri Lehtinen <petri@digip.org>
+ *
+ * Jansson is free software; you can redistribute it and/or modify
+ * it under the terms of the MIT license. See LICENSE for details.
+ */
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -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;