diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-03-12 23:13:05 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-03-12 23:18:12 +0400 |
commit | c78b684104eab7a015886502a5b24333de633505 (patch) | |
tree | e8cacc4ae49b36e758240365c70a86b9487b8c7f /blobmsg_json.c | |
parent | 58aec3c59a53147c7d924c823f7405218fb5f555 (diff) |
blobmsg_json: unconditionally use blobmsg data/len accessor functions
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'blobmsg_json.c')
-rw-r--r-- | blobmsg_json.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/blobmsg_json.c b/blobmsg_json.c index f1c47ce..c84fd93 100644 --- a/blobmsg_json.c +++ b/blobmsg_json.c @@ -218,18 +218,14 @@ static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, boo blobmsg_format_string(s, blobmsg_name(attr)); blobmsg_puts(s, ": ", s->indent ? 2 : 1); } - if (head) { - data = blob_data(attr); - len = blob_len(attr); - } else { - data = blobmsg_data(attr); - len = blobmsg_data_len(attr); - - if (s->custom_format) { - data_str = s->custom_format(s->priv, attr); - if (data_str) - goto out; - } + + data = blobmsg_data(attr); + len = blobmsg_data_len(attr); + + if (!head && s->custom_format) { + data_str = s->custom_format(s->priv, attr); + if (data_str) + goto out; } data_str = buf; @@ -304,7 +300,7 @@ char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, blobmsg_jso } if (list) - blobmsg_format_json_list(&s, blob_data(attr), blob_len(attr), false); + blobmsg_format_json_list(&s, blobmsg_data(attr), blobmsg_data_len(attr), false); else blobmsg_format_element(&s, attr, false, false); |