blobmsg_json: unconditionally use blobmsg data/len accessor functions

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
Felix Fietkau 2014-03-12 20:13:05 +01:00
parent 58aec3c59a
commit c78b684104

View file

@ -218,19 +218,15 @@ static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, boo
blobmsg_format_string(s, blobmsg_name(attr)); blobmsg_format_string(s, blobmsg_name(attr));
blobmsg_puts(s, ": ", s->indent ? 2 : 1); blobmsg_puts(s, ": ", s->indent ? 2 : 1);
} }
if (head) {
data = blob_data(attr);
len = blob_len(attr);
} else {
data = blobmsg_data(attr); data = blobmsg_data(attr);
len = blobmsg_data_len(attr); len = blobmsg_data_len(attr);
if (s->custom_format) { if (!head && s->custom_format) {
data_str = s->custom_format(s->priv, attr); data_str = s->custom_format(s->priv, attr);
if (data_str) if (data_str)
goto out; goto out;
} }
}
data_str = buf; data_str = buf;
switch(blob_id(attr)) { switch(blob_id(attr)) {
@ -304,7 +300,7 @@ char *blobmsg_format_json_with_cb(struct blob_attr *attr, bool list, blobmsg_jso
} }
if (list) 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 else
blobmsg_format_element(&s, attr, false, false); blobmsg_format_element(&s, attr, false, false);