From 8f5fd312124467cbddfade8827855dcae8d16f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 24 Apr 2015 14:42:34 +0200 Subject: [PATCH] Change mutex_init/free to return void --- ChangeLog | 2 ++ include/mbedtls/threading.h | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57db9f440..50a372417 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ Features to override the whole module. API Changes + * In the threading layer, mbedtls_mutex_init() and mbedtls_mutex_free() now + return void. * Configuration options POLARSSL_HAVE_LONGLONG was removed (now always on). * Configuration options POLARSSL_HAVE_INT8 and POLARSSL_HAVE_INT16 have been removed (compiler is required to support 32-bit operations). diff --git a/include/mbedtls/threading.h b/include/mbedtls/threading.h index c5fe7efc2..cde3940d8 100644 --- a/include/mbedtls/threading.h +++ b/include/mbedtls/threading.h @@ -53,6 +53,11 @@ typedef pthread_mutex_t mbedtls_threading_mutex_t; * \brief Set your alternate threading implementation function * pointers * + * \note mutex_init() and mutex_free() don't return a status code. + * If mutex_init() fails, it should leave its argument (the + * mutex) in a state such that mutex_lock() will fail when + * called with this argument. + * * \param mutex_init the init function implementation * \param mutex_free the free function implementation * \param mutex_lock the lock function implementation @@ -60,8 +65,8 @@ typedef pthread_mutex_t mbedtls_threading_mutex_t; * * \return 0 if successful */ -int mbedtls_threading_set_alt( int (*mutex_init)( mbedtls_threading_mutex_t * ), - int (*mutex_free)( mbedtls_threading_mutex_t * ), +int mbedtls_threading_set_alt( void (*mutex_init)( mbedtls_threading_mutex_t * ), + void (*mutex_free)( mbedtls_threading_mutex_t * ), int (*mutex_lock)( mbedtls_threading_mutex_t * ), int (*mutex_unlock)( mbedtls_threading_mutex_t * ) ); #endif /* MBEDTLS_THREADING_ALT */ @@ -71,8 +76,8 @@ int mbedtls_threading_set_alt( int (*mutex_init)( mbedtls_threading_mutex_t * ), * * All these functions are expected to work or the result will be undefined. */ -extern int (*mbedtls_mutex_init)( mbedtls_threading_mutex_t *mutex ); -extern int (*mbedtls_mutex_free)( mbedtls_threading_mutex_t *mutex ); +extern void (*mbedtls_mutex_init)( mbedtls_threading_mutex_t *mutex ); +extern void (*mbedtls_mutex_free)( mbedtls_threading_mutex_t *mutex ); extern int (*mbedtls_mutex_lock)( mbedtls_threading_mutex_t *mutex ); extern int (*mbedtls_mutex_unlock)( mbedtls_threading_mutex_t *mutex );