From c6275374b03ac4526a46f255f33ae2f81003d52b Mon Sep 17 00:00:00 2001 From: N-R-K <79544946+N-R-K@users.noreply.github.com> Date: Sat, 20 Nov 2021 09:51:49 +0600 Subject: mark functions and vars as static (#146) the goal here to mark functions and variables not used outside the translation unit as static. main reason for this is cleanliness. however as a side-effect this can help compilers optimize better as it now has guarantee that a certain function won't be called outside of that translation unit. one other side-effect of this is that accessing these vars/function from config.h is now different. if one wants to access a static var/func from different translation unit in config.h, he would have to create a wrapper function under the right ifdef. for static functions one would also need to forward declare it. here's a dummy example of accessing the function `run_key_handler` from config.h under _MAPPINGS_CONFIG ``` static void run_key_handler(const char *, unsigned); bool send_with_ctrl(arg_t key) { run_key_handler(XKeysymToString(key), ControlMask); return false; } ``` --- autoreload_inotify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'autoreload_inotify.c') diff --git a/autoreload_inotify.c b/autoreload_inotify.c index 6bcbd04..87ce369 100644 --- a/autoreload_inotify.c +++ b/autoreload_inotify.c @@ -24,7 +24,7 @@ #include #include -union { +static union { char d[4096]; /* aligned buffer */ struct inotify_event e; } buf; -- cgit v1.2.3-54-g00ecf