From: Felix Fietkau Date: Sun, 20 Jul 2014 23:24:01 +0000 (+0200) Subject: blobmsg: add a helper function to reset the name of a blobmsg attribute X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=commitdiff_plain;h=f3977836afc82ce32c203173bd393789e05a123e;ds=sidebyside blobmsg: add a helper function to reset the name of a blobmsg attribute Signed-off-by: Felix Fietkau --- 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);