]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: remove unneeded comparison for hashmap_remove_value
authorMike Yuan <me@yhndnzj.com>
Sat, 11 Nov 2023 07:53:38 +0000 (15:53 +0800)
committerMike Yuan <me@yhndnzj.com>
Sat, 11 Nov 2023 09:21:10 +0000 (17:21 +0800)
hashmap_remove_value returns NULL if the value in the hashmap doesn't
match with the one provided by the caller.

src/core/unit.c

index 60f461bbfdb63273e3defce37fd761395bceb029..d9d23106b88412e7128c9ecae6cc0ab539f286c2 100644 (file)
@@ -2944,7 +2944,7 @@ void unit_unwatch_pidref(Unit *u, PidRef *pid) {
 
         if (uu == u)
                 /* OK, we are in the first table. Let's remove it there then, and we are done already. */
-                assert_se(hashmap_remove_value(u->manager->watch_pids, pid2, uu) == uu);
+                assert_se(hashmap_remove_value(u->manager->watch_pids, pid2, uu));
         else {
                 /* We weren't in the first table, then let's consult the 2nd table that points to an array */
                 PidRef *pid3 = NULL;
@@ -2962,7 +2962,7 @@ void unit_unwatch_pidref(Unit *u, PidRef *pid) {
 
                 if (m == 0) {
                         /* The array is now empty, remove the entire entry */
-                        assert_se(hashmap_remove_value(u->manager->watch_pids_more, pid3, array) == array);
+                        assert_se(hashmap_remove_value(u->manager->watch_pids_more, pid3, array));
                         free(array);
                 } else {
                         /* The array is not empty, but let's make sure the entry is not keyed by the PidRef