summaryrefslogtreecommitdiffstats
path: root/macro.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-05-17 22:22:53 +0000
committerLennart Poettering <lennart@poettering.net>2007-05-17 22:22:53 +0000
commitbef6322859a5dc01e35d884de7afd2eabb1d9e4d (patch)
tree6431f409747005fca20998fe518c174c909fd385 /macro.h
parentc58ce0879c1cabfd31dd8657d2594d78f13b1360 (diff)
at basic locking/threading support
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@26 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'macro.h')
-rw-r--r--macro.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/macro.h b/macro.h
index 847bf97..ed80654 100644
--- a/macro.h
+++ b/macro.h
@@ -26,10 +26,33 @@
} \
} while(0)
+#define sa_return_if_fail_mutex(m, expr) \
+ do { \
+ if (!(expr)) { \
+ fprintf(stderr, "%s: Assertion <%s> failed.\n", PRETTY_FUNCTION, #expr ); \
+ sa_mutex_unlock(m); \
+ return; \
+ } \
+ } while(0)
+
+#define sa_return_val_if_fail_mutex(m, expr, val) \
+ do { \
+ if (!(expr)) { \
+ fprintf(stderr, "%s: Assertion <%s> failed.\n", PRETTY_FUNCTION, #expr ); \
+ sa_mutex_unlock(m); \
+ return (val); \
+ } \
+ } while(0)
+
#define sa_assert assert
#define sa_assert_not_reached() sa_assert(!"Should not be reached.")
+#define sa_assert_success(x) do { \
+ int _r = (x); \
+ sa_assert(_r == 0); \
+ } while(0)
+
#define elementsof(x) (sizeof(x)/sizeof((x)[0]))
#ifndef MAX