From f3977836afc82ce32c203173bd393789e05a123e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 21 Jul 2014 01:24:01 +0200 Subject: [PATCH] blobmsg: add a helper function to reset the name of a blobmsg attribute Signed-off-by: Felix Fietkau --- blobmsg.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blobmsg.h b/blobmsg.h index 082980a..7041aca 100644 --- a/blobmsg.h +++ b/blobmsg.h @@ -51,6 +51,12 @@ static inline int blobmsg_hdrlen(unsigned int namelen) return BLOBMSG_PADDING(sizeof(struct blobmsg_hdr) + namelen + 1); } +static inline void blobmsg_clear_name(struct blob_attr *attr) +{ + struct blobmsg_hdr *hdr = (struct blobmsg_hdr *) blob_data(attr); + hdr->name[0] = 0; +} + static inline const char *blobmsg_name(const struct blob_attr *attr) { struct blobmsg_hdr *hdr = (struct blobmsg_hdr *) blob_data(attr);