diff options
author | Havoc Pennington <hp@redhat.com> | 2006-10-21 17:21:45 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2006-10-21 17:21:45 +0000 |
commit | 174c63f176b9074ffe3cca8df016c53d68cafce9 (patch) | |
tree | c0c199df013668d0bb7801b0287942dbc57e988a | |
parent | afa4ffbd852686633086569cd34942917c5c49af (diff) |
2006-10-21 Havoc Pennington <hp@redhat.com>
* Move all private API into the private Doxygen group sections of
the files, so they don't show up in the public API docs
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | dbus/dbus-message.c | 92 | ||||
-rw-r--r-- | dbus/dbus-pending-call.c | 209 | ||||
-rw-r--r-- | dbus/dbus-server.c | 121 | ||||
-rw-r--r-- | dbus/dbus-signature.c | 4 |
5 files changed, 221 insertions, 210 deletions
@@ -1,5 +1,10 @@ 2006-10-21 Havoc Pennington <hp@redhat.com> + * Move all private API into the private Doxygen group sections of + the files, so they don't show up in the public API docs + +2006-10-21 Havoc Pennington <hp@redhat.com> + * dbus/dbus-message.h: put #ifndef DBUS_DISABLE_DEPRECATED around dbus_message_iter_get_array_len(). diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index 7e53ce12..5b7a9903 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -579,6 +579,52 @@ dbus_message_cache_or_finalize (DBusMessage *message) dbus_message_finalize (message); } +#ifndef DBUS_DISABLE_CHECKS +static dbus_bool_t +_dbus_message_iter_check (DBusMessageRealIter *iter) +{ + if (iter == NULL) + { + _dbus_warn_check_failed ("dbus message iterator is NULL\n"); + return FALSE; + } + + if (iter->iter_type == DBUS_MESSAGE_ITER_TYPE_READER) + { + if (iter->u.reader.byte_order != iter->message->byte_order) + { + _dbus_warn_check_failed ("dbus message changed byte order since iterator was created\n"); + return FALSE; + } + /* because we swap the message into compiler order when you init an iter */ + _dbus_assert (iter->u.reader.byte_order == DBUS_COMPILER_BYTE_ORDER); + } + else if (iter->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER) + { + if (iter->u.writer.byte_order != iter->message->byte_order) + { + _dbus_warn_check_failed ("dbus message changed byte order since append iterator was created\n"); + return FALSE; + } + /* because we swap the message into compiler order when you init an iter */ + _dbus_assert (iter->u.writer.byte_order == DBUS_COMPILER_BYTE_ORDER); + } + else + { + _dbus_warn_check_failed ("dbus message iterator looks uninitialized or corrupted\n"); + return FALSE; + } + + if (iter->changed_stamp != iter->message->changed_stamp) + { + _dbus_warn_check_failed ("dbus message iterator invalid because the message has been modified (or perhaps the iterator is just uninitialized)\n"); + return FALSE; + } + + return TRUE; +} +#endif /* DBUS_DISABLE_CHECKS */ + /** * Implementation of the varargs arg-getting functions. * dbus_message_get_args() is the place to go for complete @@ -1714,52 +1760,6 @@ dbus_message_iter_init (DBusMessage *message, return _dbus_type_reader_get_current_type (&real->u.reader) != DBUS_TYPE_INVALID; } -#ifndef DBUS_DISABLE_CHECKS -static dbus_bool_t -_dbus_message_iter_check (DBusMessageRealIter *iter) -{ - if (iter == NULL) - { - _dbus_warn_check_failed ("dbus message iterator is NULL\n"); - return FALSE; - } - - if (iter->iter_type == DBUS_MESSAGE_ITER_TYPE_READER) - { - if (iter->u.reader.byte_order != iter->message->byte_order) - { - _dbus_warn_check_failed ("dbus message changed byte order since iterator was created\n"); - return FALSE; - } - /* because we swap the message into compiler order when you init an iter */ - _dbus_assert (iter->u.reader.byte_order == DBUS_COMPILER_BYTE_ORDER); - } - else if (iter->iter_type == DBUS_MESSAGE_ITER_TYPE_WRITER) - { - if (iter->u.writer.byte_order != iter->message->byte_order) - { - _dbus_warn_check_failed ("dbus message changed byte order since append iterator was created\n"); - return FALSE; - } - /* because we swap the message into compiler order when you init an iter */ - _dbus_assert (iter->u.writer.byte_order == DBUS_COMPILER_BYTE_ORDER); - } - else - { - _dbus_warn_check_failed ("dbus message iterator looks uninitialized or corrupted\n"); - return FALSE; - } - - if (iter->changed_stamp != iter->message->changed_stamp) - { - _dbus_warn_check_failed ("dbus message iterator invalid because the message has been modified (or perhaps the iterator is just uninitialized)\n"); - return FALSE; - } - - return TRUE; -} -#endif /* DBUS_DISABLE_CHECKS */ - /** * Checks if an iterator has any more fields. * diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index 6ae95a6e..403bf57c 100644 --- a/dbus/dbus-pending-call.c +++ b/dbus/dbus-pending-call.c @@ -363,26 +363,6 @@ _dbus_pending_call_set_timeout_error_unlocked (DBusPendingCall *pending, return TRUE; } -/** @} */ - -/** - * @defgroup DBusPendingCall DBusPendingCall - * @ingroup DBus - * @brief Pending reply to a method call message - * - * A DBusPendingCall is an object representing an - * expected reply. A #DBusPendingCall can be created - * when you send a message that should have a reply. - * - * @{ - */ - -/** - * @typedef DBusPendingCall - * - * Opaque data type representing a message pending. - */ - /** * Increments the reference count on a pending call, * while the lock on its connection is already held. @@ -398,32 +378,6 @@ _dbus_pending_call_ref_unlocked (DBusPendingCall *pending) return pending; } -/** - * Increments the reference count on a pending call. - * - * @param pending the pending call object - * @returns the pending call object - */ -DBusPendingCall * -dbus_pending_call_ref (DBusPendingCall *pending) -{ - _dbus_return_val_if_fail (pending != NULL, NULL); - - /* The connection lock is better than the global - * lock in the atomic increment fallback - */ -#ifdef DBUS_HAVE_ATOMIC_INT - _dbus_atomic_inc (&pending->refcount); -#else - CONNECTION_LOCK (pending->connection); - _dbus_assert (pending->refcount.value > 0); - - pending->refcount.value += 1; - CONNECTION_UNLOCK (pending->connection); -#endif - - return pending; -} static void _dbus_pending_call_last_unref (DBusPendingCall *pending) @@ -491,6 +445,111 @@ _dbus_pending_call_unref_and_unlock (DBusPendingCall *pending) } /** + * Checks whether the pending call has received a reply + * yet, or not. Assumes connection lock is held. + * + * @param pending the pending call + * @returns #TRUE if a reply has been received + */ +dbus_bool_t +_dbus_pending_call_get_completed_unlocked (DBusPendingCall *pending) +{ + return pending->completed; +} + +static DBusDataSlotAllocator slot_allocator; +_DBUS_DEFINE_GLOBAL_LOCK (pending_call_slots); + +/** + * Stores a pointer on a #DBusPendingCall, along + * with an optional function to be used for freeing + * the data when the data is set again, or when + * the pending call is finalized. The slot number + * must have been allocated with dbus_pending_call_allocate_data_slot(). + * + * @param pending the pending_call + * @param slot the slot number + * @param data the data to store + * @param free_data_func finalizer function for the data + * @returns #TRUE if there was enough memory to store the data + */ +dbus_bool_t +_dbus_pending_call_set_data_unlocked (DBusPendingCall *pending, + dbus_int32_t slot, + void *data, + DBusFreeFunction free_data_func) +{ + DBusFreeFunction old_free_func; + void *old_data; + dbus_bool_t retval; + + retval = _dbus_data_slot_list_set (&slot_allocator, + &pending->slot_list, + slot, data, free_data_func, + &old_free_func, &old_data); + + /* Drop locks to call out to app code */ + CONNECTION_UNLOCK (pending->connection); + + if (retval) + { + if (old_free_func) + (* old_free_func) (old_data); + } + + CONNECTION_LOCK (pending->connection); + + return retval; +} + +/** @} */ + +/** + * @defgroup DBusPendingCall DBusPendingCall + * @ingroup DBus + * @brief Pending reply to a method call message + * + * A DBusPendingCall is an object representing an + * expected reply. A #DBusPendingCall can be created + * when you send a message that should have a reply. + * + * @{ + */ + +/** + * @typedef DBusPendingCall + * + * Opaque data type representing a message pending. + */ + +/** + * Increments the reference count on a pending call. + * + * @param pending the pending call object + * @returns the pending call object + */ +DBusPendingCall * +dbus_pending_call_ref (DBusPendingCall *pending) +{ + _dbus_return_val_if_fail (pending != NULL, NULL); + + /* The connection lock is better than the global + * lock in the atomic increment fallback + */ +#ifdef DBUS_HAVE_ATOMIC_INT + _dbus_atomic_inc (&pending->refcount); +#else + CONNECTION_LOCK (pending->connection); + _dbus_assert (pending->refcount.value > 0); + + pending->refcount.value += 1; + CONNECTION_UNLOCK (pending->connection); +#endif + + return pending; +} + +/** * Decrements the reference count on a pending call, * freeing it if the count reaches 0. * @@ -572,19 +631,6 @@ dbus_pending_call_cancel (DBusPendingCall *pending) /** * Checks whether the pending call has received a reply - * yet, or not. Assumes connection lock is held. - * - * @param pending the pending call - * @returns #TRUE if a reply has been received - */ -dbus_bool_t -_dbus_pending_call_get_completed_unlocked (DBusPendingCall *pending) -{ - return pending->completed; -} - -/** - * Checks whether the pending call has received a reply * yet, or not. * * @param pending the pending call @@ -655,9 +701,6 @@ dbus_pending_call_block (DBusPendingCall *pending) _dbus_connection_block_pending_call (pending); } -static DBusDataSlotAllocator slot_allocator; -_DBUS_DEFINE_GLOBAL_LOCK (pending_call_slots); - /** * Allocates an integer ID to be used for storing application-specific * data on any DBusPendingCall. The allocated ID may then be used @@ -716,48 +759,6 @@ dbus_pending_call_free_data_slot (dbus_int32_t *slot_p) * @returns #TRUE if there was enough memory to store the data */ dbus_bool_t -_dbus_pending_call_set_data_unlocked (DBusPendingCall *pending, - dbus_int32_t slot, - void *data, - DBusFreeFunction free_data_func) -{ - DBusFreeFunction old_free_func; - void *old_data; - dbus_bool_t retval; - - retval = _dbus_data_slot_list_set (&slot_allocator, - &pending->slot_list, - slot, data, free_data_func, - &old_free_func, &old_data); - - /* Drop locks to call out to app code */ - CONNECTION_UNLOCK (pending->connection); - - if (retval) - { - if (old_free_func) - (* old_free_func) (old_data); - } - - CONNECTION_LOCK (pending->connection); - - return retval; -} - -/** - * Stores a pointer on a #DBusPendingCall, along - * with an optional function to be used for freeing - * the data when the data is set again, or when - * the pending call is finalized. The slot number - * must have been allocated with dbus_pending_call_allocate_data_slot(). - * - * @param pending the pending_call - * @param slot the slot number - * @param data the data to store - * @param free_data_func finalizer function for the data - * @returns #TRUE if there was enough memory to store the data - */ -dbus_bool_t dbus_pending_call_set_data (DBusPendingCall *pending, dbus_int32_t slot, void *data, diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c index b54133bb..0fe8adc0 100644 --- a/dbus/dbus-server.c +++ b/dbus/dbus-server.c @@ -423,6 +423,67 @@ _dbus_server_toggle_timeout (DBusServer *server, enabled); } + +/** + * Like dbus_server_ref() but does not acquire the lock (must already be held) + * + * @param server the server. + */ +void +_dbus_server_ref_unlocked (DBusServer *server) +{ + _dbus_assert (server != NULL); + _dbus_assert (server->refcount.value > 0); + + HAVE_LOCK_CHECK (server); + +#ifdef DBUS_HAVE_ATOMIC_INT + _dbus_atomic_inc (&server->refcount); +#else + _dbus_assert (server->refcount.value > 0); + + server->refcount.value += 1; +#endif +} + +/** + * Like dbus_server_unref() but does not acquire the lock (must already be held) + * + * @param server the server. + */ +void +_dbus_server_unref_unlocked (DBusServer *server) +{ + dbus_bool_t last_unref; + + /* Keep this in sync with dbus_server_unref */ + + _dbus_assert (server != NULL); + _dbus_assert (server->refcount.value > 0); + + HAVE_LOCK_CHECK (server); + +#ifdef DBUS_HAVE_ATOMIC_INT + last_unref = (_dbus_atomic_dec (&server->refcount) == 1); +#else + _dbus_assert (server->refcount.value > 0); + + server->refcount.value -= 1; + last_unref = (server->refcount.value == 0); +#endif + + if (last_unref) + { + _dbus_assert (server->disconnected); + + SERVER_UNLOCK (server); + + _dbus_assert (server->vtable->finalize != NULL); + + (* server->vtable->finalize) (server); + } +} + /** @} */ /** @@ -634,6 +695,8 @@ void dbus_server_unref (DBusServer *server) { dbus_bool_t last_unref; + + /* keep this in sync with unref_unlocked */ _dbus_return_if_fail (server != NULL); _dbus_return_if_fail (server->refcount.value > 0); @@ -663,64 +726,6 @@ dbus_server_unref (DBusServer *server) } /** - * Like dbus_server_ref() but does not acquire the lock (must already be held) - * - * @param server the server. - */ -void -_dbus_server_ref_unlocked (DBusServer *server) -{ - _dbus_assert (server != NULL); - _dbus_assert (server->refcount.value > 0); - - HAVE_LOCK_CHECK (server); - -#ifdef DBUS_HAVE_ATOMIC_INT - _dbus_atomic_inc (&server->refcount); -#else - _dbus_assert (server->refcount.value > 0); - - server->refcount.value += 1; -#endif -} - -/** - * Like dbus_server_unref() but does not acquire the lock (must already be held) - * - * @param server the server. - */ -void -_dbus_server_unref_unlocked (DBusServer *server) -{ - dbus_bool_t last_unref; - - _dbus_assert (server != NULL); - _dbus_assert (server->refcount.value > 0); - - HAVE_LOCK_CHECK (server); - -#ifdef DBUS_HAVE_ATOMIC_INT - last_unref = (_dbus_atomic_dec (&server->refcount) == 1); -#else - _dbus_assert (server->refcount.value > 0); - - server->refcount.value -= 1; - last_unref = (server->refcount.value == 0); -#endif - - if (last_unref) - { - _dbus_assert (server->disconnected); - - SERVER_UNLOCK (server); - - _dbus_assert (server->vtable->finalize != NULL); - - (* server->vtable->finalize) (server); - } -} - -/** * Releases the server's address and stops listening for * new clients. If called more than once, only the first * call has an effect. Does not modify the server's diff --git a/dbus/dbus-signature.c b/dbus/dbus-signature.c index 750e5c13..233310ed 100644 --- a/dbus/dbus-signature.c +++ b/dbus/dbus-signature.c @@ -329,6 +329,8 @@ dbus_type_is_fixed (int typecode) } } +/** @} */ /* end of DBusSignature group */ + #ifdef DBUS_BUILD_TESTS /** @@ -506,5 +508,3 @@ _dbus_signature_test (void) #endif -/** @} */ /* end of DBusSignature group */ - |