diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-06-29 18:12:44 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-06-29 18:16:36 +0200 |
commit | 16aa46b90da439cd992f4067394b6f8cb4cbb1ad (patch) | |
tree | 139f6d5389d8ff41f1d85d920da068615ca0a99f /lib/locks.c | |
parent | 223a78e601447d4d82be07da7e1506809d7d0e9a (diff) | |
download | gnutls-16aa46b90da439cd992f4067394b6f8cb4cbb1ad.tar.gz |
simplified locking code. Locking functions always exist but are dummies if no
locks have been set.
Diffstat (limited to 'lib/locks.c')
-rw-r--r-- | lib/locks.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/lib/locks.c b/lib/locks.c index 336fe1c1c1..c017fc1686 100644 --- a/lib/locks.c +++ b/lib/locks.c @@ -28,12 +28,10 @@ #include <libtasn1.h> #include <gnutls_dh.h> #include <random.h> -#ifndef HAVE_LIBNETTLE -#include <gcrypt.h> -#endif +#include <locks.h> -#ifdef _WIN32 +#ifdef HAVE_WIN32_LOCKS # include <windows.h> @@ -71,10 +69,10 @@ static int gnutls_system_mutex_unlock (void *priv) return 0; } -#else +#endif /* WIN32_LOCKS */ -# ifdef HAVE_LIBPTHREAD -# include <pthread.h> +#ifdef HAVE_PTHREAD_LOCKS +# include <pthread.h> static int gnutls_system_mutex_init (void **priv) { @@ -125,16 +123,31 @@ static int gnutls_system_mutex_unlock (void *priv) return 0; } -# else +#endif /* PTHREAD_LOCKS */ -#define gnutls_system_mutex_init NULL -#define gnutls_system_mutex_deinit NULL -#define gnutls_system_mutex_lock NULL -#define gnutls_mutex_unlock NULL +#ifdef HAVE_NO_LOCKS -# endif /* PTHREAD */ +static int gnutls_system_mutex_init (void **priv) +{ + return 0; +} + +static void gnutls_system_mutex_deinit (void *priv) +{ + return; +} + +static int gnutls_system_mutex_lock (void *priv) +{ + return 0; +} + +static int gnutls_system_mutex_unlock (void *priv) +{ + return 0; +} -#endif +#endif /* NO_LOCKS */ mutex_init_func gnutls_mutex_init = gnutls_system_mutex_init; mutex_deinit_func gnutls_mutex_deinit = gnutls_system_mutex_deinit; |