From 43232dea24ea6577a9824833992be005c0784dfa Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 18 Aug 2023 20:26:40 +0200 Subject: [PATCH] Add header guards, fixing issue #30 --- libs/arg.h | 3 +++ libs/conf/config.h | 3 +++ libs/draw.h | 3 +++ libs/draw/draw.h | 3 +++ libs/options.h | 3 +++ libs/regex/regex.h | 3 +++ libs/schemes.h | 3 +++ libs/wl/inc.h | 3 +++ libs/wl/init.h | 3 +++ libs/wl/wayland.h | 3 +++ libs/x11/client.h | 3 +++ libs/x11/clipboard.h | 3 +++ libs/x11/event.h | 3 +++ libs/x11/focus.h | 3 +++ libs/x11/inc.h | 3 +++ libs/x11/init.h | 3 +++ libs/x11/key.h | 3 +++ libs/x11/lib.h | 3 +++ libs/x11/mouse.h | 3 +++ libs/x11/xim.h | 3 +++ libs/x11/xrdb.h | 3 +++ libs/x11/xresources.h | 3 +++ 22 files changed, 66 insertions(+) diff --git a/libs/arg.h b/libs/arg.h index e0bf826..b81b8c0 100644 --- a/libs/arg.h +++ b/libs/arg.h @@ -1,3 +1,5 @@ +#ifndef ARG_H +#define ARG_H /* See LICENSE file for copyright and license details. */ typedef union { int i; // integer @@ -84,3 +86,4 @@ static void toggleimgtype(Arg *arg); static void selecthover(Arg *arg); static void outputhover(Arg *arg); static void markhover(Arg *arg); +#endif diff --git a/libs/conf/config.h b/libs/conf/config.h index 0bb9ce2..8f674b2 100644 --- a/libs/conf/config.h +++ b/libs/conf/config.h @@ -1,3 +1,5 @@ +#ifndef CONFIG_H +#define CONFIG_H /* See LICENSE file for copyright and license details. */ #if CONFIG #if X11 @@ -709,3 +711,4 @@ static void conf_init(void); static void theme_load(void); static int bind_init(void); #endif +#endif diff --git a/libs/draw.h b/libs/draw.h index b0d0c12..031563f 100644 --- a/libs/draw.h +++ b/libs/draw.h @@ -1,3 +1,5 @@ +#ifndef DRAW_H +#define DRAW_H /* See LICENSE file for copyright and license details. */ // declare functions @@ -10,3 +12,4 @@ static int drawmode(int x, int y, int w); static int drawcaps(int x, int y, int w); static int drawlarrow(int x, int y, int w); static int drawrarrow(int x, int y, int w); +#endif diff --git a/libs/draw/draw.h b/libs/draw/draw.h index 1425ea2..f218870 100644 --- a/libs/draw/draw.h +++ b/libs/draw/draw.h @@ -1,3 +1,5 @@ +#ifndef LIBDRAW +#define LIBDRAW /* See LICENSE file for copyright and license details. */ #include @@ -71,3 +73,4 @@ void draw_save_screen(Draw_t *draw, const char *file); /* Misc */ void draw_die(const char *fmt, ...); void *draw_calloc(size_t nmemb, size_t size); +#endif diff --git a/libs/options.h b/libs/options.h index 3b84b07..ee19cde 100644 --- a/libs/options.h +++ b/libs/options.h @@ -1,3 +1,5 @@ +#ifndef OPTIONS_H +#define OPTIONS_H /* See LICENSE file for copyright and license details. */ /* spmenu options */ @@ -284,3 +286,4 @@ static int incremental = 0; /* Print text every time a key is pr static int coloritems = 1; /* Color items (0/1) */ static int sgr = 1; /* Support SGR sequences (0/1) */ static char *worddelimiters = " /?\"&[]"; /* Word delimiters used for keybinds that change words, Space is default. */ +#endif diff --git a/libs/regex/regex.h b/libs/regex/regex.h index 69facc6..2896020 100644 --- a/libs/regex/regex.h +++ b/libs/regex/regex.h @@ -1,3 +1,5 @@ +#ifndef REGEX_H +#define REGEX_H /* * * Mini regex-module inspired by Rob Pike's regex code described in: @@ -63,3 +65,4 @@ int re_match(const char* pattern, const char* text, int* matchlength); #endif #endif /* ifndef _TINY_REGEX_C */ +#endif diff --git a/libs/schemes.h b/libs/schemes.h index 2d2203c..2832c7f 100644 --- a/libs/schemes.h +++ b/libs/schemes.h @@ -1,3 +1,5 @@ +#ifndef SCHEMES_H +#define SCHEMES_H /* See LICENSE file for copyright and license details. */ static char *textcolors[] = { @@ -260,3 +262,4 @@ static char *textcolors[] = { static char *txtcols[256]; static void init_appearance(void); +#endif diff --git a/libs/wl/inc.h b/libs/wl/inc.h index d18c822..edcb646 100644 --- a/libs/wl/inc.h +++ b/libs/wl/inc.h @@ -1,6 +1,9 @@ +#ifndef WL_INC_H +#define WL_INC_H /* See LICENSE file for copyright and license details. */ #if WAYLAND #include "wayland.h" #include "init.h" #endif +#endif diff --git a/libs/wl/init.h b/libs/wl/init.h index b6cb3c9..eeba90f 100644 --- a/libs/wl/init.h +++ b/libs/wl/init.h @@ -1,3 +1,6 @@ +#ifndef WL_INIT_H +#define WL_INIT_H /* See LICENSE file for copyright and license details. */ static void handle_wl(void); +#endif diff --git a/libs/wl/wayland.h b/libs/wl/wayland.h index 3f529ed..ad14ca9 100644 --- a/libs/wl/wayland.h +++ b/libs/wl/wayland.h @@ -1,3 +1,5 @@ +#ifndef WAYLAND_H +#define WAYLAND_H /* See LICENSE file for copyright and license details. */ #include @@ -221,3 +223,4 @@ struct wl_seat_listener seat_listener = { static const struct wl_buffer_listener buffer_listener = { .release = zero, }; +#endif diff --git a/libs/x11/client.h b/libs/x11/client.h index 3b052d8..d3dd6a8 100644 --- a/libs/x11/client.h +++ b/libs/x11/client.h @@ -1,3 +1,5 @@ +#ifndef CLIENT_H +#define CLIENT_H /* See LICENSE file for copyright and license details. */ static void hexconv(const char *hex, unsigned short *r, unsigned short *g, unsigned short *b); @@ -6,3 +8,4 @@ static void set_window_x11(void); static void set_prop_x11(void); static void resizeclient_x11(void); static void xinitvisual(void); +#endif diff --git a/libs/x11/clipboard.h b/libs/x11/clipboard.h index cc9a895..3faefb0 100644 --- a/libs/x11/clipboard.h +++ b/libs/x11/clipboard.h @@ -1,4 +1,7 @@ +#ifndef CLIPBOARD_H +#define CLIPBOARD_H /* See LICENSE file for copyright and license details. */ static void pastesel_x11(void); static int paste_x11(int sel); +#endif diff --git a/libs/x11/event.h b/libs/x11/event.h index 293650e..eb2058c 100644 --- a/libs/x11/event.h +++ b/libs/x11/event.h @@ -1,2 +1,5 @@ +#ifndef EVENT_H +#define EVENT_H /* See LICENSE file for copyright and license details. */ static void eventloop_x11(void); +#endif diff --git a/libs/x11/focus.h b/libs/x11/focus.h index 1ba9fc9..6cee27b 100644 --- a/libs/x11/focus.h +++ b/libs/x11/focus.h @@ -1,3 +1,6 @@ +#ifndef FOCUS_H +#define FOCUS_H /* See LICENSE file for copyright and license details. */ static void grabfocus_x11(void); +#endif diff --git a/libs/x11/inc.h b/libs/x11/inc.h index a3c0ff3..edbeb87 100644 --- a/libs/x11/inc.h +++ b/libs/x11/inc.h @@ -1,3 +1,5 @@ +#ifndef X_INC_H +#define X_INC_H /* See LICENSE file for copyright and license details. */ #if X11 #include "lib.h" @@ -11,3 +13,4 @@ #include "focus.h" #include "clipboard.h" #endif +#endif diff --git a/libs/x11/init.h b/libs/x11/init.h index 7372cb1..80b4a4f 100644 --- a/libs/x11/init.h +++ b/libs/x11/init.h @@ -1,3 +1,5 @@ +#ifndef X_INIT_H +#define X_INIT_H /* See LICENSE file for copyright and license details. */ #define CLEANMASK(mask) (mask & ~(x11.numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) @@ -13,3 +15,4 @@ static void handle_x11(void); static void cleanup_x11(Display *disp); static void prepare_window_size_x11(void); static Display * opendisplay_x11(char *disp); +#endif diff --git a/libs/x11/key.h b/libs/x11/key.h index ab6be00..5f2f225 100644 --- a/libs/x11/key.h +++ b/libs/x11/key.h @@ -1,3 +1,5 @@ +#ifndef KEY_H +#define KEY_H /* See LICENSE file for copyright and license details. */ typedef struct { @@ -23,3 +25,4 @@ static void getcapsstate(void); static Key ckeys[256]; static Key hkeys[1] = { { -1, Ctrl|Alt, XK_Delete, quit, {0} } }; +#endif diff --git a/libs/x11/lib.h b/libs/x11/lib.h index 9f1c4a2..11483bd 100644 --- a/libs/x11/lib.h +++ b/libs/x11/lib.h @@ -1,3 +1,5 @@ +#ifndef LIB_H +#define LIB_H /* See LICENSE file for copyright and license details. */ // include libraries @@ -18,3 +20,4 @@ #if XRESOURCES #include #endif +#endif diff --git a/libs/x11/mouse.h b/libs/x11/mouse.h index 629305b..deba1bf 100644 --- a/libs/x11/mouse.h +++ b/libs/x11/mouse.h @@ -1,3 +1,5 @@ +#ifndef MOUSE_H +#define MOUSE_H /* See LICENSE file for copyright and license details. */ typedef struct { @@ -9,3 +11,4 @@ typedef struct { static Mouse cbuttons[256]; static void buttonpress_x11(XEvent *e); +#endif diff --git a/libs/x11/xim.h b/libs/x11/xim.h index 826fa35..8e9d570 100644 --- a/libs/x11/xim.h +++ b/libs/x11/xim.h @@ -1,5 +1,8 @@ +#ifndef XIM_H +#define XIM_H /* See LICENSE file for copyright and license details. */ static XIC xic; static void open_xim(void); +#endif diff --git a/libs/x11/xrdb.h b/libs/x11/xrdb.h index a62e5fd..1de8433 100644 --- a/libs/x11/xrdb.h +++ b/libs/x11/xrdb.h @@ -1,3 +1,5 @@ +#ifndef XRDB_H +#define XRDB_H /* See LICENSE file for copyright and license details. */ #if XRESOURCES @@ -17,3 +19,4 @@ typedef struct { static void load_xresources(void); static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst); #endif +#endif diff --git a/libs/x11/xresources.h b/libs/x11/xresources.h index c2f6534..91aa9ad 100644 --- a/libs/x11/xresources.h +++ b/libs/x11/xresources.h @@ -1,3 +1,5 @@ +#ifndef XRESOURCES_H +#define XRESOURCES_H /* See LICENSE file for copyright and license details. */ // This .Xresources array is read and compared to the xrdb. Simply add to the array if you need to. @@ -58,3 +60,4 @@ ResourcePref cols[] = { { "color15", STRING, &col_sgr15 }, }; #endif +#endif