aboutsummaryrefslogtreecommitdiff
path: root/swayidle/main.c
diff options
context:
space:
mode:
authorRyan Dwyer <RyanDwyer@users.noreply.github.com>2018-12-09 21:50:19 +1000
committerGitHub <noreply@github.com>2018-12-09 21:50:19 +1000
commitb61a936c8060bc4ac4320a5f76fd98b5042e5e41 (patch)
tree279a5554686d6e862282c943bda50787b69711e1 /swayidle/main.c
parente7efa0e27b7bf44217d7f147281d463708d2dfc9 (diff)
parent98c1e19466c0d83c8e1ca86eda5b273eda7eff3c (diff)
downloadsway-b61a936c8060bc4ac4320a5f76fd98b5042e5e41.tar.xz
Merge pull request #3271 from ianyfan/list-cleanup
list.c: Remove list_foreach
Diffstat (limited to 'swayidle/main.c')
-rw-r--r--swayidle/main.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/swayidle/main.c b/swayidle/main.c
index dd7d9de3..9a76e58c 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -365,11 +365,6 @@ static int parse_args(int argc, char *argv[]) {
return 0;
}
-static void register_zero_idle_timeout(void *item) {
- struct swayidle_timeout_cmd *cmd = item;
- register_timeout(cmd, 0);
-}
-
static int handle_signal(int sig, void *data) {
switch (sig) {
case SIGINT:
@@ -378,7 +373,9 @@ static int handle_signal(int sig, void *data) {
return 0;
case SIGUSR1:
wlr_log(WLR_DEBUG, "Got SIGUSR1");
- list_foreach(state.timeout_cmds, register_zero_idle_timeout);
+ for (int i = 0; i < state.timeout_cmds->length; ++i) {
+ register_timeout(state.timeout_cmds->items[i], 0);
+ }
return 1;
}
assert(false); // not reached
@@ -409,11 +406,6 @@ static int display_event(int fd, uint32_t mask, void *data) {
return count;
}
-static void register_idle_timeout(void *item) {
- struct swayidle_timeout_cmd *cmd = item;
- register_timeout(cmd, cmd->timeout);
-}
-
int main(int argc, char *argv[]) {
if (parse_args(argc, argv) != 0) {
return -1;
@@ -458,7 +450,10 @@ int main(int argc, char *argv[]) {
sway_terminate(0);
}
- list_foreach(state.timeout_cmds, register_idle_timeout);
+ for (int i = 0; i < state.timeout_cmds->length; ++i) {
+ struct swayidle_timeout_cmd *cmd = state.timeout_cmds->items[i];
+ register_timeout(cmd, cmd->timeout);
+ }
wl_display_roundtrip(state.display);