diff options
author | N-R-K <79544946+N-R-K@users.noreply.github.com> | 2021-11-20 04:51:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-20 04:51:49 +0100 |
commit | c6275374b03ac4526a46f255f33ae2f81003d52b (patch) | |
tree | abe2682ade25671054b5981bf81f7e1b67158129 /thumbs.c | |
parent | 43fcd2e02e113a55f673f266ad28b53858500022 (diff) | |
download | nsxiv-c6275374b03ac4526a46f255f33ae2f81003d52b.tar.zst |
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;
}
```
Diffstat (limited to 'thumbs.c')
-rw-r--r-- | thumbs.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -38,7 +38,7 @@ Imlib_Image img_open(const fileinfo_t*); static char *cache_dir; extern const int fileidx; -char* tns_cache_filepath(const char *filepath) +static char* tns_cache_filepath(const char *filepath) { size_t len; char *cfile = NULL; @@ -55,7 +55,7 @@ char* tns_cache_filepath(const char *filepath) return cfile; } -Imlib_Image tns_cache_load(const char *filepath, bool *outdated) +static Imlib_Image tns_cache_load(const char *filepath, bool *outdated) { char *cfile; struct stat cstats, fstats; @@ -76,7 +76,7 @@ Imlib_Image tns_cache_load(const char *filepath, bool *outdated) return im; } -void tns_cache_write(Imlib_Image im, const char *filepath, bool force) +static void tns_cache_write(Imlib_Image im, const char *filepath, bool force) { char *cfile, *dirend; struct stat cstats, fstats; @@ -200,7 +200,7 @@ CLEANUP void tns_free(tns_t *tns) cache_dir = NULL; } -Imlib_Image tns_scale_down(Imlib_Image im, int dim) +static Imlib_Image tns_scale_down(Imlib_Image im, int dim) { int w, h; float z, zw, zh; @@ -374,7 +374,7 @@ void tns_unload(tns_t *tns, int n) } } -void tns_check_view(tns_t *tns, bool scrolled) +static void tns_check_view(tns_t *tns, bool scrolled) { int r; |