summaryrefslogtreecommitdiffstats
path: root/src/mutex-posix.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-02-20 00:47:45 +0100
committerLennart Poettering <lennart@poettering.net>2010-02-20 00:47:45 +0100
commitd22b71af47b44c1c1d84195743c34b589e6ab19c (patch)
treeefb8dc22a6c0f5712b029dcc1a6b8af11d42babd /src/mutex-posix.c
parenta558bbefae4e0a9f4d2b9aa539b94ae0344f6aed (diff)
src: reindent for 8ch indenting
I am slowly moving all my projects to kernel-inspired 8ch indenting. This will break patches that haven't been merged yet, which I am aware of, but OTOH in times of git's --ignore-space-change shouldn't be too problematic. Yes, I am aware that reindenting like this sucks, but I cannot stand 4ch indenting anymore. Sorry.
Diffstat (limited to 'src/mutex-posix.c')
-rw-r--r--src/mutex-posix.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/mutex-posix.c b/src/mutex-posix.c
index 8d8b88b..0875c52 100644
--- a/src/mutex-posix.c
+++ b/src/mutex-posix.c
@@ -1,3 +1,5 @@
+/*-*- Mode: C; c-basic-offset: 8 -*-*/
+
/***
This file is part of libcanberra.
@@ -29,50 +31,50 @@
#include "malloc.h"
struct ca_mutex {
- pthread_mutex_t mutex;
+ pthread_mutex_t mutex;
};
ca_mutex* ca_mutex_new(void) {
- ca_mutex *m;
+ ca_mutex *m;
- if (!(m = ca_new(ca_mutex, 1)))
- return NULL;
+ if (!(m = ca_new(ca_mutex, 1)))
+ return NULL;
- if (pthread_mutex_init(&m->mutex, NULL) < 0) {
- ca_free(m);
- return NULL;
- }
+ if (pthread_mutex_init(&m->mutex, NULL) < 0) {
+ ca_free(m);
+ return NULL;
+ }
- return m;
+ return m;
}
void ca_mutex_free(ca_mutex *m) {
- ca_assert(m);
+ ca_assert(m);
- ca_assert_se(pthread_mutex_destroy(&m->mutex) == 0);
- ca_free(m);
+ ca_assert_se(pthread_mutex_destroy(&m->mutex) == 0);
+ ca_free(m);
}
void ca_mutex_lock(ca_mutex *m) {
- ca_assert(m);
+ ca_assert(m);
- ca_assert_se(pthread_mutex_lock(&m->mutex) == 0);
+ ca_assert_se(pthread_mutex_lock(&m->mutex) == 0);
}
ca_bool_t ca_mutex_try_lock(ca_mutex *m) {
- int r;
- ca_assert(m);
+ int r;
+ ca_assert(m);
- if ((r = pthread_mutex_trylock(&m->mutex)) != 0) {
- ca_assert(r == EBUSY);
- return FALSE;
- }
+ if ((r = pthread_mutex_trylock(&m->mutex)) != 0) {
+ ca_assert(r == EBUSY);
+ return FALSE;
+ }
- return TRUE;
+ return TRUE;
}
void ca_mutex_unlock(ca_mutex *m) {
- ca_assert(m);
+ ca_assert(m);
- ca_assert_se(pthread_mutex_unlock(&m->mutex) == 0);
+ ca_assert_se(pthread_mutex_unlock(&m->mutex) == 0);
}