Commit a0c11d92 authored by Jan Včelák's avatar Jan Včelák 🚀

Use #pragma once as include guards

This Is Pragmaaa!
parent f9dd565f
......@@ -27,8 +27,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef TAP_BASIC_H
#define TAP_BASIC_H 1
#pragma once
#include "macros.h"
#include <stdarg.h> /* va_list */
......@@ -131,5 +130,3 @@ char *test_tmpdir(void)
void test_tmpdir_free(char *path);
END_DECLS
#endif /* TAP_BASIC_H */
......@@ -25,8 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef TAP_FLOAT_H
#define TAP_FLOAT_H 1
#pragma once
#include "macros.h"
......@@ -38,5 +37,3 @@ void is_double(double wanted, double seen, double epsilon,
__attribute__((__format__(printf, 4, 5)));
END_DECLS
#endif /* TAP_FLOAT_H */
......@@ -29,8 +29,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#ifndef TAP_MACROS_H
#define TAP_MACROS_H 1
#pragma once
/*
* __attribute__ is available in gcc 2.5 and later, but only with gcc 2.7
......@@ -84,5 +83,3 @@
# define BEGIN_DECLS /* empty */
# define END_DECLS /* empty */
#endif
#endif /* TAP_MACROS_H */
......@@ -27,8 +27,7 @@
* @{
*/
#ifndef _KNOTD_COMMON__BASE32HEX_H_
#define _KNOTD_COMMON__BASE32HEX_H_
#pragma once
#include <stdint.h> // uint8_t
......@@ -110,6 +109,4 @@ int32_t base32hex_decode_alloc(const uint8_t *in,
const uint32_t in_len,
uint8_t **out);
#endif // _KNOTD_COMMON__BASE32HEX_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_COMMON__BASE64_H_
#define _KNOTD_COMMON__BASE64_H_
#pragma once
#include <stdint.h> // uint8_t
......@@ -107,6 +106,4 @@ int32_t base64_decode_alloc(const uint8_t *in,
const uint32_t in_len,
uint8_t **out);
#endif // _KNOTD_COMMON__BASE64_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef __CRC_H__
#define __CRC_H__
#pragma once
#include <zlib.h>
#include <stdint.h>
......@@ -75,7 +74,4 @@ static inline crc_t crc_finalize(crc_t crc)
return crc;
}
#endif /* __CRC_H__ */
/*! @} */
......@@ -26,8 +26,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_DEBUG_H_
#define _KNOT_DEBUG_H_
#pragma once
#include <stdint.h>
#include <stdio.h>
......@@ -724,6 +723,4 @@
/******************************************************************************/
#endif /* _KNOT_DEBUG_H_ */
/*! @} */
......@@ -23,8 +23,7 @@
* @{
*/
#ifndef _KNOT_DESCRIPTOR_H_
#define _KNOT_DESCRIPTOR_H_
#pragma once
#include <stdint.h> // uint16_t
#include <stdio.h> // size_t
......@@ -299,6 +298,4 @@ int knot_rrtype_is_ddns_forbidden(const uint16_t type);
*/
int knot_rrtype_additional_needed(const uint16_t type);
#endif // _KNOT_DESCRIPTOR_H_
/*! @} */
......@@ -25,8 +25,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOTD_COMMON_ERRCODE_H_
#define _KNOTD_COMMON_ERRCODE_H_
#pragma once
#include "common/errors.h"
......@@ -160,6 +159,4 @@ static inline const char *knot_strerror(int code)
*/
#define knot_map_errno(err...) map_errno(KNOT_ERROR, err);
#endif /* _KNOTD_COMMON_ERRCODE_H_ */
/*! @} */
......@@ -25,8 +25,7 @@
* @{
*/
#ifndef _KNOTD_COMMON_ERROR_H_
#define _KNOTD_COMMON_ERROR_H_
#pragma once
#include <errno.h>
......@@ -75,6 +74,4 @@ const char *error_to_str(const error_table_t *table, int code);
*/
int _map_errno(int fallback_value, int arg0, ...);
#endif /* _KNOTD_COMMON_ERROR_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_COMMON_EVSCHED_H_
#define _KNOTD_COMMON_EVSCHED_H_
#pragma once
#include <pthread.h>
#include <stdbool.h>
......@@ -177,6 +176,4 @@ event_t* evsched_begin_process(evsched_t *sched);
*/
int evsched_end_process(evsched_t *sched);
#endif /* _KNOTD_COMMON_EVSCHED_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_FDSET_H_
#define _KNOTD_FDSET_H_
#pragma once
#include <stddef.h>
#include <poll.h>
......@@ -133,6 +132,4 @@ int fdset_pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *timeout, const sigset_t *sigmask);
#endif /* _KNOTD_FDSET_H_ */
/*! @} */
......@@ -25,8 +25,7 @@
* @{
*/
#ifndef _GETLINE_H_
#define _GETLINE_H_
#pragma once
#include <stdio.h>
#include <sys/types.h>
......@@ -46,6 +45,4 @@
*/
ssize_t knot_getline(char **lineptr, size_t *n, FILE *stream);
#endif // _GETLINE_H_
/*! @} */
......@@ -15,8 +15,7 @@
*
*/
#ifndef HATTRIE_HATTRIE_H
#define HATTRIE_HATTRIE_H
#pragma once
#ifdef __cplusplus
extern "C" {
......@@ -91,5 +90,3 @@ value_t* hattrie_iter_val (hattrie_iter_t*);
#ifdef __cplusplus
}
#endif
#endif
#ifndef MURMURHASH3_H
#define MURMURHASH3_H
#pragma once
#include <stdlib.h>
#include <stdint.h>
uint32_t hash(const char* data, size_t len);
#endif
......@@ -25,8 +25,7 @@
* @{
*/
#ifndef _HEAP_H_
#define _HEAP_H_
#pragma once
typedef void* heap_val_t;
......@@ -51,6 +50,4 @@ int heap_find(struct heap *, void *);
void heap_delete(struct heap *, int);
#endif /* _HEAP_H_ */
/*! @} */
......@@ -25,8 +25,7 @@
* @{
*/
#ifndef _KNOT_COMMON_HEX_H_
#define _KNOT_COMMON_HEX_H_
#pragma once
#include <stdint.h>
#include <stdlib.h>
......@@ -42,5 +41,4 @@
*/
int hex_decode(const char *input, uint8_t **output, size_t *output_size);
#endif // _KNOT_COMMON_HEX_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_HHTABLE_H_
#define _KNOTD_HHTABLE_H_
#pragma once
#include <stdlib.h>
#include <stdint.h>
......@@ -192,6 +191,4 @@ const char *hhash_iter_key (hhash_iter_t*, uint16_t* len);
/*! \brief Return current value. */
value_t *hhash_iter_val(hhash_iter_t*);
#endif /* _KNOTD_HHTABLE_H_ */
/*! @} */
......@@ -21,8 +21,7 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#ifndef _BIRD_LISTS_H_
#define _BIRD_LISTS_H_
#pragma once
/*
* I admit the list structure is very tricky and also somewhat awkward,
......@@ -107,5 +106,3 @@ bool ptrlist_contains(list_t *, const void *);
#endif
*/
#define LIST_INLINE
#endif
......@@ -30,8 +30,7 @@
* @{
*/
#ifndef _KNOTD_LOG_H_
#define _KNOTD_LOG_H_
#pragma once
/*
*/
......@@ -215,6 +214,4 @@ void hex_log(int source, const char *data, int length);
*/
int log_update_privileges(int uid, int gid);
#endif /* _KNOTD_LOG_H_ */
/*! @} */
......@@ -14,8 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KNOT_COMMON_MEMDUP
#define KNOT_COMMON_MEMDUP
#pragma once
#include <stdint.h>
#include <stdlib.h>
......@@ -30,5 +29,3 @@ static uint8_t *knot_memdup(const uint8_t *data, size_t data_size)
return memcpy(result, data, data_size);
}
#endif // KNOT_COMMON_MEMDUP
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_COMMON_MALLOC_H_
#define _KNOTD_COMMON_MALLOC_H_
#pragma once
#include <stddef.h>
......@@ -123,6 +122,4 @@ void usage_dump();
/*! \brief Trim excess heap memory. */
void mem_trim(void);
#endif // _KNOTD_COMMON_MALLOC_H_
/*! @} */
......@@ -8,8 +8,7 @@
* of the GNU Lesser General Public License.
*/
#ifndef _UCW_POOLS_H
#define _UCW_POOLS_H
#pragma once
#include <string.h>
#include <stdint.h>
......@@ -341,5 +340,3 @@ static inline void *mp_realloc_fast(struct mempool *pool, void *ptr, unsigned si
mp_end(pool, (uint8_t*)ptr + size);
return ptr;
}
#endif
......@@ -27,8 +27,7 @@
* @{
*/
#ifndef _KNOTD_COMMON_PRINT_H_
#define _KNOTD_COMMON_PRINT_H_
#pragma once
#include <sys/time.h>
#include <stdint.h>
......@@ -100,6 +99,4 @@ void bit_printf(const uint8_t *data, unsigned length, printf_t print_handler);
*/
float time_diff(struct timeval *begin, struct timeval *end);
#endif /* _KNOTD_COMMON_PRINT_H_ */
/*! @} */
......@@ -27,8 +27,7 @@
* @{
*/
#ifndef _KNOTD_REF_H_
#define _KNOTD_REF_H_
#pragma once
#include <stddef.h>
......@@ -85,6 +84,4 @@ void ref_retain(ref_t *p);
*/
void ref_release(ref_t *p);
#endif /* _KNOTD_REF_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_COMMON_ALLOC_COMMON_H_
#define _KNOTD_COMMON_ALLOC_COMMON_H_
#pragma once
#include <stdio.h>
......@@ -55,6 +54,4 @@
#define dbg_mem(msg...)
#endif
#endif /* _KNOTD_COMMON_ALLOC_COMMON_H_ */
/*! @} */
......@@ -82,8 +82,7 @@
* @{
*/
#ifndef _KNOTD_COMMON_SLAB_H_
#define _KNOTD_COMMON_SLAB_H_
#pragma once
#include <pthread.h>
#include <stdint.h>
......@@ -273,6 +272,4 @@ void* slab_cache_alloc(slab_cache_t* cache);
*/
int slab_cache_reap(slab_cache_t* cache);
#endif /* _KNOTD_COMMON_SLAB_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_SOCKADDR_H_
#define _KNOTD_SOCKADDR_H_
#pragma once
/* BSD IPv6 */
#ifndef __POSIX_VISIBLE
......@@ -126,6 +125,4 @@ void sockaddr_port_set(struct sockaddr_storage *ss, uint16_t port);
*/
char *sockaddr_hostname(void);
#endif /* _KNOTD_SOCKADDR_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOT_COMMON_STRTONUM_
#define _KNOT_COMMON_STRTONUM_
#pragma once
#include <limits.h>
#include <stdint.h>
......@@ -124,5 +123,4 @@ inline static int knot_str2uint16t(const char *src, uint16_t *dest)
KNOT_STR2NUM(uint16_t, knot_strtoull, 0, UINT16_MAX, src, dest)
}
#endif // _KNOT_COMMON_STRTONUM_
/*! @} */
......@@ -22,8 +22,7 @@
* @{
*/
#ifndef _DNSTAP__DNSTAP_H_
#define _DNSTAP__DNSTAP_H_
#pragma once
#include <stddef.h>
#include <stdint.h>
......@@ -49,6 +48,4 @@
*/
uint8_t* dt_pack(const Dnstap__Dnstap *d, uint8_t **buf, size_t *sz);
#endif // _DNSTAP__DNSTAP_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _DNSTAP__MESSAGE_H_
#define _DNSTAP__MESSAGE_H_
#pragma once
#include <sys/socket.h> // struct sockaddr
#include <sys/time.h> // struct timeval
......@@ -70,6 +69,4 @@ int dt_message_fill(Dnstap__Message *m,
const struct timeval *qtime,
const struct timeval *rtime);
#endif // _DNSTAP__MESSAGE_H_
/*! @} */
......@@ -22,8 +22,7 @@
* @{
*/
#ifndef _DNSTAP__READER_H_
#define _DNSTAP__READER_H_
#pragma once
#include <fstrm.h>
#include <protobuf-c/protobuf-c.h>
......@@ -77,6 +76,4 @@ int dt_reader_read(dt_reader_t *reader, Dnstap__Dnstap **d);
*/
void dt_reader_free_frame(dt_reader_t *reader, Dnstap__Dnstap **d);
#endif // _DNSTAP__DNSTAP_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _DNSTAP__WRITER_H_
#define _DNSTAP__WRITER_H_
#pragma once
#include <fstrm.h>
#include <protobuf-c/protobuf-c.h>
......@@ -75,6 +74,4 @@ void dt_writer_free(dt_writer_t *writer);
*/
int dt_writer_write(dt_writer_t *writer, const ProtobufCMessage *msg);
#endif // _DNSTAP__DNSTAP_H_
/*! @} */
......@@ -25,8 +25,7 @@
* @{
*/
#ifndef _KNOTD_CONF_H_
#define _KNOTD_CONF_H_
#pragma once
#include <sys/types.h>
#include <sys/socket.h>
......@@ -434,6 +433,4 @@ void conf_free_group(conf_group_t *group);
/*! \brief Free log config. */
void conf_free_log(conf_log_t *log);
#endif /* _KNOTD_CONF_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOT_CONF_EXTRA_H_
#define _KNOT_CONF_EXTRA_H_
#pragma once
#include <stdbool.h>
......@@ -55,6 +54,4 @@ conf_extra_t *conf_extra_init(const char *file);
*/
void conf_extra_free(conf_extra_t *extra);
#endif /* _KNOT_CONF_EXTRA_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOT_CONF_INCLUDES_H_
#define _KNOT_CONF_INCLUDES_H_
#pragma once
#include <stdbool.h>
#include <stdio.h>
......@@ -87,6 +86,4 @@ conf_include_t *conf_includes_pop(conf_includes_t *includes);
*/
bool conf_includes_remove(conf_includes_t *includes);
#endif /* _KNOT_CONF_INCLUDES_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_LOGCONF_H_
#define _KNOTD_LOGCONF_H_
#pragma once
struct conf_t;
......@@ -40,6 +39,4 @@ struct conf_t;
*/
int log_reconfigure(const struct conf_t *conf, void *data);
#endif /* _KNOTD_LOGCONF_H_ */
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_PROCESS_H_
#define _KNOTD_PROCESS_H_
#pragma once
#include <unistd.h>
......@@ -102,6 +101,4 @@ int proc_update_privileges(int uid, int gid);
*/
char *pid_check_and_create();
#endif // _KNOTD_PROCESS_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOTD_REMOTE_H_
#define _KNOTD_REMOTE_H_
#pragma once
#include "knot/conf/conf.h"
#include "libknot/packet/pkt.h"
......@@ -185,6 +184,4 @@ int remote_create_ns(knot_rrset_t *rr, const char *d);
*/
int remote_print_txt(const knot_rrset_t *rrset, uint16_t i);
#endif // _KNOTD_REMOTE_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOT_DNSSEC_NSEC_CHAIN_FIX_H_
#define _KNOT_DNSSEC_NSEC_CHAIN_FIX_H_
#pragma once
#include <stdbool.h>
#include <stdint.h>
......@@ -120,5 +119,3 @@ bool knot_nsec_empty_nsec_and_rrsigs_in_node(const zone_node_t *n);
*/
int knot_nsec_create_chain(const zone_contents_t *zone, uint32_t ttl,
changeset_t *changeset);
#endif // _KNOT_DNSSEC_NSEC_CHAIN_FIX_H_
......@@ -24,8 +24,7 @@
* @{
*/
#ifndef _KNOT_DNSSEC_NSEC3_CHAIN_FIX_H_
#define _KNOT_DNSSEC_NSEC3_CHAIN_FIX_H_
#pragma once
#include "knot/dnssec/zone-nsec.h"
#include "knot/dnssec/nsec-chain.h"
......@@ -41,5 +40,3 @@
*/
int knot_nsec3_create_chain(const zone_contents_t *zone, uint32_t ttl,
changeset_t *changeset);
#endif // _KNOT_DNSSEC_NSEC3_CHAIN_FIX_H_
......@@ -25,8 +25,7 @@
* \addtogroup dnssec
* @{
*/
#ifndef _KNOT_DNSSEC_ZONE_EVENTS_H_
#define _KNOT_DNSSEC_ZONE_EVENTS_H_
#pragma once
#include "knot/zone/zone.h"
#include "knot/updates/changesets.h"
......@@ -79,5 +78,4 @@ int knot_dnssec_sign_changeset(const zone_contents_t *zone,
changeset_t *out_ch,
uint32_t *refresh_at);
#endif // _KNOT_DNSSEC_ZONE_EVENTS_H_
/*! @} */
......@@ -26,8 +26,7 @@
* @{
*/
#ifndef _KNOT_DNSSEC_ZONE_KEYS_H_
#define _KNOT_DNSSEC_ZONE_KEYS_H_
#pragma once
#include <stdbool.h>
#include <stdint.h>
......@@ -98,6 +97,4 @@ void knot_free_zone_keys(knot_zone_keys_t *keys);
*/
uint32_t knot_get_next_zone_key_event(const knot_zone_keys_t *keys);
#endif // _KNOT_DNSSEC_ZONE_KEYS_H_
/*! @} */
......@@ -26,8 +26,7 @@
* @{
*/
#ifndef _KNOT_DNSSEC_ZONE_NSEC_H_
#define _KNOT_DNSSEC_ZONE_NSEC_H_
#pragma once
#include <stdbool.h>
#include "knot/updates/changesets.h"
......@@ -85,6 +84,4 @@ int knot_zone_create_nsec_chain(const zone_contents_t *zone,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy);
#endif // _KNOT_DNSSEC_ZONE_NSEC_H_
/*! @} */
......@@ -26,8 +26,7 @@
* @{
*/
#ifndef _KNOT_DNSSEC_ZONE_SIGN_H_
#define _KNOT_DNSSEC_ZONE_SIGN_H_
#pragma once
#include "knot/updates/changesets.h"
#include "knot/zone/zone.h"
......@@ -139,6 +138,4 @@ int knot_zone_sign_rr_should_be_signed(const zone_node_t *node,
const knot_rrset_t *rrset,
bool *should_sign);
#endif // _KNOT_DNSSEC_ZONE_SIGN_H_
/*! @} */
......@@ -24,8 +24,7 @@
* @{