summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-04-11 16:35:31 +0000
committerLennart Poettering <lennart@poettering.net>2008-04-11 16:35:31 +0000
commit50d585e458039bf428d76deb04cd378e61d4b533 (patch)
tree7c9f703b8fead3b4e3c922ecc9438179e2e9159c
parentd0ebb71eede6c626e61aac27aabbe679638358f5 (diff)
fix linker warning macro code, move pa_strnull() to core-util.h, move PA_LIKELY definitions here from gccmacro.h
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2248 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/pulsecore/macro.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index a301bba0..1d9eafd5 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -33,12 +33,22 @@
#include <stdlib.h>
#include <pulsecore/log.h>
-#include <pulsecore/gccmacro.h>
+#include <pulse/gccmacro.h>
#ifndef PACKAGE
#error "Please include config.h before including this file!"
#endif
+#ifndef PA_LIKELY
+#ifdef __GNUC__
+#define PA_LIKELY(x) (__builtin_expect(!!(x),1))
+#define PA_UNLIKELY(x) (__builtin_expect((x),0))
+#else
+#define PA_LIKELY(x) (x)
+#define PA_UNLIKELY(x) (x)
+#endif
+#endif
+
#if defined(PAGE_SIZE)
#define PA_PAGE_SIZE ((size_t) PAGE_SIZE)
#elif defined(PAGESIZE)
@@ -200,20 +210,16 @@ typedef int pa_bool_t;
#define PA_PATH_SEP_CHAR '/'
#endif
-static inline const char *pa_strnull(const char *x) {
- return x ? x : "(null)";
-}
-
#ifdef __GNUC__
-#define PA_WARN_REFERENCE(sym,msg) \
- __asm__(".section .gnu.warning.sym"); \
- __asm__(".asciz \"msg\""); \
+#define PA_WARN_REFERENCE(sym, msg) \
+ __asm__(".section .gnu.warning." #sym); \
+ __asm__(".asciz \"" msg "\""); \
__asm__(".previous")
#else
-#define PA_WARN_REFERENCE(sym,msg)
+#define PA_WARN_REFERENCE(sym, msg)
#endif