diff options
author | Simon McVittie <smcv@collabora.com> | 2018-03-12 12:26:57 +0000 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2018-03-12 20:33:36 +0100 |
commit | 9dfbe7f78d6a7070b511966362390f2eed7bbc23 (patch) | |
tree | 2f529bbc61ae54eb247c6c3a5f33ad3870313407 | |
parent | 39efd6ebdd1d476ea0a529244653f114ce01c156 (diff) |
DBusSocket helpers: Declare as _DBUS_GNUC_WARN_UNUSED_RESULT
There is no point in calling these functions for their side-effects,
because they don't have any.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61922
-rw-r--r-- | dbus/dbus-sysdeps.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps.h b/dbus/dbus-sysdeps.h index c9d630a7f..171af7b56 100644 --- a/dbus/dbus-sysdeps.h +++ b/dbus/dbus-sysdeps.h @@ -132,15 +132,18 @@ typedef struct { SOCKET sock; } DBusSocket; # define DBUS_SOCKET_FORMAT "Iu" # define DBUS_SOCKET_INIT { INVALID_SOCKET } +_DBUS_GNUC_WARN_UNUSED_RESULT static inline SOCKET _dbus_socket_printable (DBusSocket s) { return s.sock; } +_DBUS_GNUC_WARN_UNUSED_RESULT static inline dbus_bool_t _dbus_socket_is_valid (DBusSocket s) { return s.sock != INVALID_SOCKET; } static inline void _dbus_socket_invalidate (DBusSocket *s) { s->sock = INVALID_SOCKET; } +_DBUS_GNUC_WARN_UNUSED_RESULT static inline int _dbus_socket_get_int (DBusSocket s) { return (int)s.sock; } @@ -150,20 +153,24 @@ typedef struct { int fd; } DBusSocket; # define DBUS_SOCKET_FORMAT "d" # define DBUS_SOCKET_INIT { -1 } +_DBUS_GNUC_WARN_UNUSED_RESULT static inline int _dbus_socket_printable (DBusSocket s) { return s.fd; } +_DBUS_GNUC_WARN_UNUSED_RESULT static inline dbus_bool_t _dbus_socket_is_valid (DBusSocket s) { return s.fd >= 0; } static inline void _dbus_socket_invalidate (DBusSocket *s) { s->fd = -1; } +_DBUS_GNUC_WARN_UNUSED_RESULT static inline int _dbus_socket_get_int (DBusSocket s) { return s.fd; } #endif /* not DBUS_WIN */ +_DBUS_GNUC_WARN_UNUSED_RESULT static inline DBusSocket _dbus_socket_get_invalid (void) { |