From 94d531fd827457cf71fe7f3808c7a2f531dceba5 Mon Sep 17 00:00:00 2001 From: NRK Date: Sat, 30 Jul 2022 10:05:10 +0200 Subject: 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 --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 87dfc14..12cf404 100644 --- a/main.c +++ b/main.c @@ -350,7 +350,7 @@ void load_image(int new) close_info(); open_info(); - arl_setup(&arl, files[fileidx].path); + arl_add(&arl, files[fileidx].path); title_dirty = true; if (img.multi.cnt > 0 && img.multi.animate) -- cgit v1.2.3-70-g09d2