chiark / gitweb /
swap: introduce helper variable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Sep 2012 08:52:11 +0000 (10:52 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 29 Oct 2012 09:00:56 +0000 (09:00 +0000)
Just for readability, no funcational change.

src/core/swap.c

index c708b7fefa3dac8e5f65dc8e46b848077b90a1f2..7e1d4371c685045b228fadd689a45b9254cf23ea 100644 (file)
@@ -55,6 +55,7 @@ static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
 
 static void swap_unset_proc_swaps(Swap *s) {
         Swap *first;
 
 static void swap_unset_proc_swaps(Swap *s) {
         Swap *first;
+        Hashmap *swaps;
 
         assert(s);
 
 
         assert(s);
 
@@ -63,14 +64,17 @@ static void swap_unset_proc_swaps(Swap *s) {
 
         /* Remove this unit from the chain of swaps which share the
          * same kernel swap device. */
 
         /* Remove this unit from the chain of swaps which share the
          * same kernel swap device. */
-
-        first = hashmap_get(UNIT(s)->manager->swaps_by_proc_swaps, s->parameters_proc_swaps.what);
+        swaps = UNIT(s)->manager->swaps_by_proc_swaps;
+        first = hashmap_get(swaps, s->parameters_proc_swaps.what);
         LIST_REMOVE(Swap, same_proc_swaps, first, s);
 
         if (first)
         LIST_REMOVE(Swap, same_proc_swaps, first, s);
 
         if (first)
-                hashmap_remove_and_replace(UNIT(s)->manager->swaps_by_proc_swaps, s->parameters_proc_swaps.what, first->parameters_proc_swaps.what, first);
+                hashmap_remove_and_replace(swaps,
+                                           s->parameters_proc_swaps.what,
+                                           first->parameters_proc_swaps.what,
+                                           first);
         else
         else
-                hashmap_remove(UNIT(s)->manager->swaps_by_proc_swaps, s->parameters_proc_swaps.what);
+                hashmap_remove(swaps, s->parameters_proc_swaps.what);
 
         free(s->parameters_proc_swaps.what);
         s->parameters_proc_swaps.what = NULL;
 
         free(s->parameters_proc_swaps.what);
         s->parameters_proc_swaps.what = NULL;