diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-06-10 17:38:14 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-06-10 18:33:04 +0100 |
commit | 719ada0e226eca87bbf6f01194e789d03ae602fd (patch) | |
tree | f87b27ed8716f8f3418ef7e4ea6d0719823d78ff /dbus/dbus-pending-call.c | |
parent | 0fa7d26c8e25c406d31b25b37fc3a5834f8891cd (diff) | |
download | dbus-719ada0e226eca87bbf6f01194e789d03ae602fd.tar.gz |
Add and use DBUS_TIMEOUT_INFINITE and DBUS_TIMEOUT_USE_DEFAULT
The documentation claimed that INT_MAX (whatever that means) meant the
default, but the value that has actually always been checked for is
0x7fffffff (aka INT32_MAX on the competent platforms we sadly don't
restrict our portability to), so we should use that. (In practice D-Bus
probably never worked on platforms where int wasn't 32 bits, though.)
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34570
Diffstat (limited to 'dbus/dbus-pending-call.c')
-rw-r--r-- | dbus/dbus-pending-call.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index e1de656a..70392b79 100644 --- a/dbus/dbus-pending-call.c +++ b/dbus/dbus-pending-call.c @@ -84,7 +84,9 @@ static dbus_int32_t notify_user_data_slot = -1; * Creates a new pending reply object. * * @param connection connection where reply will arrive - * @param timeout_milliseconds length of timeout, -1 for default, INT_MAX for no timeout + * @param timeout_milliseconds length of timeout, -1 (or + * #DBUS_TIMEOUT_USE_DEFAULT) for default, + * #DBUS_TIMEOUT_INFINITE for no timeout * @param timeout_handler timeout handler, takes pending call as data * @returns a new #DBusPendingCall or #NULL if no memory. */ @@ -112,7 +114,7 @@ _dbus_pending_call_new_unlocked (DBusConnection *connection, return NULL; } - if (timeout_milliseconds != _DBUS_INT_MAX) + if (timeout_milliseconds != DBUS_TIMEOUT_INFINITE) { timeout = _dbus_timeout_new (timeout_milliseconds, timeout_handler, @@ -516,6 +518,26 @@ _dbus_pending_call_set_data_unlocked (DBusPendingCall *pending, */ /** + * @def DBUS_TIMEOUT_INFINITE + * + * An integer constant representing an infinite timeout. This has the + * numeric value 0x7fffffff (the largest 32-bit signed integer). + * + * For source compatibility with D-Bus versions earlier than 1.4.12, use + * 0x7fffffff, or INT32_MAX (assuming your platform has it). + */ + +/** + * @def DBUS_TIMEOUT_USE_DEFAULT + * + * An integer constant representing a request to use the default timeout. + * This has numeric value -1. + * + * For source compatibility with D-Bus versions earlier than 1.4.12, use a + * literal -1. + */ + +/** * @typedef DBusPendingCall * * Opaque data type representing a message pending. |