summaryrefslogtreecommitdiff
path: root/src/swap.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-01-15 12:37:16 +0100
committerMichal Schmidt <mschmidt@redhat.com>2012-01-16 13:34:42 +0100
commit595ed347a87e69893c5e72168fc2e94a7cb09e73 (patch)
treec0e9270f001c289c429d4f239b41ac60df75d21b /src/swap.c
parent1124fe6f01b1d59d016c238026f20380f38d98dc (diff)
unit: use safe downcasts, remove pointless casts
Always use the macros for downcasting. Remove a few obviously pointless casts.
Diffstat (limited to 'src/swap.c')
-rw-r--r--src/swap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/swap.c b/src/swap.c
index ff62b1dc4b..b4a5b3c084 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -157,7 +157,7 @@ static int swap_add_mount_links(Swap *s) {
assert(s);
LIST_FOREACH(units_by_type, other, UNIT(s)->manager->units_by_type[UNIT_MOUNT])
- if ((r = swap_add_one_mount_link(s, (Mount*) other)) < 0)
+ if ((r = swap_add_one_mount_link(s, MOUNT(other))) < 0)
return r;
return 0;
@@ -1096,7 +1096,7 @@ int swap_dispatch_reload(Manager *m) {
}
int swap_fd_event(Manager *m, int events) {
- Unit *meta;
+ Unit *u;
int r;
assert(m);
@@ -1106,8 +1106,8 @@ int swap_fd_event(Manager *m, int events) {
log_error("Failed to reread /proc/swaps: %s", strerror(-r));
/* Reset flags, just in case, for late calls */
- LIST_FOREACH(units_by_type, meta, m->units_by_type[UNIT_SWAP]) {
- Swap *swap = (Swap*) meta;
+ LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_SWAP]) {
+ Swap *swap = SWAP(u);
swap->is_active = swap->just_activated = false;
}
@@ -1117,8 +1117,8 @@ int swap_fd_event(Manager *m, int events) {
manager_dispatch_load_queue(m);
- LIST_FOREACH(units_by_type, meta, m->units_by_type[UNIT_SWAP]) {
- Swap *swap = (Swap*) meta;
+ LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_SWAP]) {
+ Swap *swap = SWAP(u);
if (!swap->is_active) {
/* This has just been deactivated */