Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-11-27 22:40:15 +0400
committerJo-Philipp Wich <jow@openwrt.org>2013-11-27 22:56:04 +0400
commitf6827c7c93cf19c63a7d038c9d2a71f2b9d72f3e (patch)
treebd9a80b29c18247bf7b57550e15f6bd8bbbeb7ab /blobmsg_json.c
parentf100acef37bd562218b25d1a9fbe1ece1ef57438 (diff)
blobmsg_json: do not emit any whitespace when formatting without indentation
Diffstat (limited to 'blobmsg_json.c')
-rw-r--r--blobmsg_json.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/blobmsg_json.c b/blobmsg_json.c
index e4e005f..f1c47ce 100644
--- a/blobmsg_json.c
+++ b/blobmsg_json.c
@@ -129,14 +129,11 @@ static bool blobmsg_puts(struct strbuf *s, const char *c, int len)
static void add_separator(struct strbuf *s)
{
static char indent_chars[17] = "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
- static const char indent_space = ' ';
int indent;
char *start;
- if (!s->indent) {
- blobmsg_puts(s, &indent_space, 1);
+ if (!s->indent)
return;
- }
indent = s->indent_level;
if (indent > 16)
@@ -219,7 +216,7 @@ static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, boo
if (!array && blobmsg_name(attr)[0]) {
blobmsg_format_string(s, blobmsg_name(attr));
- blobmsg_puts(s, ": ", 2);
+ blobmsg_puts(s, ": ", s->indent ? 2 : 1);
}
if (head) {
data = blob_data(attr);