From 3724d3fc17dc6135a05608cab5bdf00c6978282d Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Wed, 17 May 2017 20:07:32 +0200 Subject: Revised autoreload interface Make the header only contain the public interface and nothing from the implementation. All functions get a handle to their self object, like the img_ and tns_ and win_ functions. All necessary data (file path) is also passed as an argument, so that no extern redeclarations are needed. Make arl_setup_dir() private, it's not called outside the module. Make arl_handle() return true if the file has changed, so that the reloading of the file can be done by the caller. --- autoreload.h | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'autoreload.h') diff --git a/autoreload.h b/autoreload.h index 439b695..6a3053c 100644 --- a/autoreload.h +++ b/autoreload.h @@ -21,23 +21,15 @@ #include "types.h" -void arl_cleanup(void); -void arl_handle(void); -void arl_init(void); -void arl_setup(void); -void arl_setup_dir(void); - typedef struct { int fd; int wd; bool watching_dir; -} autoreload_t; - -extern autoreload_t autoreload; -extern int fileidx; -extern fileinfo_t *files; +} arl_t; -void load_image(int); -void redraw(void); +void arl_cleanup(arl_t*); +bool arl_handle(arl_t*, const char*); +void arl_init(arl_t*); +void arl_setup(arl_t*, const char*); #endif /* AUTORELOAD_H */ -- cgit v1.2.3-54-g00ecf