mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
Merge HUGE set of changes temporarily into a branch, to allow me to move them from one machine to another (lock-free and stuff)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1469 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
6aeec56708
commit
00da37f2c4
72 changed files with 4389 additions and 1767 deletions
80
src/pulsecore/macro.h
Normal file
80
src/pulsecore/macro.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#ifndef foopulsemacrohfoo
|
||||
#define foopulsemacrohfoo
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
Copyright 2004-2006 Lennart Poettering
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
USA.
|
||||
***/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pulsecore/log.h>
|
||||
|
||||
static inline size_t pa_align(size_t l) {
|
||||
return (((l + sizeof(void*) - 1) / sizeof(void*)) * sizeof(void*));
|
||||
}
|
||||
|
||||
#define PA_ALIGN(x) (pa_align(x))
|
||||
|
||||
#define PA_ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
#define SA_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define SA_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define PA_PRETTY_FUNCTION __PRETTY_FUNCTION__
|
||||
#else
|
||||
#define PA_PRETTY_FUNCTION ""
|
||||
#endif
|
||||
|
||||
#define pa_return_if_fail(expr) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
pa_log_debug("%s: Assertion <%s> failed.\n", PA_PRETTY_FUNCTION, #expr ); \
|
||||
return; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define pa_return_val_if_fail(expr, val) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
pa_log_debug("%s: Assertion <%s> failed.\n", PA_PRETTY_FUNCTION, #expr ); \
|
||||
return (val); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define pa_return_null_if_fail(expr) pa_return_val_if_fail(expr, NULL)
|
||||
|
||||
#define pa_assert assert
|
||||
|
||||
#define pa_assert_not_reached() pa_assert(!"Should not be reached.")
|
||||
|
||||
/* An assert which guarantees side effects of x */
|
||||
#define pa_assert_se(x) do { \
|
||||
int _r = !!(x); \
|
||||
pa_assert(_r); \
|
||||
} while(0)
|
||||
|
||||
#define PA_PTR_TO_UINT(p) ((unsigned int) (unsigned long) (p))
|
||||
#define PA_UINT_TO_PTR(u) ((void*) (unsigned long) (u))
|
||||
#define PA_PTR_TO_UINT32(p) ((uint32_t) PA_PTR_TO_UINT(p))
|
||||
#define PA_UINT32_TO_PTR(u) PA_UINT_TO_PTR(u)
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue