[pulseaudio-tickets] [Bug 47493] New: protocol-native: XOR asserts are expressed in a roundabout way

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Mar 19 01:59:26 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=47493

             Bug #: 47493
           Summary: protocol-native: XOR asserts are expressed in a
                    roundabout way
    Classification: Unclassified
           Product: PulseAudio
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: love
          Severity: normal
          Priority: medium
         Component: core
        AssignedTo: pulseaudio-bugs at lists.freedesktop.org
        ReportedBy: arun at accosted.net
         QAContact: pulseaudio-bugs at lists.freedesktop.org
                CC: lennart at poettering.net


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. :)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the pulseaudio-bugs mailing list