[pulseaudio-commits] r1389 - /trunk/src/pulsecore/mutex-posix.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat Sep 9 16:55:59 PDT 2006


Author: lennart
Date: Sun Sep 10 01:55:58 2006
New Revision: 1389

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1389&root=pulseaudio&view=rev
Log:
make pa_mutex_new() and pa_cond_new() succeed in all cases. Similar behaviour to pa_xmalloc().

Modified:
    trunk/src/pulsecore/mutex-posix.c

Modified: trunk/src/pulsecore/mutex-posix.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/mutex-posix.c?rev=1389&root=pulseaudio&r1=1388&r2=1389&view=diff
==============================================================================
--- trunk/src/pulsecore/mutex-posix.c (original)
+++ trunk/src/pulsecore/mutex-posix.c Sun Sep 10 01:55:58 2006
@@ -52,16 +52,11 @@
     pthread_mutexattr_init(&attr);
 
     if (recursive)
-        if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) < 0)
-            return NULL;
+        ASSERT_SUCCESS(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE));
 
     m = pa_xnew(pa_mutex, 1);
 
-    if (pthread_mutex_init(&m->mutex, &attr) < 0) {
-        pa_xfree(m);
-        return NULL;
-    }
-
+    ASSERT_SUCCESS(pthread_mutex_init(&m->mutex, &attr));
     return m;
 }
 
@@ -84,17 +79,12 @@
     ASSERT_SUCCESS(pthread_mutex_unlock(&m->mutex));
 }
 
-
 pa_cond *pa_cond_new(void) {
     pa_cond *c;
 
     c = pa_xnew(pa_cond, 1);
 
-    if (pthread_cond_init(&c->cond, NULL) < 0) {
-        pa_xfree(c);
-        return NULL;
-    }
-
+    ASSERT_SUCCESS(pthread_cond_init(&c->cond, NULL));
     return c;
 }
 




More information about the pulseaudio-commits mailing list