From eb8231ebda2c611df37eb39da38d17fbcf49076d Mon Sep 17 00:00:00 2001 From: Arnaud Fontaine Date: Sat, 12 Dec 2009 15:15:17 +0100 Subject: Remove UTF8 reply macro in favor of inline functions --- ewmh/ewmh.c.m4 | 23 +----------- ewmh/xcb_ewmh.h.m4 | 103 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 72 insertions(+), 54 deletions(-) diff --git a/ewmh/ewmh.c.m4 b/ewmh/ewmh.c.m4 index 08233f8..7a47c3f 100644 --- a/ewmh/ewmh.c.m4 +++ b/ewmh/ewmh.c.m4 @@ -149,8 +149,7 @@ static ewmh_atom_t ewmh_atoms[] = {dnl xcb_get_property_reply(ewmh->connection, \ cookie, e); \ \ - const uint8_t ret = xcb_ewmh_get_##fname##_from_reply(atom_value, \ - r); \ + const uint8_t ret = xcb_ewmh_get_##fname##_from_reply(atom_value, r); \ \ free(r); \ return ret; \ @@ -408,27 +407,8 @@ xcb_ewmh_get_utf8_strings_reply_wipe(xcb_ewmh_get_utf8_strings_reply_t *data) free(data->_reply); } -#define DO_REPLY_UTF8_STRING(fname) \ - uint8_t \ - xcb_ewmh_get_##fname##_from_reply(xcb_ewmh_connection_t *ewmh, \ - xcb_ewmh_get_utf8_strings_reply_t *data, \ - xcb_get_property_reply_t *r) \ - { \ - return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r); \ - } \ - \ - uint8_t \ - xcb_ewmh_get_##fname##_reply(xcb_ewmh_connection_t *ewmh, \ - xcb_get_property_cookie_t cookie, \ - xcb_ewmh_get_utf8_strings_reply_t *data, \ - xcb_generic_error_t **e) \ - { \ - return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e); \ - } - #define DO_ROOT_UTF8_STRING(fname, property) \ DO_GET_ROOT_PROPERTY(fname, property, 0, UINT_MAX) \ - DO_REPLY_UTF8_STRING(fname) \ \ xcb_void_cookie_t \ xcb_ewmh_set_##fname(xcb_ewmh_connection_t *ewmh, \ @@ -455,7 +435,6 @@ xcb_ewmh_get_utf8_strings_reply_wipe(xcb_ewmh_get_utf8_strings_reply_t *data) #define DO_UTF8_STRING(fname, property) \ DO_GET_PROPERTY(fname, property, 0, UINT_MAX) \ - DO_REPLY_UTF8_STRING(fname) \ \ xcb_void_cookie_t \ xcb_ewmh_set_##fname(xcb_ewmh_connection_t *ewmh, \ diff --git a/ewmh/xcb_ewmh.h.m4 b/ewmh/xcb_ewmh.h.m4 index 8a7ee26..8949971 100644 --- a/ewmh/xcb_ewmh.h.m4 +++ b/ewmh/xcb_ewmh.h.m4 @@ -1127,9 +1127,13 @@ xcb_get_property_cookie_t xcb_ewmh_get_desktop_names(xcb_ewmh_connection_t *ewmh * @param r GetProperty _NET_DESKTOP_NAMES reply * @return Return 1 on success, 0 otherwise */ -uint8_t xcb_ewmh_get_desktop_names_from_reply(xcb_ewmh_connection_t *ewmh, - xcb_ewmh_get_utf8_strings_reply_t *names, - xcb_get_property_reply_t *r); +static inline uint8_t +xcb_ewmh_get_desktop_names_from_reply(xcb_ewmh_connection_t *ewmh, + xcb_ewmh_get_utf8_strings_reply_t *names, + xcb_get_property_reply_t *r) +{ + return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r); +} /** * @brief Get reply from the GetProperty _NET_DESKTOP_NAMES cookie @@ -1144,10 +1148,14 @@ uint8_t xcb_ewmh_get_desktop_names_from_reply(xcb_ewmh_connection_t *ewmh, * @param The xcb_generic_error_t supplied * @return Return 1 on success, 0 otherwise */ -uint8_t xcb_ewmh_get_desktop_names_reply(xcb_ewmh_connection_t *ewmh, - xcb_get_property_cookie_t cookie, - xcb_ewmh_get_utf8_strings_reply_t *names, - xcb_generic_error_t **e); +static inline uint8_t +xcb_ewmh_get_desktop_names_reply(xcb_ewmh_connection_t *ewmh, + xcb_get_property_cookie_t cookie, + xcb_ewmh_get_utf8_strings_reply_t *names, + xcb_generic_error_t **e) +{ + return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e); +} /** * @brief Send a ChangeProperty request for _NET_ACTIVE_WINDOW @@ -1589,14 +1597,21 @@ xcb_get_property_cookie_t xcb_ewmh_get_wm_name_unchecked(xcb_ewmh_connection_t * xcb_get_property_cookie_t xcb_ewmh_get_wm_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window); -uint8_t xcb_ewmh_get_wm_name_from_reply(xcb_ewmh_connection_t *ewmh, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_get_property_reply_t *r); +static inline uint8_t +xcb_ewmh_get_wm_name_from_reply(xcb_ewmh_connection_t *ewmh, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_get_property_reply_t *r) +{ + return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r); +} uint8_t xcb_ewmh_get_wm_name_reply(xcb_ewmh_connection_t *ewmh, xcb_get_property_cookie_t cookie, xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_generic_error_t **e); + xcb_generic_error_t **e) +{ + return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e); +} xcb_void_cookie_t xcb_ewmh_set_wm_visible_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window, @@ -1614,14 +1629,22 @@ xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_name_unchecked(xcb_ewmh_connec xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window); -uint8_t xcb_ewmh_get_wm_visible_name_from_reply(xcb_ewmh_connection_t *ewmh, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_get_property_reply_t *r); +static inline uint8_t +xcb_ewmh_get_wm_visible_name_from_reply(xcb_ewmh_connection_t *ewmh, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_get_property_reply_t *r) +{ + return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r); +} -uint8_t xcb_ewmh_get_wm_visible_name_reply(xcb_ewmh_connection_t *ewmh, - xcb_get_property_cookie_t cookie, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_generic_error_t **e); +static inline uint8_t +xcb_ewmh_get_wm_visible_name_reply(xcb_ewmh_connection_t *ewmh, + xcb_get_property_cookie_t cookie, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_generic_error_t **e) +{ + return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e); +} xcb_void_cookie_t xcb_ewmh_set_wm_icon_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window, @@ -1639,14 +1662,22 @@ xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_name_unchecked(xcb_ewmh_connectio xcb_get_property_cookie_t xcb_ewmh_get_wm_icon_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window); -uint8_t xcb_ewmh_get_wm_icon_name_from_reply(xcb_ewmh_connection_t *ewmh, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_get_property_reply_t *r); +static inline uint8_t +xcb_ewmh_get_wm_icon_name_from_reply(xcb_ewmh_connection_t *ewmh, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_get_property_reply_t *r) +{ + return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r); +} -uint8_t xcb_ewmh_get_wm_icon_name_reply(xcb_ewmh_connection_t *ewmh, - xcb_get_property_cookie_t cookie, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_generic_error_t **e); +static inline uint8_t +xcb_ewmh_get_wm_icon_name_reply(xcb_ewmh_connection_t *ewmh, + xcb_get_property_cookie_t cookie, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_generic_error_t **e) +{ + return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e); +} xcb_void_cookie_t xcb_ewmh_set_wm_visible_icon_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window, @@ -1664,14 +1695,22 @@ xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_icon_name_unchecked(xcb_ewmh_c xcb_get_property_cookie_t xcb_ewmh_get_wm_visible_icon_name(xcb_ewmh_connection_t *ewmh, xcb_window_t window); -uint8_t xcb_ewmh_get_wm_visible_icon_name_from_reply(xcb_ewmh_connection_t *ewmh, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_get_property_reply_t *r); +static inline uint8_t +xcb_ewmh_get_wm_visible_icon_name_from_reply(xcb_ewmh_connection_t *ewmh, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_get_property_reply_t *r) +{ + return xcb_ewmh_get_utf8_strings_from_reply(ewmh, data, r); +} -uint8_t xcb_ewmh_get_wm_visible_icon_name_reply(xcb_ewmh_connection_t *ewmh, - xcb_get_property_cookie_t cookie, - xcb_ewmh_get_utf8_strings_reply_t *data, - xcb_generic_error_t **e); +static inline uint8_t +xcb_ewmh_get_wm_visible_icon_name_reply(xcb_ewmh_connection_t *ewmh, + xcb_get_property_cookie_t cookie, + xcb_ewmh_get_utf8_strings_reply_t *data, + xcb_generic_error_t **e) +{ + return xcb_ewmh_get_utf8_strings_reply(ewmh, cookie, data, e); +} xcb_void_cookie_t xcb_ewmh_set_wm_desktop(xcb_ewmh_connection_t *ewmh, xcb_window_t window, -- cgit v1.2.3