]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: rename a few more vars for unit_next_freezer_state()
authorMike Yuan <me@yhndnzj.com>
Wed, 17 Jul 2024 15:34:16 +0000 (17:34 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 17 Jul 2024 16:14:31 +0000 (18:14 +0200)
src/core/unit.c
src/core/unit.h

index 241f09bf5ab116cbbde33d4c4ec1fc7451292edb..999e690a329dd68cd316197ca39266665adfb6cc 100644 (file)
@@ -6156,13 +6156,13 @@ bool unit_can_isolate_refuse_manual(Unit *u) {
         return unit_can_isolate(u) && !u->refuse_manual_start;
 }
 
-void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, FreezerState *ret_objective) {
-        FreezerState curr, parent, next, objective;
+void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret_next, FreezerState *ret_objective) {
+        FreezerState current, parent, next, objective;
 
         assert(u);
         assert(action >= 0);
         assert(action < _FREEZER_ACTION_MAX);
-        assert(ret);
+        assert(ret_next);
         assert(ret_objective);
 
         /* This function determines the correct freezer state transitions for a unit
@@ -6170,7 +6170,7 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, F
          * which is either FREEZER_FROZEN or FREEZER_RUNNING, depending on what actual state we
          * ultimately want to achieve. */
 
-        curr = u->freezer_state;
+        current = u->freezer_state;
 
         Unit *slice = UNIT_GET_SLICE(u);
         if (slice)
@@ -6182,7 +6182,7 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, F
 
         case FREEZER_FREEZE:
                 /* We always "promote" a freeze initiated by parent into a normal freeze */
-                if (IN_SET(curr, FREEZER_FROZEN, FREEZER_FROZEN_BY_PARENT))
+                if (IN_SET(current, FREEZER_FROZEN, FREEZER_FROZEN_BY_PARENT))
                         next = FREEZER_FROZEN;
                 else
                         next = FREEZER_FREEZING;
@@ -6192,15 +6192,15 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, F
                 /* Thawing is the most complicated operation here, because we can't thaw a unit
                  * if its parent is frozen. So we instead "demote" a normal freeze into a freeze
                  * initiated by parent if the parent is frozen */
-                if (IN_SET(curr, FREEZER_RUNNING, FREEZER_THAWING,
+                if (IN_SET(current, FREEZER_RUNNING, FREEZER_THAWING,
                                  FREEZER_FREEZING_BY_PARENT, FREEZER_FROZEN_BY_PARENT)) /* Should usually be refused by unit_freezer_action */
-                        next = curr;
-                else if (curr == FREEZER_FREEZING) {
+                        next = current;
+                else if (current == FREEZER_FREEZING) {
                         if (IN_SET(parent, FREEZER_RUNNING, FREEZER_THAWING))
                                 next = FREEZER_THAWING;
                         else
                                 next = FREEZER_FREEZING_BY_PARENT;
-                } else if (curr == FREEZER_FROZEN) {
+                } else if (current == FREEZER_FROZEN) {
                         if (IN_SET(parent, FREEZER_RUNNING, FREEZER_THAWING))
                                 next = FREEZER_THAWING;
                         else
@@ -6211,8 +6211,8 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, F
 
         case FREEZER_PARENT_FREEZE:
                 /* We need to avoid accidentally demoting units frozen manually */
-                if (IN_SET(curr, FREEZER_FREEZING, FREEZER_FROZEN, FREEZER_FROZEN_BY_PARENT))
-                        next = curr;
+                if (IN_SET(current, FREEZER_FREEZING, FREEZER_FROZEN, FREEZER_FROZEN_BY_PARENT))
+                        next = current;
                 else
                         next = FREEZER_FREEZING_BY_PARENT;
                 break;
@@ -6220,8 +6220,8 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, F
         case FREEZER_PARENT_THAW:
                 /* We don't want to thaw units from a parent if they were frozen
                  * manually, so for such units this action is a no-op */
-                if (IN_SET(curr, FREEZER_RUNNING, FREEZER_FREEZING, FREEZER_FROZEN))
-                        next = curr;
+                if (IN_SET(current, FREEZER_RUNNING, FREEZER_FREEZING, FREEZER_FROZEN))
+                        next = current;
                 else
                         next = FREEZER_THAWING;
                 break;
@@ -6235,7 +6235,7 @@ void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret, F
                 objective = FREEZER_FROZEN;
         assert(IN_SET(objective, FREEZER_RUNNING, FREEZER_FROZEN));
 
-        *ret = next;
+        *ret_next = next;
         *ret_objective = objective;
 }
 
index a55754ad485271b9d9b42c7c34ea1632adb58079..9c8dbcf12a0a7dc4c211ac3f821f226a87649197 100644 (file)
@@ -1038,7 +1038,7 @@ bool unit_can_isolate_refuse_manual(Unit *u);
 
 bool unit_can_freeze(const Unit *u);
 int unit_freezer_action(Unit *u, FreezerAction action);
-void unit_next_freezer_state(Unit *u, FreezerAction a, FreezerState *ret, FreezerState *ret_objective);
+void unit_next_freezer_state(Unit *u, FreezerAction action, FreezerState *ret_next, FreezerState *ret_objective);
 void unit_frozen(Unit *u);
 void unit_thawed(Unit *u);