summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-11-27 18:30:17 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-11-27 18:30:17 +0000
commit4ead51e17f1e7d7c986daf0cb3f1aeb12d3fe98e (patch)
treed4f9e68b068251f38a12071430d4f4c4deb976a0
parentcd66639800ee2882a0867ec54868502eb9b893d8 (diff)
ubus: remove indentation and whitespace from JSON responses to conserve a bit of bandwidth
-rw-r--r--ubus.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ubus.c b/ubus.c
index da1ab60..39dca35 100644
--- a/ubus.c
+++ b/ubus.c
@@ -127,19 +127,17 @@ static void uh_ubus_send_response(struct client *cl)
char *str;
if (du->array && du->array_idx > 1)
- sep = ", ";
+ sep = ",";
- str = blobmsg_format_json_indent(buf.head, true, du->array);
+ str = blobmsg_format_json(buf.head, true);
ops->chunk_printf(cl, "%s%s", sep, str);
free(str);
du->jsobj_cur = NULL;
if (du->array)
uh_ubus_next_batched_request(cl);
- else {
- ops->chunk_printf(cl, "\n");
+ else
return ops->request_done(cl);
- }
}
static void uh_ubus_init_response(struct client *cl)
@@ -419,12 +417,12 @@ static void uh_ubus_init_batch(struct client *cl)
du->array = true;
uh_ubus_send_header(cl);
- ops->chunk_printf(cl, "[\n\t");
+ ops->chunk_printf(cl, "[");
}
static void uh_ubus_complete_batch(struct client *cl)
{
- ops->chunk_printf(cl, "\n]\n");
+ ops->chunk_printf(cl, "]");
ops->request_done(cl);
}