From b42c4231cba59cda60c406feb04c99c7efaff338 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 19 Apr 2019 09:24:56 +0200 Subject: [PATCH] Add header guards Signed-off-by: DL6ER --- FTL.h | 4 ++++ Makefile | 5 ++++- api.h | 4 ++++ dnsmasq_interface.h | 5 +++++ routines.h | 6 ++++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/FTL.h b/FTL.h index adee6061..9ee3e052 100644 --- a/FTL.h +++ b/FTL.h @@ -7,6 +7,8 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ +#ifndef FTL_H +#define FTL_H #define __USE_XOPEN #define _GNU_SOURCE @@ -322,3 +324,5 @@ clientsData* _getClient(int clientID, bool checkMagic, int line, const char * fu domainsData* _getDomain(int domainID, bool checkMagic, int line, const char * function, const char * file); #define getForward(forwardID, checkMagic) _getForward(forwardID, checkMagic, __LINE__, __FUNCTION__, __FILE__) forwardedData* _getForward(int forwardID, bool checkMagic, int line, const char * function, const char * file); + +#endif // FTL_H diff --git a/Makefile b/Makefile index 009e18f0..815f398d 100644 --- a/Makefile +++ b/Makefile @@ -141,11 +141,14 @@ clean: version~: force @echo '$(GIT_BRANCH) $(GIT_VERSION) $(GIT_DATE) $(GIT_TAG)' | cmp -s - $@ || echo '$(GIT_BRANCH) $(GIT_VERSION) $(GIT_DATE) $(GIT_TAG)' > $@ version.h: version~ - @echo '#define GIT_VERSION "$(GIT_VERSION)"' > "$@" + @echo '#ifndef VERSION_H' > "$@" + @echo '#define VERSION_H' >> "$@" + @echo '#define GIT_VERSION "$(GIT_VERSION)"' >> "$@" @echo '#define GIT_DATE "$(GIT_DATE)"' >> "$@" @echo '#define GIT_BRANCH "$(GIT_BRANCH)"' >> "$@" @echo '#define GIT_TAG "$(GIT_TAG)"' >> "$@" @echo '#define GIT_HASH "$(GIT_HASH)"' >> "$@" + @echo '#endif // VERSION_H' >> "$@" @echo "Making FTL version on branch $(GIT_BRANCH) - $(GIT_VERSION) ($(GIT_DATE))" prefix=/usr diff --git a/api.h b/api.h index c329342d..3f04a802 100644 --- a/api.h +++ b/api.h @@ -7,6 +7,8 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ +#ifndef API_H +#define API_H // Statistic methods void getStats(const int *sock); @@ -42,3 +44,5 @@ void pack_float(const int sock, const float value); bool pack_fixstr(const int sock, const char *string); bool pack_str32(const int sock, const char *string); void pack_map16_start(const int sock, const uint16_t length); + +#endif // API_H diff --git a/dnsmasq_interface.h b/dnsmasq_interface.h index 87a65469..77437552 100644 --- a/dnsmasq_interface.h +++ b/dnsmasq_interface.h @@ -7,6 +7,9 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ +#ifndef DNSMASQ_INTERFACE_H +#define DNSMASQ_INTERFACE_H + extern int socketfd, telnetfd4, telnetfd6; extern unsigned char* pihole_privacylevel; enum { TCP, UDP }; @@ -38,3 +41,5 @@ void _FTL_upstream_error(const unsigned int rcode, const int id, const char* fil void FTL_dnsmasq_reload(void); void FTL_fork_and_bind_sockets(struct passwd *ent_pw); int FTL_listsfile(const char* filename, unsigned int index, FILE *f, int cache_size, struct crec **rhash, int hashsz); + +#endif // DNSMASQ_INTERFACE_H diff --git a/routines.h b/routines.h index 45370413..6acbc385 100644 --- a/routines.h +++ b/routines.h @@ -7,7 +7,10 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ +#ifndef ROUTINES_H +#define ROUTINES_H +// daemon.c void go_daemon(void); void timer_start(const int i); double timer_elapsed_msec(const int i); @@ -16,6 +19,7 @@ void savepid(void); char * getUserName(void); void removepid(void); +// log.c void open_FTL_log(const bool test); void logg(const char* format, ...) __attribute__ ((format (gnu_printf, 1, 2))); void log_counter_info(void); @@ -150,3 +154,5 @@ bool check_capabilities(void); bool create_network_table(void); void parse_arp_cache(void); void updateMACVendorRecords(void); + +#endif // ROUTINES_H