From ab07091f8cf102a4cab746e06dd817c62375cf94 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Thu, 26 Feb 2015 15:30:09 +0200 Subject: [PATCH] util: Move msg_append_attr into util part --- src/util.c | 16 ++++++++++++++++ src/util.h | 7 +++++++ src/wiphy.c | 16 ---------------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/util.c b/src/util.c index 6735ecf4..102bd8f3 100644 --- a/src/util.c +++ b/src/util.c @@ -27,6 +27,9 @@ #include #include +#include +#include +#include #include "util.h" @@ -74,3 +77,16 @@ no_ssid: return buf; } + +bool _msg_append_attr(struct l_genl_msg *msg, + uint16_t type, const char *type_str, + uint16_t len, const void *value) +{ + bool ret; + + ret = l_genl_msg_append_attr(msg, type, len, value); + if (!ret) + l_warn("Cannot append attr %s", type_str); + + return ret; +} diff --git a/src/util.h b/src/util.h index 896441ae..fb363d5e 100644 --- a/src/util.h +++ b/src/util.h @@ -39,4 +39,11 @@ static inline bool util_is_bit_set(const uint8_t oct, int bit) int mask = 1 << bit; return oct & mask ? true : false; } + +bool _msg_append_attr(struct l_genl_msg *msg, + uint16_t type, const char *type_str, + uint16_t len, const void *value); + +#define msg_append_attr(msg, type, len, value) \ + _msg_append_attr(msg, type, #type, len, value) #endif /* __UTIL_H */ diff --git a/src/wiphy.c b/src/wiphy.c index 63cb3e7a..c11a6341 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -86,22 +86,6 @@ struct wiphy { static struct l_queue *wiphy_list = NULL; -static bool _msg_append_attr(struct l_genl_msg *msg, - uint16_t type, const char *type_str, - uint16_t len, const void *value) -{ - bool ret; - - ret = l_genl_msg_append_attr(msg, type, len, value); - if (!ret) - l_warn("Cannot append attr %s", type_str); - - return ret; -} - -#define msg_append_attr(msg, type, len, value) \ - _msg_append_attr(msg, type, #type, len, value) - static void do_debug(const char *str, void *user_data) { const char *prefix = user_data;