add: proper indentation when printing TLV objects

This commit is contained in:
pwpiwi 2017-11-10 21:39:10 +01:00
commit 43912d6349
7 changed files with 43 additions and 25 deletions

View file

@ -308,7 +308,7 @@ void tlvdb_add(struct tlvdb *tlvdb, struct tlvdb *other)
tlvdb->next = other;
}
void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data)
void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data, int level)
{
struct tlvdb *next = NULL;
@ -317,8 +317,8 @@ void tlvdb_visit(const struct tlvdb *tlvdb, tlv_cb cb, void *data)
for (; tlvdb; tlvdb = next) {
next = tlvdb->next;
cb(data, &tlvdb->tag);
tlvdb_visit(tlvdb->children, cb, data);
cb(data, &tlvdb->tag, level);
tlvdb_visit(tlvdb->children, cb, data, level+1);
}
}