aboutsummaryrefslogtreecommitdiffstats
path: root/window.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 /window.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 'window.c')
-rw-r--r--window.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/window.c b/window.c
index c8c3455..7a04270 100644
--- a/window.c
+++ b/window.c
@@ -63,7 +63,7 @@ static int barheight;
Atom atoms[ATOM_COUNT];
#if HAVE_LIBFONTS
-void win_init_font(const win_env_t *e, const char *fontstr)
+static void win_init_font(const win_env_t *e, const char *fontstr)
{
int fontheight = 0;
if ((font = XftFontOpenName(e->dpy, e->scr, fontstr)) == NULL)
@@ -74,21 +74,21 @@ void win_init_font(const win_env_t *e, const char *fontstr)
XftFontClose(e->dpy, font);
}
-void xft_alloc_color(const win_env_t *e, const char *name, XftColor *col)
+static void xft_alloc_color(const win_env_t *e, const char *name, XftColor *col)
{
if (!XftColorAllocName(e->dpy, e->vis, e->cmap, name, col))
error(EXIT_FAILURE, 0, "Error allocating color '%s'", name);
}
#endif /* HAVE_LIBFONTS */
-void win_alloc_color(const win_env_t *e, const char *name, XColor *col)
+static void win_alloc_color(const win_env_t *e, const char *name, XColor *col)
{
XColor screen;
if (!XAllocNamedColor(e->dpy, e->cmap, name, &screen, col))
error(EXIT_FAILURE, 0, "Error allocating color '%s'", name);
}
-const char* win_res(XrmDatabase db, const char *name, const char *def)
+static const char* win_res(XrmDatabase db, const char *name, const char *def)
{
char *type;
XrmValue ret;
@@ -396,8 +396,8 @@ void win_clear(win_t *win)
}
#if HAVE_LIBFONTS
-int win_draw_text(win_t *win, XftDraw *d, const XftColor *color, int x, int y,
- char *text, int len, int w)
+static int win_draw_text(win_t *win, XftDraw *d, const XftColor *color,
+ int x, int y, char *text, int len, int w)
{
int err, tw = 0;
char *t, *next;
@@ -430,7 +430,7 @@ int win_draw_text(win_t *win, XftDraw *d, const XftColor *color, int x, int y,
return tw;
}
-void win_draw_bar(win_t *win)
+static void win_draw_bar(win_t *win)
{
int len, x, y, w, tw;
win_env_t *e;
@@ -466,7 +466,7 @@ void win_draw_bar(win_t *win)
XftDrawDestroy(d);
}
#else
-void win_draw_bar(win_t *win){}
+static void win_draw_bar(win_t *win){}
#endif /* HAVE_LIBFONTS */
void win_draw(win_t *win)