chiark / gitweb /
main: disable nscd if we can to avoid deadlock, just in case
[elogind.git] / src / macro.h
index d00e70bf6dc57c0df93807f24754983939be6030..10a106bc196be3f1900d96d7b59cc9771a47520e 100644 (file)
@@ -40,6 +40,7 @@
 #define _unlikely_(x) (__builtin_expect(!!(x),0))
 #define _public_ __attribute__ ((visibility("default")))
 #define _hidden_ __attribute__ ((visibility("hidden")))
+#define _weakref_(x) __attribute__((weakref(#x)))
 
 /* Rounds up */
 static inline size_t ALIGN(size_t l) {
@@ -108,12 +109,18 @@ static inline size_t ALIGN(size_t l) {
 #define PTR_TO_UINT32(p) ((uint32_t) ((uintptr_t) (p)))
 #define UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))
 
+#define PTR_TO_ULONG(p) ((unsigned long) ((uintptr_t) (p)))
+#define ULONG_TO_PTR(u) ((void*) ((uintptr_t) (u)))
+
 #define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
 #define INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
 
 #define TO_INT32(p) ((int32_t) ((intptr_t) (p)))
 #define INT32_TO_PTR(u) ((void*) ((intptr_t) (u)))
 
+#define PTR_TO_LONG(p) ((long) ((intptr_t) (p)))
+#define LONG_TO_PTR(u) ((void*) ((intptr_t) (u)))
+
 #define memzero(x,l) (memset((x), 0, (l)))
 #define zero(x) (memzero(&(x), sizeof(x)))