summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorN-R-K <79544946+N-R-K@users.noreply.github.com>2021-11-20 04:51:49 +0100
committerGitHub <noreply@github.com>2021-11-20 04:51:49 +0100
commitc6275374b03ac4526a46f255f33ae2f81003d52b (patch)
treeabe2682ade25671054b5981bf81f7e1b67158129 /image.c
parent43fcd2e02e113a55f673f266ad28b53858500022 (diff)
downloadnsxiv-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 'image.c')
-rw-r--r--image.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/image.c b/image.c
index 2926a1f..a4183b9 100644
--- a/image.c
+++ b/image.c
@@ -114,7 +114,7 @@ void exif_auto_orientate(const fileinfo_t *file)
#endif
#if HAVE_LIBGIF
-bool img_load_gif(img_t *img, const fileinfo_t *file)
+static bool img_load_gif(img_t *img, const fileinfo_t *file)
{
GifFileType *gif;
GifRowType *rows = NULL;
@@ -295,7 +295,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
#if HAVE_LIBWEBP
-bool is_webp(const char *path)
+static bool is_webp(const char *path)
{
/* The size (in bytes) of the largest amount of data required to verify a WebP image. */
enum { max = 30 };
@@ -316,7 +316,7 @@ bool is_webp(const char *path)
* x NULL = load the first frame as an Imlib_Image
* NULL x = load all frames into img->multi.
*/
-bool img_load_webp(const fileinfo_t *file, Imlib_Image *fframe, img_t *img)
+static bool img_load_webp(const fileinfo_t *file, Imlib_Image *fframe, img_t *img)
{
FILE *webp_file;
WebPData data;
@@ -507,7 +507,7 @@ CLEANUP void img_close(img_t *img, bool decache)
}
}
-void img_check_pan(img_t *img, bool moved)
+static void img_check_pan(img_t *img, bool moved)
{
win_t *win;
float w, h, ox, oy;
@@ -535,7 +535,7 @@ void img_check_pan(img_t *img, bool moved)
img->dirty = true;
}
-bool img_fit(img_t *img)
+static bool img_fit(img_t *img)
{
float z, zw, zh;
@@ -723,7 +723,7 @@ bool img_pos(img_t *img, float x, float y)
}
}
-bool img_move(img_t *img, float dx, float dy)
+static bool img_move(img_t *img, float dx, float dy)
{
return img_pos(img, img->x + dx, img->y + dy);
}
@@ -873,7 +873,7 @@ bool img_change_gamma(img_t *img, int d)
}
}
-bool img_frame_goto(img_t *img, int n)
+static bool img_frame_goto(img_t *img, int n)
{
if (n < 0 || n >= img->multi.cnt || n == img->multi.sel)
return false;