]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-device/device-enumerator.c
sd-device: simplify enumerator hacks
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 17 Apr 2015 12:06:31 +0000 (14:06 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 17 Apr 2015 13:22:13 +0000 (15:22 +0200)
commit18ae3d98d97ca35da106f66f547bce64b4be31ee
treee9dfae626b3e19b0d85c450c89f81ec57e1da4f0
parent08232a020bd2571088d3ee06dda07732c5e963d1
sd-device: simplify enumerator hacks

Boolean arithmetic is great, use it!

    if (a && !b)
      return 1;
    if (!a && b)
      return -1,

is equivalent to

    if (a != b)
      return a - b;

Furthermore:

    r = false;
    if (condition)
        r = true;

is equivalent to:

    r = condition;
src/libsystemd/sd-device/device-enumerator.c