From: Florian Forster Date: Thu, 22 Dec 2011 08:06:20 +0000 (+0100) Subject: list_hosts_json action: Create an object for each host. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c08cfbb86fc765dc9aac1e8f22548aa05da722fc;p=collection4.git list_hosts_json action: Create an object for each host. This should simplify future extensions. --- diff --git a/src/action_list_hosts_json.c b/src/action_list_hosts_json.c index 029b700..419d44c 100644 --- a/src/action_list_hosts_json.c +++ b/src/action_list_hosts_json.c @@ -46,10 +46,17 @@ static int print_one_host (const char *host, /* {{{ */ { yajl_gen handler = user_data; + yajl_gen_map_open (handler); + + yajl_gen_string (handler, + (unsigned char *) "host", + (unsigned int) strlen ("host")); yajl_gen_string (handler, (unsigned char *) host, (unsigned int) strlen (host)); + yajl_gen_map_close (handler); + return (0); } /* }}} int print_one_host */ @@ -64,8 +71,6 @@ static int print_all_hosts (yajl_gen handler) /* {{{ */ int action_list_hosts_json (void) /* {{{ */ { - graph_config_t *cfg; - yajl_gen_config handler_config; yajl_gen handler;