diff scid/page-index.c @ 43:6854efe15210

scid: push json recursively
author David Demelier <markand@malikania.fr>
date Thu, 11 Aug 2022 11:34:32 +0200
parents 752bb1cd2dd8
children 16f1c72d1635
line wrap: on
line diff
--- a/scid/page-index.c	Tue Aug 09 14:54:59 2022 +0200
+++ b/scid/page-index.c	Thu Aug 11 11:34:32 2022 +0200
@@ -108,17 +108,17 @@
 static void
 get(struct kreq *req)
 {
-	json_t *projects, *root;
+	json_t *projects;
 	char *data;
 
 	/* First, fetch all projects. */
 	if ((projects = db_project_list())) {
 		update_projects(projects);
-		root = json_pack("{so}", "projects", projects);
-		data = theme_page_index(root);
+		data = theme_page_index(util_json_pack("{so}",
+			"projects", projects
+		));
 		pageutil_render(req, KHTTP_200, KMIME_TEXT_HTML, data);
 		free(data);
-		json_decref(root);
 	} else
 		pageutil_status(req, KHTTP_500);
 }