summaryrefslogtreecommitdiffstats
path: root/nsxiv.h
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-07-30 10:05:10 +0200
committerNRK <nrk@disroot.org>2022-07-30 10:05:10 +0200
commit94d531fd827457cf71fe7f3808c7a2f531dceba5 (patch)
tree0ac8b2f178c83c0292a28aea7e6d73f451531a44 /nsxiv.h
parent6d8ec5aee31f8eff0288e598372ab94397741a03 (diff)
downloadnsxiv-94d531fd827457cf71fe7f3808c7a2f531dceba5.tar.zst
autoreload: simplify and cleanup (#342)
the current code is quite hacky and complex as it mixes multiple pointers. all of this complexity is unnecessary. drop it by introducing an explicit scratch buffer instead of implicitly abusing `arl->filename` as one. this also reduces some unnecessary allocation overhead. additionally, the argument to arl_setup must be the result of `realpath(3)` (as commented in `nsxiv.h`). instead of commenting it, assert it. and lastly, rename `arl_setup` to `arl_add` since it's not doing any "setup" but rather *adding* a file to watch. Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/342 Reviewed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
Diffstat (limited to 'nsxiv.h')
-rw-r--r--nsxiv.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/nsxiv.h b/nsxiv.h
index 4f903e9..7262e1e 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -124,12 +124,12 @@ struct arl {
int fd;
int wd_dir;
int wd_file;
- char *filename;
+ const char *filename;
};
void arl_init(arl_t*);
void arl_cleanup(arl_t*);
-void arl_setup(arl_t*, const char* /* result of realpath(3) */);
+void arl_add(arl_t*, const char* /* result of realpath(3) */);
bool arl_handle(arl_t*);