summaryrefslogtreecommitdiffstats
path: root/macro.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-10-01 20:16:28 +0000
committerLennart Poettering <lennart@poettering.net>2007-10-01 20:16:28 +0000
commit7d83e5c7816b5e343695a75ba58b32dbe1be969a (patch)
treebfd1dfc9b7c8f4a2aaf66c1b30e78355dee8c88a /macro.h
parent762196328ab7e60f1d2908fd5a337d2ca99726dd (diff)
move all sources down to a seperate src/ tree
git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@34 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce
Diffstat (limited to 'macro.h')
-rw-r--r--macro.h104
1 files changed, 0 insertions, 104 deletions
diff --git a/macro.h b/macro.h
deleted file mode 100644
index d664c3e..0000000
--- a/macro.h
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef foomacrohfoo
-#define foomacrohfoo
-
-#include <stdio.h>
-#include <assert.h>
-
-#ifdef __GNUC__
-#define SA_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#else
-#define SA_PRETTY_FUNCTION ""
-#endif
-
-#define sa_return_if_fail(expr) \
- do { \
- if (!(expr)) { \
- fprintf(stderr, "%s: Assertion <%s> failed.\n", SA_PRETTY_FUNCTION, #expr ); \
- return; \
- } \
- } while(0)
-
-#define sa_return_val_if_fail(expr, val) \
- do { \
- if (!(expr)) { \
- fprintf(stderr, "%s: Assertion <%s> failed.\n", SA_PRETTY_FUNCTION, #expr ); \
- return (val); \
- } \
- } while(0)
-
-#define sa_return_if_fail_mutex(m, expr) \
- do { \
- if (!(expr)) { \
- fprintf(stderr, "%s: Assertion <%s> failed.\n", SA_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", SA_PRETTY_FUNCTION, #expr ); \
- sa_mutex_unlock(m); \
- return (val); \
- } \
- } while(0)
-
-#define sa_assert assert
-
-/* An assert which guarantees side effects of x */
-#ifdef NDEBUG
-#define sa_assert_se(x) x
-#else
-#define sa_assert_se(x) sa_assert(x)
-#endif
-
-#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 SA_ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
-
-#ifndef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-#ifndef CLAMP
-#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef TRUE
-#define TRUE (!FALSE)
-#endif
-
-#define SA_PTR_TO_UINT(p) ((unsigned int) (unsigned long) (p))
-#define SA_UINT_TO_PTR(u) ((void*) (unsigned long) (u))
-
-#define SA_PTR_TO_UINT32(p) ((uint32_t) SA_PTR_TO_UINT(p))
-#define SA_UINT32_TO_PTR(u) SA_UINT_TO_PTR((uint32_t) u)
-
-#define SA_PTR_TO_INT(p) ((int) SA_PTR_TO_UINT(p))
-#define SA_INT_TO_PTR(u) SA_UINT_TO_PTR((int) u)
-
-#define SA_PTR_TO_INT32(p) ((int32_t) SA_PTR_TO_UINT(p))
-#define SA_INT32_TO_PTR(u) SA_UINT_TO_PTR((int32_t) u)
-
-static inline size_t sa_align(size_t l) {
- return (((l + sizeof(void*) - 1) / sizeof(void*)) * sizeof(void*));
-}
-
-#define SA_ALIGN(x) (sa_align(x))
-
-#endif