[svn] dirmngr - r295 - trunk/src

svn author marcus cvs at cvs.gnupg.org
Fri Mar 21 05:27:14 CET 2008


Author: marcus
Date: 2008-03-21 05:27:13 +0100 (Fri, 21 Mar 2008)
New Revision: 295

Modified:
   trunk/src/ChangeLog
   trunk/src/estream.c
Log:
2008-03-21  Marcus Brinkmann  <marcus at g10code.de>

	* estream.c (ESTREAM_MUTEX_DESTROY): New macro.
	(es_create, es_destroy): Use it.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-02-21 18:45:11 UTC (rev 294)
+++ trunk/src/ChangeLog	2008-03-21 04:27:13 UTC (rev 295)
@@ -1,3 +1,8 @@
+2008-03-21  Marcus Brinkmann  <marcus at g10code.de>
+
+	* estream.c (ESTREAM_MUTEX_DESTROY): New macro.
+	(es_create, es_destroy): Use it.
+
 2008-02-21  Werner Koch  <wk at g10code.com>
 
 	* validate.c (check_cert_sig) [HAVE_GCRY_MD_DEBUG]: Use new debug

Modified: trunk/src/estream.c
===================================================================
--- trunk/src/estream.c	2008-02-21 18:45:11 UTC (rev 294)
+++ trunk/src/estream.c	2008-03-21 04:27:13 UTC (rev 295)
@@ -1,5 +1,5 @@
 /* estream.c - Extended Stream I/O Library
- * Copyright (C) 2004, 2005, 2006, 2007 g10 Code GmbH
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 g10 Code GmbH
  *
  * This file is part of Libestream.
  *
@@ -111,9 +111,13 @@
   pth_mutex_release (&(mutex))
 # define ESTREAM_MUTEX_TRYLOCK(mutex)     \
   ((pth_mutex_acquire (&(mutex), 1, NULL) == TRUE) ? 0 : -1)
-# define ESTREAM_MUTEX_INITIALIZE(mutex)  \
-  pth_mutex_init    (&(mutex))
+# define ESTREAM_MUTEX_INITIALIZE(mutex) pth_mutex_init (&(mutex))
+#if HAVE_W32_SYSTEM
+# define ESTREAM_MUTEX_DESTROY(mutex) pth_mutex_destroy (&(mutex))
 #else
+# define ESTREAM_MUTEX_DESTROY(mutex) (void) 0
+#endif
+#else
 
 typedef void *estream_mutex_t;
 # define ESTREAM_MUTEX_INITIALIZER NULL
@@ -121,6 +125,7 @@
 # define ESTREAM_MUTEX_UNLOCK(mutex) (void) 0
 # define ESTREAM_MUTEX_TRYLOCK(mutex) 0
 # define ESTREAM_MUTEX_INITIALIZE(mutex) (void) 0
+# define ESTREAM_MUTEX_DESTROY(mutex) (void) 0
 #endif
 
 /* Memory allocator functions.  */
@@ -1180,7 +1185,10 @@
 
   err = es_list_add (stream_new);
   if (err)
-    goto out;
+    {
+      ESTREAM_MUTEX_DESTROY (stream_new->intern->lock);
+      goto out;
+    }
 
   *stream = stream_new;
 
@@ -1208,6 +1216,7 @@
     {
       es_list_remove (stream);
       err = es_deinitialize (stream);
+      ESTREAM_MUTEX_DESTROY (stream->intern->lock);
       ES_MEM_FREE (stream->intern);
       ES_MEM_FREE (stream);
     }




More information about the Gnupg-commits mailing list