From 9dfbe7f78d6a7070b511966362390f2eed7bbc23 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 12 Mar 2018 12:26:57 +0000 Subject: 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 Reviewed-by: Ralf Habacker Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61922 --- dbus/dbus-sysdeps.h | 7 +++++++ 1 file changed, 7 insertions(+) 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) { -- cgit v1.2.3