aboutsummaryrefslogtreecommitdiffstats
path: root/autoreload_inotify.c
diff options
context:
space:
mode:
authorBerke Kocaoğlu <berke.kocaoglu@metu.edu.tr>2021-10-11 05:07:18 +0200
committerGitHub <noreply@github.com>2021-10-11 05:07:18 +0200
commit1449bfc5e960a61438c60a67c28da6d7c5bf2c7f (patch)
tree8836a07412b26650aa5773bd6ccf9d1a474553d6 /autoreload_inotify.c
parent675db4bbb646ff51cc3ecc8ba7d587670872580a (diff)
downloadnsxiv-1449bfc5e960a61438c60a67c28da6d7c5bf2c7f.tar.zst
code-style: fix consistency issues all over the codebase (#94)
* remove duplicate comment * remove empty tabs and blank lines * move macros and globals ontop * comment to seprate function implementation * fix alignment * switch to *argv[] similar to other suckless code * kill all empty last lines * append comment to endif * reuse existing ARRLEN macro * comment fall through * use while (true) everywhere Co-authored-by: NRK <nrk@disroot.org>
Diffstat (limited to 'autoreload_inotify.c')
-rw-r--r--autoreload_inotify.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/autoreload_inotify.c b/autoreload_inotify.c
index 7982e0d..6bcbd04 100644
--- a/autoreload_inotify.c
+++ b/autoreload_inotify.c
@@ -24,6 +24,11 @@
#include <unistd.h>
#include <sys/inotify.h>
+union {
+ char d[4096]; /* aligned buffer */
+ struct inotify_event e;
+} buf;
+
void arl_init(arl_t *arl)
{
arl->fd = inotify_init1(IN_CLOEXEC | IN_NONBLOCK);
@@ -76,18 +81,13 @@ void arl_setup(arl_t *arl, const char *filepath)
}
}
-union {
- char d[4096]; /* aligned buffer */
- struct inotify_event e;
-} buf;
-
bool arl_handle(arl_t *arl)
{
bool reload = false;
char *ptr;
const struct inotify_event *e;
- for (;;) {
+ while (true) {
ssize_t len = read(arl->fd, buf.d, sizeof(buf.d));
if (len == -1) {
@@ -109,4 +109,3 @@ bool arl_handle(arl_t *arl)
}
return reload;
}
-