From 1a0543c605b42ee53bd3b14665a8910d86737ba8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 14 Feb 2012 19:39:41 +0000 Subject: [PATCH 1/7] Make _dbus_mutex_new, _dbus_mutex_free static They're only called within their module. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=43744 Signed-off-by: Simon McVittie --- dbus/dbus-threads-internal.h | 2 -- dbus/dbus-threads.c | 28 +++++++++++----------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/dbus/dbus-threads-internal.h b/dbus/dbus-threads-internal.h index 11f9ce2..68aa20a 100644 --- a/dbus/dbus-threads-internal.h +++ b/dbus/dbus-threads-internal.h @@ -29,8 +29,6 @@ DBUS_BEGIN_DECLS -DBusMutex* _dbus_mutex_new (void); -void _dbus_mutex_free (DBusMutex *mutex); void _dbus_mutex_lock (DBusMutex *mutex); void _dbus_mutex_unlock (DBusMutex *mutex); void _dbus_mutex_new_at_location (DBusMutex **location_p); diff --git a/dbus/dbus-threads.c b/dbus/dbus-threads.c index 37b68ba..5eda6f1 100644 --- a/dbus/dbus-threads.c +++ b/dbus/dbus-threads.c @@ -47,6 +47,8 @@ static DBusList *uninitialized_condvar_list = NULL; /** This is used for the no-op default mutex pointer, just to be distinct from #NULL */ #define _DBUS_DUMMY_CONDVAR ((DBusCondVar*)0xABCDEF2) +static void _dbus_mutex_free (DBusMutex *mutex); + /** * @defgroup DBusThreadsInternals Thread functions * @ingroup DBusInternals @@ -57,15 +59,7 @@ static DBusList *uninitialized_condvar_list = NULL; * @{ */ -/** - * Creates a new mutex using the function supplied to dbus_threads_init(), - * or creates a no-op mutex if threads are not initialized. - * May return #NULL even if threads are initialized, indicating - * out-of-memory. - * - * @returns new mutex or #NULL - */ -DBusMutex* +static DBusMutex * _dbus_mutex_new (void) { if (thread_functions.recursive_mutex_new) @@ -77,9 +71,13 @@ _dbus_mutex_new (void) } /** - * This does the same thing as _dbus_mutex_new. It however - * gives another level of indirection by allocating a pointer - * to point to the mutex location. This allows the threading + * Creates a new mutex using the function supplied to dbus_threads_init(), + * or creates a no-op mutex if threads are not initialized. + * May return #NULL even if threads are initialized, indicating + * out-of-memory. + * + * The extra level of indirection given by allocating a pointer + * to point to the mutex location allows the threading * module to swap out dummy mutexes for real a real mutex so libraries * can initialize threads even after the D-Bus API has been used. * @@ -102,11 +100,7 @@ _dbus_mutex_new_at_location (DBusMutex **location_p) } } -/** - * Frees a mutex created with dbus_mutex_new(); does - * nothing if passed a #NULL pointer. - */ -void +static void _dbus_mutex_free (DBusMutex *mutex) { if (mutex) -- 1.7.9