aboutsummaryrefslogtreecommitdiff
path: root/autoreload.c
diff options
context:
space:
mode:
authorkrolyxon <krolyxon@tutanota.com>2023-06-11 21:35:47 +0530
committerkrolyxon <krolyxon@tutanota.com>2023-06-11 21:35:47 +0530
commit723e140d5525cdc4572f5b859ec7b66433b5e32b (patch)
tree9fdbcabe7c41fc45f57ab17ad846de90f67f4d39 /autoreload.c
parente4380093d694f075e07f489e2c2e764785b441f2 (diff)
parentc03ec39437b473526080f496d6c8564e98bea1d7 (diff)
what the actual fuck?
Diffstat (limited to 'autoreload.c')
-rw-r--r--autoreload.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/autoreload.c b/autoreload.c
index 1c2fbf7..8b3f6da 100644
--- a/autoreload.c
+++ b/autoreload.c
@@ -28,7 +28,10 @@
#include <sys/inotify.h>
#include <unistd.h>
-static struct { char *buf; size_t len; } scratch;
+static struct {
+ char *buf;
+ size_t len;
+} scratch;
void arl_init(arl_t *arl)
{
@@ -94,7 +97,10 @@ bool arl_handle(arl_t *arl)
char *ptr;
const struct inotify_event *e;
/* inotify_event aligned buffer */
- static union { char d[4096]; struct inotify_event e; } buf;
+ static union {
+ char d[4096];
+ struct inotify_event e;
+ } buf;
while (true) {
ssize_t len = read(arl->fd, buf.d, sizeof(buf.d));
@@ -105,7 +111,7 @@ bool arl_handle(arl_t *arl)
break;
}
for (ptr = buf.d; ptr < buf.d + len; ptr += sizeof(*e) + e->len) {
- e = (const struct inotify_event*) ptr;
+ e = (const struct inotify_event *)ptr;
if (e->wd == arl->wd_file && (e->mask & IN_CLOSE_WRITE)) {
reload = true;
} else if (e->wd == arl->wd_file && (e->mask & IN_DELETE_SELF)) {
@@ -128,18 +134,18 @@ void arl_init(arl_t *arl)
void arl_cleanup(arl_t *arl)
{
- (void) arl;
+ (void)arl;
}
void arl_add(arl_t *arl, const char *filepath)
{
- (void) arl;
- (void) filepath;
+ (void)arl;
+ (void)filepath;
}
bool arl_handle(arl_t *arl)
{
- (void) arl;
+ (void)arl;
return false;
}