sd-device: optimize addition of already present matches
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 29 Apr 2020 12:33:51 +0000 (14:33 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 6 May 2020 15:01:33 +0000 (17:01 +0200)
commit2204f018cd788e7653741f52e601a007f4edb8cc
tree8da3b0cd55720cc48b67b39f4effdf275a544aef
parenteb1c1dc029c91750e6255c3fd844b4f4bf238fab
sd-device: optimize addition of already present matches

Our hashmap and set helpers return a different code whenever an entry
already exists, so let's use this to avoid unsetting scan_uptodate when
not necessary.

Thus, the return convention for
sd_device_enumerator_add_match_subsystem,
sd_device_enumerator_add_match_sysattr,
sd_device_enumerator_add_match_property,
sd_device_enumerator_add_match_sysname,
sd_device_enumerator_add_match_tag,
device_enumerator_add_match_parent_incremental,
sd_device_enumerator_add_match_parent,
sd_device_enumerator_allow_uninitialized,
device_enumerator_add_match_is_initialized
is that "1" is returned if action was taken, and "0" on noop.
src/libsystemd/sd-device/device-enumerator.c