Provide nl_object_dump_buf() to easily dump to buffers
This commit is contained in:
parent
2dbe7d7cfc
commit
ef327ffd44
2 changed files with 11 additions and 0 deletions
|
@ -36,6 +36,7 @@ extern void nl_object_put(struct nl_object *);
|
|||
extern int nl_object_shared(struct nl_object *);
|
||||
extern void nl_object_dump(struct nl_object *,
|
||||
struct nl_dump_params *);
|
||||
extern void nl_object_dump_buf(struct nl_object *, char *, size_t);
|
||||
extern int nl_object_identical(struct nl_object *,
|
||||
struct nl_object *);
|
||||
extern uint32_t nl_object_diff(struct nl_object *,
|
||||
|
|
10
lib/object.c
10
lib/object.c
|
@ -250,6 +250,16 @@ void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params)
|
|||
dump_from_ops(obj, params);
|
||||
}
|
||||
|
||||
void nl_object_dump_buf(struct nl_object *obj, char *buf, size_t len)
|
||||
{
|
||||
struct nl_dump_params dp = {
|
||||
.dp_buf = buf,
|
||||
.dp_buflen = len,
|
||||
};
|
||||
|
||||
return nl_object_dump(obj, &dp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the identifiers of two objects are identical
|
||||
* @arg a an object
|
||||
|
|
Loading…
Add table
Reference in a new issue