Bug 47493 - protocol-native: XOR asserts are expressed in a roundabout way
Summary: protocol-native: XOR asserts are expressed in a roundabout way
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Parin Porecha
QA Contact: pulseaudio-bugs
Keywords: love
Depends on:
Reported: 2012-03-19 01:59 UTC by Arun Raghavan
Modified: 2013-11-20 07:12 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description Arun Raghavan 2012-03-19 01:59:26 UTC
protocol-native.c has a bunch of asserts like this ...

CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX || name, tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, idx == PA_INVALID_INDEX || !name, tag, PA_ERR_INVALID);
CHECK_VALIDITY(c->pstream, !name || idx == PA_INVALID_INDEX, tag, PA_ERR_INVALID);

... that could be written as a single, more readable, XOR like this ...

CHECK_VALIDITY(c->pstream, (idx != PA_INVALID_INDEX) ^ (name != NULL), tag, PA_ERR_INVALID);

Ergo, we should do this. :)
Comment 1 Parin Porecha 2013-11-19 15:31:48 UTC
I've mailed the patch for this bug on the pulseaudio-discuss mailing list

Please review it

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.