[svn] gcry - r1167 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Wed Jul 12 21:36:27 CEST 2006
Author: marcus
Date: 2006-07-12 21:36:27 +0200 (Wed, 12 Jul 2006)
New Revision: 1167
Modified:
trunk/src/ChangeLog
trunk/src/ath.c
Log:
2006-07-12 Marcus Brinkmann <marcus at g10code.de>
* ath.c (ath_mutex_destroy): Microoptimize destruction of unused
statitically initialized mutexes. Suggested by Victor Stinner
<haypo at inl.fr>.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2006-07-12 19:26:52 UTC (rev 1166)
+++ trunk/src/ChangeLog 2006-07-12 19:36:27 UTC (rev 1167)
@@ -1,5 +1,9 @@
2006-07-12 Marcus Brinkmann <marcus at g10code.de>
+ * ath.c (ath_mutex_destroy): Microoptimize destruction of unused
+ statitically initialized mutexes. Suggested by Victor Stinner
+ <haypo at inl.fr>.
+
* gcrypt.h (GCRY_THREAD_OPTION_PTHREAD_IMPL,
(GCRY_THREAD_OPTION_PTH_IMPL): Add missing initializers to
suppress gcc warning.
Modified: trunk/src/ath.c
===================================================================
--- trunk/src/ath.c 2006-07-12 19:26:52 UTC (rev 1166)
+++ trunk/src/ath.c 2006-07-12 19:36:27 UTC (rev 1167)
@@ -149,15 +149,17 @@
{
if (ops_set)
{
- int err = mutex_init (lock, 1);
+ if (!ops.mutex_destroy)
+ return 0;
- if (err)
- return err;
-
- if (ops.mutex_destroy)
- return (*ops.mutex_destroy) (lock);
- else
- return 0;
+ (*ops.mutex_lock) (&check_init_lock);
+ if (*lock == ATH_MUTEX_INITIALIZER)
+ {
+ (*ops.mutex_unlock) (&check_init_lock);
+ return 0;
+ }
+ (*ops.mutex_unlock) (&check_init_lock);
+ return (*ops.mutex_destroy) (lock);
}
#ifndef NDEBUG
More information about the Gnupg-commits
mailing list