diff options
author | Petr Štetiar <ynezz@true.cz> | 2019-12-12 18:42:39 +0300 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2019-12-25 12:31:58 +0300 |
commit | 86f6a5b8d1f160cc6f278f08f69d2c3d0f90b43c (patch) | |
tree | e72ca4722eb9080c56bbd147981527096e695e8b /blobmsg.h | |
parent | 586ce031eaa0e732603adbc9509aeaca4d6b2769 (diff) |
blobmsg: reuse blobmsg_namelen in blobmsg_data
Move blobmsg_namelen into header file so it's possible to reuse it in
blobmsg_data.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'blobmsg.h')
-rw-r--r-- | blobmsg.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -69,6 +69,11 @@ static inline int blobmsg_type(const struct blob_attr *attr) return blob_id(attr); } +static uint16_t blobmsg_namelen(const struct blobmsg_hdr *hdr) +{ + return be16_to_cpu(hdr->namelen); +} + static inline void *blobmsg_data(const struct blob_attr *attr) { struct blobmsg_hdr *hdr; @@ -81,7 +86,7 @@ static inline void *blobmsg_data(const struct blob_attr *attr) data = (char *) blob_data(attr); if (blob_is_extended(attr)) - data += blobmsg_hdrlen(be16_to_cpu(hdr->namelen)); + data += blobmsg_hdrlen(blobmsg_namelen(hdr)); return data; } |