[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test4-94-g8f928b2
Lennart Poettering
gitmailer-noreply at 0pointer.de
Mon Aug 17 10:17:02 PDT 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 01e4b61a910afdd21f860fadbe98075735c2bf51 (commit)
- Log -----------------------------------------------------------------
8f928b2 macro: simplify page/word alignment macros a bit
fe3a21f macro: add PA_ROUND_UP/PA_ROUND_DOWN macros
319d187 bluetooth: fix match syntax
90a0743 bluetooth: make NameOwnerChanged filter matches more focussed
ffeb1b8 volume: document when arguments of certain functions may overlap
caa7928 libpulse: some minor optimizations when checking equality
50de2d8 channelmap: minor doxygen fix
6dd580d channelmap: document where the WAVEX channelmap is documented
32a1ef3 channelmap: adjust RFC3551 channel maps to follow spec more closely
c579cb5 reserver: update from upstream git
8208214 volume: add pa_cvolume_merge() call
-----------------------------------------------------------------------
Summary of changes:
src/map-file | 1 +
src/modules/bluetooth/bluetooth-util.c | 4 +-
src/modules/reserve-monitor.c | 27 ++++++++++-----
src/pulse/channelmap.c | 18 ++++++++--
src/pulse/channelmap.h | 18 ++++++++--
src/pulse/sample.c | 4 ++
src/pulse/volume.c | 22 +++++++++++++
src/pulse/volume.h | 17 ++++++++--
src/pulsecore/macro.h | 54 ++++++++++++++++++++++---------
9 files changed, 126 insertions(+), 39 deletions(-)
-----------------------------------------------------------------------
commit 82082148821d5ebe05fea12fd57d68b31740e04b
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:40:36 2009 +0200
volume: add pa_cvolume_merge() call
diff --git a/src/map-file b/src/map-file
index c6c8acc..4f20c48 100644
--- a/src/map-file
+++ b/src/map-file
@@ -130,6 +130,7 @@ pa_cvolume_get_position;
pa_cvolume_init;
pa_cvolume_max;
pa_cvolume_max_mask;
+pa_cvolume_merge;
pa_cvolume_remap;
pa_cvolume_scale;
pa_cvolume_scale_mask;
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index c23f360..e816d67 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -815,3 +815,21 @@ pa_volume_t pa_cvolume_get_position(
return v;
}
+
+pa_cvolume* pa_cvolume_merge(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b) {
+ unsigned i;
+
+ pa_assert(dest);
+ pa_assert(a);
+ pa_assert(b);
+
+ pa_return_val_if_fail(pa_cvolume_valid(a), NULL);
+ pa_return_val_if_fail(pa_cvolume_valid(b), NULL);
+
+ for (i = 0; i < a->channels && i < b->channels; i++)
+ dest->values[i] = PA_MAX(a->values[i], b->values[i]);
+
+ dest->channels = (uint8_t) i;
+
+ return dest;
+}
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 05b7ebb..14692b8 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -326,6 +326,11 @@ pa_cvolume* pa_cvolume_set_position(pa_cvolume *cv, const pa_channel_map *map, p
* position by calling pa_channel_map_has_position(). \since 0.9.16 */
pa_volume_t pa_cvolume_get_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t) PA_GCC_PURE;
+/** This goes through all channels in a and b and sets the
+ * corresponding channel in dest to the greater volume of both. a, b
+ * and dest may point to the same structure. \since 0.9.16 */
+pa_cvolume* pa_cvolume_merge(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
+
PA_C_DECL_END
#endif
commit c579cb56e941e759b71b393eae1bc98d5deb8a1b
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:41:14 2009 +0200
reserver: update from upstream git
diff --git a/src/modules/reserve-monitor.c b/src/modules/reserve-monitor.c
index 13ecde2..97cb9b9 100644
--- a/src/modules/reserve-monitor.c
+++ b/src/modules/reserve-monitor.c
@@ -38,6 +38,7 @@ struct rm_monitor {
char *device_name;
char *service_name;
+ char *match;
DBusConnection *connection;
@@ -51,6 +52,13 @@ struct rm_monitor {
#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1."
+#define SERVICE_FILTER \
+ "type='signal'," \
+ "sender='" DBUS_SERVICE_DBUS "'," \
+ "interface='" DBUS_INTERFACE_DBUS "'," \
+ "member='NameOwnerChanged'," \
+ "arg0='%s'"
+
static DBusHandlerResult filter_handler(
DBusConnection *c,
DBusMessage *s,
@@ -175,11 +183,13 @@ int rm_watch(
m->filtering = 1;
- dbus_bus_add_match(m->connection,
- "type='signal',"
- "sender='" DBUS_SERVICE_DBUS "',"
- "interface='" DBUS_INTERFACE_DBUS "',"
- "member='NameOwnerChanged'", error);
+ if (!(m->match = malloc(sizeof(SERVICE_FILTER) - 2 + strlen(m->service_name)))) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
+ sprintf(m->match, SERVICE_FILTER, m->service_name);
+ dbus_bus_add_match(m->connection, m->match, error);
if (dbus_error_is_set(error)) {
r = -EIO;
@@ -220,10 +230,8 @@ void rm_release(rm_monitor *m) {
if (m->matching)
dbus_bus_remove_match(
m->connection,
- "type='signal',"
- "sender='" DBUS_SERVICE_DBUS "',"
- "interface='" DBUS_INTERFACE_DBUS "',"
- "member='NameOwnerChanged'", NULL);
+ m->match,
+ NULL);
if (m->filtering)
dbus_connection_remove_filter(
@@ -233,6 +241,7 @@ void rm_release(rm_monitor *m) {
free(m->device_name);
free(m->service_name);
+ free(m->match);
if (m->connection)
dbus_connection_unref(m->connection);
commit 32a1ef311effac8cf792fc7d536f6e1e85dec805
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:42:34 2009 +0200
channelmap: adjust RFC3551 channel maps to follow spec more closely
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 8882301..18053ec 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -219,11 +219,11 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
case 6:
m->map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
- m->map[1] = PA_CHANNEL_POSITION_REAR_LEFT;
+ m->map[1] = PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER;
m->map[2] = PA_CHANNEL_POSITION_FRONT_CENTER;
m->map[3] = PA_CHANNEL_POSITION_FRONT_RIGHT;
- m->map[4] = PA_CHANNEL_POSITION_REAR_RIGHT;
- m->map[5] = PA_CHANNEL_POSITION_LFE;
+ m->map[4] = PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER;
+ m->map[5] = PA_CHANNEL_POSITION_REAR_CENTER;
return m;
case 5:
@@ -247,7 +247,7 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
m->map[0] = PA_CHANNEL_POSITION_LEFT;
m->map[1] = PA_CHANNEL_POSITION_CENTER;
m->map[2] = PA_CHANNEL_POSITION_RIGHT;
- m->map[3] = PA_CHANNEL_POSITION_LFE;
+ m->map[3] = PA_CHANNEL_POSITION_REAR_CENTER;
return m;
default:
commit 6dd580d465cd91c2d32bc897c0eb20fc638e446e
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:43:05 2009 +0200
channelmap: document where the WAVEX channelmap is documented
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 18053ec..98f79b4 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -299,6 +299,8 @@ pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, p
case PA_CHANNEL_MAP_WAVEEX:
+ /* Following http://www.microsoft.com/whdc/device/audio/multichaud.mspx#EKLAC */
+
switch (channels) {
case 1:
m->map[0] = PA_CHANNEL_POSITION_MONO;
commit 50de2d85f955d06cf2c4b88270674c72a974bf71
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:48:51 2009 +0200
channelmap: minor doxygen fix
diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h
index d7901ac..469effc 100644
--- a/src/pulse/channelmap.h
+++ b/src/pulse/channelmap.h
@@ -216,17 +216,27 @@ typedef enum pa_channel_map_def {
PA_CHANNEL_MAP_AIFF,
/**< The mapping from RFC3551, which is based on AIFF-C */
+/** \cond fulldocs */
PA_CHANNEL_MAP_ALSA,
- /**< The default mapping used by ALSA */
+ /**< The default mapping used by ALSA. This mapping is probably
+ * not too useful since ALSA's default channel mapping depends on
+ * the device string used. */
+/** \endcond */
PA_CHANNEL_MAP_AUX,
/**< Only aux channels */
PA_CHANNEL_MAP_WAVEEX,
- /**< Microsoft's WAVEFORMATEXTENSIBLE mapping */
+ /**< Microsoft's WAVEFORMATEXTENSIBLE mapping. This mapping works
+ * as if all LSBs of dwChannelMask are set. */
+/** \cond fulldocs */
PA_CHANNEL_MAP_OSS,
- /**< The default channel mapping used by OSS as defined in the OSS 4.0 API specs */
+ /**< The default channel mapping used by OSS as defined in the OSS
+ * 4.0 API specs. This mapping is probably not too useful since
+ * the OSS API has changed in this respect and no longer knows a
+ * default channel mapping based on the number of channels. */
+/** \endcond */
/**< Upper limit of valid channel mapping definitions */
PA_CHANNEL_MAP_DEF_MAX,
@@ -282,7 +292,7 @@ pa_channel_map* pa_channel_map_init_extend(pa_channel_map *m, unsigned channels,
/** Return a text label for the specified channel position */
const char* pa_channel_position_to_string(pa_channel_position_t pos) PA_GCC_PURE;
-/* The inverse of pa_channel_position_to_string(). \since 0.9.16 */
+/** The inverse of pa_channel_position_to_string(). \since 0.9.16 */
pa_channel_position_t pa_channel_position_from_string(const char *s) PA_GCC_PURE;
/** Return a human readable text label for the specified channel position. \since 0.9.7 */
commit caa792897296f0b03b364ec64ce9065b010e1305
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:50:04 2009 +0200
libpulse: some minor optimizations when checking equality
diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
index 98f79b4..9b51626 100644
--- a/src/pulse/channelmap.c
+++ b/src/pulse/channelmap.c
@@ -453,6 +453,10 @@ int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) {
pa_assert(b);
pa_return_val_if_fail(pa_channel_map_valid(a), 0);
+
+ if (PA_UNLIKELY(a == b))
+ return 1;
+
pa_return_val_if_fail(pa_channel_map_valid(b), 0);
if (a->channels != b->channels)
@@ -641,6 +645,10 @@ int pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) {
pa_assert(b);
pa_return_val_if_fail(pa_channel_map_valid(a), 0);
+
+ if (PA_UNLIKELY(a == b))
+ return 1;
+
pa_return_val_if_fail(pa_channel_map_valid(b), 0);
am = pa_channel_map_mask(a);
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 0f19f8e..d5d38ed 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -125,6 +125,10 @@ int pa_sample_spec_equal(const pa_sample_spec*a, const pa_sample_spec*b) {
pa_assert(b);
pa_return_val_if_fail(pa_sample_spec_valid(a), 0);
+
+ if (PA_UNLIKELY(a == b))
+ return 1;
+
pa_return_val_if_fail(pa_sample_spec_valid(b), 0);
return
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index e816d67..d7fb247 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -40,6 +40,10 @@ int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) {
pa_assert(b);
pa_return_val_if_fail(pa_cvolume_valid(a), 0);
+
+ if (PA_UNLIKELY(a == b))
+ return 1;
+
pa_return_val_if_fail(pa_cvolume_valid(b), 0);
if (a->channels != b->channels)
commit ffeb1b81ba2ce01ba3ed73fcd9ce0977861ee7ba
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:50:43 2009 +0200
volume: document when arguments of certain functions may overlap
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 14692b8..3881da2 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -213,11 +213,13 @@ int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v) PA_GCC_PURE
pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
/** Multiply two per-channel volumes and return the result in
- * *dest. This is only valid for software volumes! */
+ * *dest. This is only valid for software volumes! a, b and dest may
+ * point to the same structure. */
pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
/** Multiply a per-channel volume with a scalar volume and return the
- * result in *dest. This is only valid for software volumes! \since
+ * result in *dest. This is only valid for software volumes! a
+ * and dest may point to the same structure. \since
* 0.9.16 */
pa_cvolume *pa_sw_cvolume_multiply_scalar(pa_cvolume *dest, const pa_cvolume *a, pa_volume_t b);
@@ -228,11 +230,13 @@ pa_cvolume *pa_sw_cvolume_multiply_scalar(pa_cvolume *dest, const pa_cvolume *a,
pa_volume_t pa_sw_volume_divide(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
/** Divide two per-channel volumes and return the result in
- * *dest. This is only valid for software volumes! \since 0.9.13 */
+ * *dest. This is only valid for software volumes! a, b
+ * and dest may point to the same structure. \since 0.9.13 */
pa_cvolume *pa_sw_cvolume_divide(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
/** Divide a per-channel volume by a scalar volume and return the
- * result in *dest. This is only valid for software volumes! \since
+ * result in *dest. This is only valid for software volumes! a
+ * and dest may point to the same structure. \since
* 0.9.16 */
pa_cvolume *pa_sw_cvolume_divide_scalar(pa_cvolume *dest, const pa_cvolume *a, pa_volume_t b);
commit 90a07435d3a1c5660ebb4bac571267a62187ea2e
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 03:51:17 2009 +0200
bluetooth: make NameOwnerChanged filter matches more focussed
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 16c2924..b8eb5c9 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -758,7 +758,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
if (pa_dbus_add_matches(
pa_dbus_connection_get(y->connection), &err,
- "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'",
+ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg='org.bluez'",
"type='signal',sender='org.bluez',interface='org.bluez.Manager',member='AdapterAdded'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceCreated'",
@@ -809,7 +809,7 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
if (y->connection) {
pa_dbus_remove_matches(pa_dbus_connection_get(y->connection),
- "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'",
+ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg='org.bluez'",
"type='signal',sender='org.bluez',interface='org.bluez.Manager',member='AdapterAdded'",
"type='signal',sender='org.bluez',interface='org.bluez.Manager',member='AdapterRemoved'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
commit 319d187972f792568e37af92726b3f25e708cbbc
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 19:14:35 2009 +0200
bluetooth: fix match syntax
diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index b8eb5c9..f576823 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -758,7 +758,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
if (pa_dbus_add_matches(
pa_dbus_connection_get(y->connection), &err,
- "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg='org.bluez'",
+ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.bluez'",
"type='signal',sender='org.bluez',interface='org.bluez.Manager',member='AdapterAdded'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceCreated'",
@@ -809,7 +809,7 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
if (y->connection) {
pa_dbus_remove_matches(pa_dbus_connection_get(y->connection),
- "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg='org.bluez'",
+ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0='org.bluez'",
"type='signal',sender='org.bluez',interface='org.bluez.Manager',member='AdapterAdded'",
"type='signal',sender='org.bluez',interface='org.bluez.Manager',member='AdapterRemoved'",
"type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
commit fe3a21f6a5958a6e54d5bcf7c162767cfdf5f9db
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 19:15:33 2009 +0200
macro: add PA_ROUND_UP/PA_ROUND_DOWN macros
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index cf66251..aa06359 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -91,7 +91,8 @@ static inline size_t pa_page_align(size_t l) {
#ifdef __GNUC__
#define PA_MAX(a,b) \
- __extension__ ({ typeof(a) _a = (a); \
+ __extension__ ({ \
+ typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a > _b ? _a : _b; \
})
@@ -101,7 +102,8 @@ static inline size_t pa_page_align(size_t l) {
#ifdef __GNUC__
#define PA_MIN(a,b) \
- __extension__ ({ typeof(a) _a = (a); \
+ __extension__ ({ \
+ typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})
@@ -111,7 +113,8 @@ static inline size_t pa_page_align(size_t l) {
#ifdef __GNUC__
#define PA_CLAMP(x, low, high) \
- __extension__ ({ typeof(x) _x = (x); \
+ __extension__ ({ \
+ typeof(x) _x = (x); \
typeof(low) _low = (low); \
typeof(high) _high = (high); \
((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
@@ -122,7 +125,8 @@ static inline size_t pa_page_align(size_t l) {
#ifdef __GNUC__
#define PA_CLAMP_UNLIKELY(x, low, high) \
- __extension__ ({ typeof(x) _x = (x); \
+ __extension__ ({ \
+ typeof(x) _x = (x); \
typeof(low) _low = (low); \
typeof(high) _high = (high); \
(PA_UNLIKELY(_x > _high) ? _high : (PA_UNLIKELY(_x < _low) ? _low : _x)); \
@@ -135,6 +139,28 @@ static inline size_t pa_page_align(size_t l) {
* make sense: we cannot know if it is more likely that the values is
* lower or greater than the boundaries.*/
+#ifdef __GNUC__
+#define PA_ROUND_UP(a, b) \
+ __extension__ ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ ((_a + _b - 1) / _b) * _b; \
+ })
+#else
+#define PA_ROUND_UP(a, b) ((((a) + (b) - 1) / (b)) * (b))
+#endif
+
+#ifdef __GNUC__
+#define PA_ROUND_DOWN(a, b) \
+ __extension__ ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ (_a / _b) * _b; \
+ })
+#else
+#define PA_ROUND_DOWN(a, b) (((a) / (b)) * (b))
+#endif
+
/* This type is not intended to be used in exported APIs! Use classic "int" there! */
#ifdef HAVE_STD_BOOL
typedef _Bool pa_bool_t;
commit 8f928b2e572cd7bf26517afddd62ceecb78edfdc
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Aug 17 19:17:10 2009 +0200
macro: simplify page/word alignment macros a bit
diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h
index aa06359..3c560bc 100644
--- a/src/pulsecore/macro.h
+++ b/src/pulsecore/macro.h
@@ -59,28 +59,24 @@
#endif
/* Rounds down */
-static inline void* pa_align_ptr(const void *p) {
- return (void*) (((size_t) p) & ~(sizeof(void*)-1));
+static inline void* PA_ALIGN_PTR(const void *p) {
+ return (void*) (((size_t) p) & ~(sizeof(void*) - 1));
}
-#define PA_ALIGN_PTR(x) (pa_align_ptr(x))
/* Rounds up */
-static inline size_t pa_align(size_t l) {
- return (((l + sizeof(void*) - 1) / sizeof(void*)) * sizeof(void*));
+static inline size_t PA_ALIGN(size_t l) {
+ return ((l + sizeof(void*) - 1) & ~(sizeof(void*) - 1));
}
-#define PA_ALIGN(x) (pa_align(x))
/* Rounds down */
-static inline void* pa_page_align_ptr(const void *p) {
- return (void*) (((size_t) p) & ~(PA_PAGE_SIZE-1));
+static inline void* PA_PAGE_ALIGN_PTR(const void *p) {
+ return (void*) (((size_t) p) & ~(PA_PAGE_SIZE - 1));
}
-#define PA_PAGE_ALIGN_PTR(x) (pa_page_align_ptr(x))
/* Rounds up */
-static inline size_t pa_page_align(size_t l) {
- return ((l + PA_PAGE_SIZE - 1) / PA_PAGE_SIZE) * PA_PAGE_SIZE;
+static inline size_t PA_PAGE_ALIGN(size_t l) {
+ return (l + PA_PAGE_SIZE - 1) & ~(PA_PAGE_SIZE - 1);
}
-#define PA_PAGE_ALIGN(x) (pa_page_align(x))
#define PA_ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list