Bug 47493 - protocol-native: XOR asserts are expressed in a roundabout way
Summary: protocol-native: XOR asserts are expressed in a roundabout way
Status: RESOLVED FIXED
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
URL:
Whiteboard:
Keywords: love
Depends on:
Blocks:
 
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:


Attachments

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
(http://lists.freedesktop.org/archives/pulseaudio-discuss/2013-November/019183.html)

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.